The swear word restorer


Don’t you just hate it when you are watching your favourite tv show and they decide to block all the good swear words with the pesky beep. Did you know that all the tv show and film makers use the same 1kHz tone to block out swear words. I drew inspiration from THIS project where they used a Teensy to detect when everyone’s favourite YouTuber [electroboom] swore and lit up a few LED’s that made up his eyebrows

My version uses a raspberry pi since it was easier for me to complete my project. The software I used to detect the 1kHz was called snowboy and a standard USB microphone.


The hardware is pretty standard stuff, I used a USB microphone teamed up with one of these super small OTG micro USB adaptors. The speaker is a pimoroni speaker pHAT to make it as small and neat as possible with a raspberry pi zero.

  • Raspberry pi zero
  • USB microphone
  • pimoroni speaker pHAT
  • 8GB micro sdcard


So I was looking around for a way to detect the 1kHz tone. The first thing I found was THIS which is used to detect tones when using ham radios, It looked old and a little to complicate for what I wanted to do.

After a little more searching I couldn’t find anything that would fit the bill, In the past I have been messing about with Alexa on the raspberry pi. I remembered how the Alexa on the pi wouldnt let you use a wake word, I looked into how people had added a wake word to the Alexa and I found they were using snowboy.

Snowboy is an offline voice detection system, What you have to do is make a pdml sample file by logging into their site HERE and recording 3 different sample of the word you want to use. To make your sample more reliable you need to train it by having other people on the site record them saying the word. After your sample has been trained 500 times then it’s released to the public to use.

Since I was using it to detect a tone that is very constant I didn’t need my sample trained to work.

I noticed that when you used snowboy it would sound a tone to let you know it had heard you. Ive used part of this code to say swear words instead of the tone it played.

Im using snowboy version 1.2.0 for this code

Installing the software

First things first, make sure your raspberry pi is up to date with the usual commands

sudo apt-get update

sudo apt-get dist-upgrade

After that has finished you will need to install a few other things with

sudo apt-get install python-pyaudio python3-pyaudio sox

sudo apt-get install libatlas-base-dev

Next to get your USB mic working with snowboy you will need to add the below code to the ~/.asoundrc file using your favour text editor

pcm.!default {
  type asym
   playback.pcm {
     type plug
     slave.pcm "hw:0,0"
   capture.pcm {
     type plug
     slave.pcm "hw:1,0"

If  you get stuck on the install follow along on this website –


Swear restorer demo


Github link swear restorer –

Snowboy –


2 responses to “The swear word restorer

  1. Pingback: weight coaster | Facelesstech·

  2. Pingback: Speaker phat shim | Facelesstech·

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s