<div class="gmail_quote">On Tue, Feb 1, 2011 at 7:55 AM, farhan baluch <span dir="ltr"><<a href="mailto:farhanbaluch@gmail.com">farhanbaluch@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
Hi All, <div><br></div><div>I am trying to read data from a usb microphone and using the pretty standard method of using ioctl's to setup the sampling rate, channels, bits and block size . This all works so the device is correctly setup. I then use "read" to read samples from the device which shows up as /dev/dsp1. I get a lot more samples from this read command in one second of recording than the set sample rate. E.g. if i set 10Khz on one run i got 269312 samples. Looking at the raw data it looks like there is a lot of duplication of data? is this common for the audio input device? if so what kind of encoding is it (e.g with some specific redundancy built in)? </div>
</blockquote><div><br>You need to use the correct ioctl()'s to set up the data format before you read from the device. After you've done that, the data will make sense to you. If you just start reading from the device, you don't know the sample rate, bitdepth and channel count. I suspect the "duplication of data" happens because the device is sending data in two channels. (mono in "stereo")<br>
<br><br> Sampo<br> <br></div></div><br>