Consider this scenario: Your wall-to-wall neighbor loves to blast Reggaeton music at full volume through a Bluetooth speaker every morning at 9 am. You have two options:
- A. Knock on their door and politely ask them to lower the volume.
- B. Build an AI device that can handle the situation more creatively.
Reggaeton Be Gone (the name is a homage to Tv-B-Gone device) will monitor room audio, it will identify Reggaeton genre with Machine Learning and trigger comm requests and packets to the Bluetooth speaker with the high goal of disabling it or at least disturbing the sound so much that the neighbor won't have other option that turn it off.
Disclaimer: Reggaeton Be Gone is an experimental project. Before deploying it, check your local laws and regulations. Use it only with your own Bluetooth speakers for educational purposes. Also, keep in mind that you need to be close enough to the speaker for the RPI BT to reach the speaker, and not all Bluetooth speakers are vulnerable. Last but not least: I have nothing against this or other music genres. It was purelycoincidental.
Parts- Raspberry Pi 3
- DFRobot Oled 128x32
- Push Button
- microSD card
- 5v 3A power supply
- Female to female jumper cables
- 3d printed case front (I did use the metal enclosure from a broken audio board)
- USB Mic or Board and Mic (I do use a Behringer Xenyx302)
- (Optional) Bluetooth audio receiver board (if you want to test with your own BT, this is an ideal cheap board)
- Button to GND and GPIO 26
- Oled to VCC, GND, SDA GPIO 2 and SDL GPIO 3
- Connect the Sound board or MIC to the USB
I did install Raspberry PI OS https://www.raspberrypi.com/software/
Then executed
sudo raspi-config
And enabled SSH and i2c
Requisitespip install RPi.GPIO
pip3 install Adafruit_GPIO
sudo apt install git
pip install picamera
sudo apt install python3-opencv
sudo apt-get install libatlas-base-dev libportaudio0 libportaudio2 libportaudiocpp0 portaudio19-dev
git clone https://github.com/edgeimpulse/linux-sdk-python
sudo python3 -m pip install edge_impulse_linux -i https://pypi.python.org/simple
sudo python3 -m pip install numpy
sudo python3 -m pip install pyaudio
i2cdetect -y 1 to check if the Oled screen is being detected.
You should also run alsamixer and press F6 to select the board and F4 to change the input volume
There are several music genre AI classification datasets and models like GTZAN but I did not find a reggaeton category, so I had to train my own model.
Reggaeton could be irritating doe to the classic syncopated rythym pattern but the same feature makes it ideal for ML pattern recognition.
I did download several songs of reggaeton and other genres, I did export to 16khz wav, upload the wavs to Edge Impulse platform Then used Times Series 4000ms window size, MFE processing, Classification as the learning block. I did deploy for Linux ARM, then exported the eim file, placed into the Raspberry and changed permissions to 744.
You can train your own model or wait since I will publish mine soon.
The Python code will take audio samples, send them to the ML model for inference. If the score obtained for reggaeton genre is higher that the threshold, it will trigger one of 2 methods of BT connections. One of them with rfconn and the other with l2ping. A log file is saved and device operation is displayed in an Oled screen.
Settings configurations are the following. You have to trial/error to identify the best method, package size and threads count. If you can use an external BT board with antenna, that will help a lot.
myPath="" # reggaeton be gone folder
selectedDeviceId = 1 # id of the USB mic of board
method = 1 # 1 to 3 # BT attack method
targetAddr = "" # mac address of the BT speaker
packagesSize = 0 # packet size, try around 600-1000
threadsCount = 0 # how many
threshold = 0.95 # limit to consider that the song is reggaeton
myDelay = 0.1 # delay between connections
forceFire = 1 # test purposes
model = ".eim" # model file name
How to get the MAC address of the BT speakerIf you are testing with your own BT speaker, you can connect with the Smartphone and check the MAC from the connection-information. If you are not, you can use bluetoothctl command and try to guess the target MAC according to the info, rssi power, etc
sudo bluetoothctl
scan on
You will get 2 columns MAC address and sometimes, speakers identifiers like POCKETTUNE, AUVIO, etc
You can also run
sudo btmon |grep RSSI & sudo hcitool scan
and get RSSI
RSSI information to determine MAC address
A file named log.txt will record all the device actions.
https://www.tiktok.com/@ronibandini/video/7338068473869847813
UpgradesFor a future version it would be nice to have an external BT board with antenna and to include the MAC scan and selection.
More informationSpanish info about Reggaeton Be Gone
Workshop
April 13 I will host an online workshop on Nerdearla Chile about Reggaeton Be Gone. I will also release a new version and new ML model.
Workshop video
More about Reggaeton be gone in Contracultura Maker talk
Comments