Quantcast
Channel: naudio Work Item Rss Feed
Viewing all articles
Browse latest Browse all 738

Commented Issue: wrong speed for the different rate [16368]

$
0
0
when i records audio with the sample WaveIn class, it's get wrong speed, if i shoose rate different from 8000. Only in 8 kHz i've got correct speed - on the 16000 audio got two times longer and lower tone, at 44000 it almost nothing to hear, sound terrify. Please check, what i've done wrong.

public static void StartRecording(string path, int device)
{
waveInStream = new WaveIn();

writer = new WaveFileWriter(path, waveInStream.WaveFormat);

waveInStream.DeviceNumber = device;

waveInStream.WaveFormat = new WaveFormat(8000, 32, 1);
waveInStream.BufferMilliseconds = 200;
waveInStream.NumberOfBuffers = 4;

waveInStream.DataAvailable += waveInStream_DataAvailable;
waveInStream.StartRecording();
}

static void waveInStream_DataAvailable(object sender, WaveInEventArgs e)
{
writer.Write(e.Buffer, 0, e.BytesRecorded);
}


Comments: set the waveInStream format before creating the WaveFileWriter waveInStream.WaveFormat = new WaveFormat(8000, 32, 1); writer = new WaveFileWriter(path, waveInStream.WaveFormat);

Viewing all articles
Browse latest Browse all 738

Trending Articles