Quantcast
Channel: Visual C# forum
Viewing all articles
Browse latest Browse all 31927

actually 8-bit samples or not 16-bit samples

$
0
0

here is my code:

            int deviceNumber = 0;
            waveIn = new WaveIn();
            waveIn.BufferMilliseconds = 250;
            waveIn.DeviceNumber = deviceNumber;
            waveIn.DataAvailable += waveIn_DataAvailable;
            waveIn.WaveFormat = new WaveFormat(44100, NAudio.Wave.WaveIn.GetCapabilities(deviceNumber).Channels);
            waveIn.StartRecording();
        }
        void waveIn_DataAvailable(object sender, WaveInEventArgs e)
        {
            PointPairList list = new PointPairList();
            PointPairList list2 = new PointPairList();
            byte[] buffer = e.Buffer;
            int bytesRecorded = e.BytesRecorded;
            points = new RollingPointPairList(32768 / 2);
            buffer1 = new double[(32768 / 2)];
            int tempint = 0;
            for (int index = 0; index < 32768; index += 2)
            {

                buffer1[tempint] = ((buffer[index + 1] << 8) |
                                        buffer[index + 0]);
                tempint++;

            }

e.buffer is one sample 16 bit samples and not 8 bit samples right? 
is there a way to check that ?


Viewing all articles
Browse latest Browse all 31927

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>