Exemplo n.º 1
0
        /// <summary>
        /// Adds wave file to viewer for visualization.
        /// </summary>
        /// <param name="data">Wave file data.</param>
        /// <param name="samplesPerPixel">Samples allocated to each vertical column of pixels.</param>
        public void addWavToViewer(byte[] data, int samplesPerPixel)
        {
            BeginInvoke((MethodInvoker) delegate
            {
                waveViewer1.SamplesPerPixel = samplesPerPixel;

                WaveFormat waveFormat = new WaveFormat(44100, 16, 1);
                Stream memStream      = new MemoryStream(data);
                WaveStream waveStream = new WaveStreamDer(memStream, waveFormat);

                waveViewer1.WaveStream = waveStream;
            });
        }
Exemplo n.º 2
0
        public static void convertToWave(byte[] waveData)
        {
            short[] sampleBuffer = new short[waveData.Length / 2];
            Buffer.BlockCopy(waveData, 0, sampleBuffer, 0, waveData.Length);

            DateTime dt = DateTime.Now;
            string file = dt.ToString("hh:mm:ss:ffff");//Path.Combine(Path.GetTempPath(), Guid.NewGuid().ToString() + ".wav");
            WaveFormat waveFormat = new WaveFormat(44100, 16, 1);
            Stream memStream = new MemoryStream(waveData);
            WaveStream waveStream = new WaveStreamDer(memStream, waveFormat);

            Program.mainForm.Invoke(new Action(() =>
            {
                Program.mainForm.addWavToListBox(file);
            }
            ));

            file += ".wav";

            WaveFileWriter.CreateWaveFile(file, waveStream);
        }
Exemplo n.º 3
0
        public static void convertToWave(byte[] waveData)
        {
            short[] sampleBuffer = new short[waveData.Length / 2];
            Buffer.BlockCopy(waveData, 0, sampleBuffer, 0, waveData.Length);

            DateTime   dt         = DateTime.Now;
            string     file       = dt.ToString("hh:mm:ss:ffff");//Path.Combine(Path.GetTempPath(), Guid.NewGuid().ToString() + ".wav");
            WaveFormat waveFormat = new WaveFormat(44100, 16, 1);
            Stream     memStream  = new MemoryStream(waveData);
            WaveStream waveStream = new WaveStreamDer(memStream, waveFormat);

            Program.mainForm.Invoke(new Action(() =>
            {
                Program.mainForm.addWavToListBox(file);
            }
                                               ));

            file += ".wav";

            WaveFileWriter.CreateWaveFile(file, waveStream);
        }
Exemplo n.º 4
0
        /// <summary>
        /// Adds wave file to viewer for visualization.
        /// </summary>
        /// <param name="data">Wave file data.</param>
        /// <param name="samplesPerPixel">Samples allocated to each vertical column of pixels.</param>
        public void addWavToViewer(byte[] data, int samplesPerPixel)
        {
            BeginInvoke((MethodInvoker)delegate
            {
                waveViewer1.SamplesPerPixel = samplesPerPixel;

                WaveFormat waveFormat = new WaveFormat(44100, 16, 1);
                Stream memStream = new MemoryStream(data);
                WaveStream waveStream = new WaveStreamDer(memStream, waveFormat);

                waveViewer1.WaveStream = waveStream;
            });
        }