I am trying to record sound through sound sensor module and I found that raspberry pi does not have analog input system. I bought an ADC chip (MCP3008) to convert analog to digital signal so that Raspberry pi can read sound. With python coding, I got digital signal between 0 and 1023 from the sound sensor. However, I wonder if I can record the sound and play it through speaker?
1 Answers
Question
Rpi + ADC MCP3008 read sound from sound sensor get ADC results 0 and 1023
can record the sound and play it through speaker?
Answer
Yes, no problem, if you can bear poor HiFi quality. Since Rpi is an educational tool anyway, it should be a very good learning exercise.
Let me make some random comments.
You are using a "sound sensor" which I think is sort of a mini microphone with a mini power amplifier (see Note 1 below). You might like to give a weblink to make sure.
Human voice/music is roughly in the 20kHz range. According to the information theory guys, to have HiFi quality without much information loss, you need to sample twice more frequent, ie, 40kHz. MCP3008 with 200kps max can do without problem.
Now you log your ADC results in an array then to a text file.
To play back, so you DAC to play back. (This is off topic, so no details here)
Note 1
A sound sensor can be a very low HiFi quality sound detector. On the other hand many sound sensors are actually high HiFi quality Mike + Amp + AGC. I once played with cheapy (US$2) MAX9814 modules and found it good for hobbyists. But for better sound quality, see Note 2 below.
Note 2
MCP3008 ADC is only 10 bit resolution, and the HiFi quality is very very poor. I would suggest to try 12bit MCP3201/4/8. Their python programming difficulty is almost the same.
/ to continue, ...
References
MCP3008 [SPI, 10 bit, 200kps] Datasheet - MicroChip
How to amplify voice from microphone in real time? - Old Rpi StkEx post
How to make one MCP3008 A/D conversion? - Old Rpi StkEx post
Differences Between 16-Bit and 24-Bit Audio - Wesley Fenlon 2011mar03

- 4,665
- 3
- 10
- 24