示例#1
0
        public static void Run()
        {
            var n = 0.22638460993766786f;

            var left = AudioSamples.GetSample1().PcmStream;
            var max  = left.Select(x => Math.Abs(x)).Max();

            float k = short.MaxValue / max;

            AudioProcessor.NormalizedToBytes_16(n, k, out var a, out var b);

            var nr = AudioProcessor.BytesToNormalized_16(a, b);
        }
示例#2
0
        public static void Run()
        {
            //AudioProcessor.Run(args);
            var sample = AudioSamples.GetSample1();

            byte[] rawBytes = new byte[sample.PcmStream.Length * 4];
            //AudioProcessor.GetWaveData(sample.PcmStream, null, ref rawBytes);

            AudioProcessor.GetWaveDataV2(sample.PcmStream, ref rawBytes);

            var max = sample.PcmStream.Select(x => Math.Abs(x)).Max();

            float k = int.MaxValue / max;

            //var s1 = AudioProcessor.BytesToNormalized_16(rawBytes[4], rawBytes[5]);
            var s1 = AudioProcessor.ToFloat(rawBytes, 0, k);
            var s2 = AudioProcessor.ToFloat(rawBytes, 4, k);
            var s3 = AudioProcessor.ToFloat(rawBytes, 8, k);
            var s4 = AudioProcessor.ToFloat(rawBytes, 12, k);

            Console.WriteLine(BitConverter.IsLittleEndian);
        }