Exemple #1
0
        public static void WriteWav16BitMono(Stream stream, int sampleRate, double[] samples)
        {
            WriteWavHeader(stream, false, 1, 16, sampleRate, samples.Length);
            List <byte> ba = new List <byte>();

            {
                for (int i = 0; i < samples.Length; i++)
                {
                    byte[] fs = WaveStream.DoubleToBytes(samples[i]);
                    ba.AddRange(fs);
                }
                ;
            };
            stream.Write(ba.ToArray(), 0, ba.Count);
        }
Exemple #2
0
        public static void WriteWav16BitStereo(Stream stream, int sampleRate, double[] L, double[] R)
        {
            WriteWavHeader(stream, false, 2, 16, sampleRate, L.Length * 2);
            List <byte> ba = new List <byte>();

            {
                for (int i = 0; i < L.Length; i++)
                {
                    byte[] fs = WaveStream.DoubleToBytes(L[i]);
                    ba.AddRange(fs);
                    fs = WaveStream.DoubleToBytes(R[i]);
                    ba.AddRange(fs);
                }
                ;
            };
            stream.Write(ba.ToArray(), 0, ba.Count);
        }