Close

Speech Adaptation

A project log for Demolition Man Verbal Morality Statute Monitor

Project to build a working swear detector to enforce the verbal morality statute from the movie Demolition Man.

tdicolatdicola 04/07/2014 at 03:260 Comments

In this update I've worked on improving the speech recognition by adapting PocketSphinx's acoustic model to my microphone and voice.  I've also added a switch to put the device into a quiet mode where it doesn't sound an alarm or print a ticket when profanity is detected.  Take a look at this video: 

For the speech model adaptation I followed these steps from the PocketSphinx website: http://cmusphinx.sourceforge.net/wiki/tutorialadapt  With the adapted model the profanity detection is a little bit better.  Some words still aren't recognized very well--for example it still doesn't recognize 'fuck' that often (it sometimes thinks 'fix' is fuck), but strangely it recognizes 'fucker' very well.  That said, I'm pretty happy with where things are at with the speech recognition and keyword spotting right now.

I also added a switch attached to the Raspberry Pi GPIO which puts the software into a quiet mode.  This is useful for testing the recognition without wasting printer paper or blaring the audio.

One issue I'm still trying to figure out is why ALSA sometimes cuts off playback of the alarm audio.  The full alarm should say "You are fined one credit for violation of the verbal morality statutes.", however you can sometimes hear it cuts off "statutes" at the very end.  I've tried adding ALSA calls to wait until the playback buffer is drained and even padded the audio file with a second of silence at the end but still see it cutting off audio randomly.  I plan to look a little more into this, but if I can't resolve it I don't think it's a big deal.

Finally, as a next step I hope to make progress on building the enclosure for the device.  Originally I didn't think there would be time for it, but based on how much progress I made I think I can get something together to resemble the real device.  My current plan is to use a cardboard tube (like from an oatmeal container), foam board, and bent cardboard to build the enclosure.  Metal tape stuck to the outside should be a cheap and easy way to get a metallic finish.  I'm not going for perfect film accuracy--just something that is recognizable as the real thing.

Discussions