I want to improve my voice recognition system on a Raspberry Pi 3 running Pocket Spinx. It's pretty accurate (limited recognition vocabulary) but is terrible when other noise is around.

Is there any way to pre-process sounds before feeding them into pocket sphinx to filter only the human voice ? I was thinking there might be some way to reduce the data being passed in, eg human voice being between certain frequency etc, white noise removal etc. I haven't found anything simple so far. I'm thinking of filtering and processing the voice recordings on an STM32 that has an Arm Cortex M4 and DSP etc.


Human voice has the same frequencies as other noises, it is not possible to filter it with dumb algorithm. It is possible to filter based on temporal patterns like spectral subtraction, but this way you can only filter static noise, not background speech/bable noise. Pocketsphinx already has spectral subtraction.

To filter noise reliably you need an advanced noise filtering neural network or something like that, see RNNNoise, it is very resource-intensive. Also, it is better to recognize noise sound instead of filtering it since recognizer can figure out things by himself.

One important approach is to reliably filter is to use direction of arrival of the sound, that is a microphone array which can filter noises based on direction. An example of such array is Respeaker or Matrix One. Thats why all smart speakers have microphone arrays as a critical component.

For more accurate recognition it is better to use modern toolkit with neural network like Kaldi, it is also much more accurate with noise filtering and without it.

Further reading for you:

  1. Snips - Snips is a partially proprietary framework, but you can get some nice ideas and hardware advices. It is easy to get a good system using their packages too. Also see Community projects

  2. Make a smart speaker with Respeaker

  3. Zamia Speech the easiest way to run Kaldi on Raspberry Pi

  • $\begingroup$ Hi Nikolay, thanks for taking the time to write a detailed answer. The microphone direction is hopefully helped by the fact its a Webcam (integrated microphone) mounted on a servo camera mount, this tracks the individual talking. The camera use PIR to scan for person, once someone is detected the camera scan stops, and it recognizes faces via an OpenCV app I wrote. When subject has been identified ,camera microphone will be facing them. Are omnidirectional microphones any good ? Marcus $\endgroup$ – Marcus O'Brien Aug 25 '19 at 20:41
  • $\begingroup$ If you use face detector with omnidirectional microphone it should be good. Still, more accurate engine would help. $\endgroup$ – Nikolay Shmyrev Aug 26 '19 at 1:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.