audio stream sampling rate in linux

Posted by farhan on Stack Overflow See other posts from Stack Overflow or by farhan
Published on 2011-01-31T07:11:49Z Indexed on 2011/01/31 23:26 UTC
Read the original article Hit count: 210

Filed under:
|
|

Im trying read and store samples from an audio microphone in linux using C/C++. Using PCM ioctls i setup the device to have a certain sampling rate say 10Khz using the SOUND_PCM_WRITE_RATE ioctl etc. The device gets setup correctly and im able to read back from the device after setup using the "read".

int got = read(itsFd, b.getDataPtr(), b.sizeBytes());

The problem i have is that after setting the appropriate sampling rate i have a thread that continuously reads from /dev/dsp1 and stores these samples, but the number of samples that i get for 1 second of recording are way off the sampling rate and always orders of magnitude more than the set sampling rate. Any ideas where to begin on figuring out what might be the problem?

© Stack Overflow or respective owner

Related posts about linux

Related posts about audio-recording