Introduction: Pi-In-The-Middle Audio Prank
One of my co-workers listens to music from his laptop via a separate stereo system. He went on vacation, so of course we felt the need to mess with him! The idea is simple, he can listen to his music the same as always, but we can periodically change the volume, balance, or even the music altogether. This all happens remotely, we don't even need to be in the building!
You don't need much for this project:
- Raspberry Pi 3 (and micro SD card)
- USB Power Supply
- Audio USB (I got THIS ONE)
- 3.5mm to female RCA audio cable (something like THIS)
- 3.5mm to male RCA audio cable (something like THIS)
You might need different cabling depending on the stereo or the cabling used. This is just how his system was setup.
The only "special" part needed for this is the USB audio card. Because the Pi doesn't have a microphone port and the audio card is limited, it's easiest to get an all-in-one card that will let sounds though, or can interrupt the flow. Luckily, Raspbian has drivers already for this card, which makes the setup even simpler!
There is also more efficient cabling that could be done, but part of the prank is that the prankee doesn't know the device is there. That means that the plug they use in their laptop needs to be exactly the same as always, so they don't suspect anything when they plug it in. This prank would also work great in a home theatre setup!
Step 1: Hook It Up!
Connecting it all up is fairly simple. Make sure the pi is off before doing this.
Unplug the cable from the stereo. This will likely have red and white connector, but might have a headphone plug depending on the stereo. Assuming it has red and white plugs, connect them into to the cable with the female connectors and that cable into the headphone port on the audio card. This will take the audio from the laptop (or other audio source) into the pi.
Next, take the cable with the male RCA connectors and connect it from the headphone port on the USB to the back of the stereo. This will allow the pi to play audio through the stereo.
Finally, connect the USB card to any port on the Pi. Once you pick a port, try to stick to it. Moving the card between ports can reset some configurations that we will discuss later.
I've attached an artist's rendition of how the system was initially setup, and how it will be modified.
Step 2: Configuration
You'll need a way to remotely mess with the prankee. The easiest way to do this is over the network. This can be wireless or ethernet, whichever works for your situation. It is a very simple way to have deniability as you don't need to be around.
Make sure SSH is enabled on the raspberry pi. This will be an easy way to control the disruptions at the perfect time from anywhere on the network. Below is a command to enabled the build-in ssh server
Selects these options to enabled it:
Interfacing Options > SSH > Yes
You will have to select the correct audio card and set it as default. This will make sure that if you play any audio, it will come out of the correct speakers. It can be done from the desktop by clicking the Raspberry icon > Preferences > Audio Device Settings. In the window that opens, select C-Media Headphone Set from the drop-down. Click "Make Default".
Under the Microphone slider, make sure the icon shows a little enabled speaker. This will make it so the card handles passing through audio automatically. As long as the pi is on, anything they try to play will play properly on the speakers.
Step 3: Software
For this project, you will need a working Raspberry Pi 3 with an operating system. We used Stretch, which is the latest Raspbian version for the Pi. I'm not going to cover how to set up the SD card as there are a ton of tutorials online (ie. here). Using a Pi 2 or even 1 would probably work well enough.
There are only a few little things to install. To run the commands below, type them into the Terminal
Git - This is needed to help download a few of the pieces we need:
sudo apt-get update
sudo apt-get install git
pyalsaaudio - This is a library used to control the sound card from Python. The commands below will download and install it:
git clone https://github.com/larsimmisch/pyalsaaudio.git
python setup.py build
sudo python setup.py install
pi-in-the-middle script - My custom-modified script to help with the pranking magic:
git clone https://github.com/david0429/pi-in-the-middle.git
Step 4: Let the Games Begin!
One simple action is to adjust the volume or the balance between the speakers. alsamixer is a simple command-line tool that can do this. In your Terminal connect to the target Pi via SSH, and enter the command:
Once this is open, you can use the arrow keys to adjust the "Headphone" volume. If it doesn't say "Card: C-Media USB Headphone Set", then you have the wrong audio card selected. Use F6 to select the right card.
This is a basic script you downloaded in a previous step. It's nothing fancy, but it makes changing the audio a little more automatic. It will fade out whatever is playing and fade your audio in. It will play for a few seconds, then refade their audio back in.
You will need to get wav files to use in exchange of the currently audio. Think of really annoying songs like "It's a Small World" or "Hampsterdance".
To use it, again connect to the Pi via SSH, and type:
This will navigate to the repository that contains the prank script.
To play an audio file, type:
For example, if you had a file called "annoying.wav", the command would be:
You might need to do some testing and tweak the microphone and speaker volumes in this script to better suit your setup.
Step 5: Final Thoughts
Take Your Time
My best suggestion for making this truly successful is to take your time. If you constantly mess with their music, they will either realize immediately that something wonky is going on, or they will assume things are broken and change their setup. Start by doing it only a couple of times per day. If they get really suspicious, hold off for a couple of days so they forget about it.
Mix it up
Try changing things at different times. Do it when you are out of the room or you two are talking. Involve a third person in the prank to activate sounds to deflect attention from yourself. Changing up when it is happening will go a long way to having them not notice any patterns.
When they ask about the weird sounds they are hearing, pretend you don't notice them. The less you say, the more they will question if it even happened...
Make it Personal
Once they are convinced that something is up, make a wav file specifically tailored to them. Record some text to speech asking for some information, or telling them you like the way their hair is today.
A good prank is always fun, but make sure not to take it too far (pretty sure this is a Canadian proverb)
- The first few times, he assumed he was just hearing things
- Whenever it would play, he would ask "you guys are hearing this too, right?"
- A few days in, he was convinced his computer had a virus
- By a week, he had called tech support for computer help. (We made sure this didn't cost him money)
- After 2 weeks it was asking for company trade secrets
- He unplugged the cable from his computer, but it was still playing music. This was the giveaway that we were messing with him