4

I am looking to capture speech and save it as a wav (Wave PCM) in RPi. Ideally the speech should be captured in 8khz with 16bit resolution and saved as a raw file or wav file. I also have a need to capture multiple channels (ie 4 microphones simultaneously)

Now:

Is RPi an appropriate solution for this requirement? Or should I look at other options?

I know that RPi does not have an ADC, and some of the ADCs I saw in Adafruit does not have sufficient SPS to capture at 8khz. So any suggestions?

Any general tips/suggestions are also most welcome.

Piotr Kula
  • 17,336
  • 6
  • 66
  • 105
Raj
  • 143
  • 3

1 Answers1

4

Whether you can sample with 16 bit precision is down to your skills as a electronics engineer. I believe there is more to that than simply putting a 16-bit ADC into a circuit and hoping for the best. Perhaps 12-14 bit precision would be easier. That aspect is best answered in an electronics forum.

The standard Rapberry Pi Linux driver tops out at about 20 thousand SPI transactions per second (see http://www.raspberrypi.org/forums/viewtopic.php?p=594022#p594022 for an experiment of mine).

If you can read 4 channels from your ADC in one transaction then you could meet your 8ksps. However if your ADC (like most I've seen) only allows one channel to be read per transaction that would need 32 thousand transactions per second, which is beyond the capabilities of the standard SPI driver.

There is another issue. Do your samples need what I call temporal integrity, i.e. is it important that each sample is 1/8000 of a second (125µs) since the last one? If so Linux can't really deliver, the gaps will vary.

I can offer a solution to both problems. You can bypass Linux, use DMA to guarantee the timings, and bit-bang SPI to read 4 separate ADCs simultaneously. I have used that technique to read 2 ADCs at 25ksps with 40µs between reads. It should easily scale to 4 chips.

However my solution would probably require you to have better than average software skills. See http://www.raspberrypi.org/forums/viewtopic.php?f=44&t=71089

joan
  • 71,852
  • 5
  • 76
  • 108