BuzzBox

Updated 10 December 2021

Do you ever wanna pump up some tunes but you don't know how to play a MIDI file? Fear not, the PiicoDev Buzzer modules let you stack up multiple tones into a song. Find your MIDI, export it through a script, upload it and get grovin'! 

Feel free to remix (pun intented) this project to your hearts content, if you have any ideas let me know down below!

What you'll need

Putting it together

Here’s where PiicoDev shines, it’s super easy to get everything together.

  1. Move each of the DIP switches around into unique addresses - with 2 switches 4 addresses are possible. Even more with the solder pads on the back (2 more states that's 16 possible addresses!)

  2. Connect your PiicoDev modules together, my daisy chain looked like this:

connection-diagram-for-piicodev-modules

  1. Then insert the Pico into the expansion board (the green one that tastes like Raspberries (please don't try to eat any of the Raspberry Pi's that you use in your projects)).

  2. Whack all of the electronics into the case/platform of your choice

modules-connected-inside-buzzbox-3d-printed-casebuzzers-on-piicodev-platform
  1. Plug the USB cable in, let's flash some code!

First of all, we'll make 2 folders, one for the Pico and one for the code we'll run on a computer (a Pi 4 will work).
Head over to the Buzzer guide for the RPi Pico, run through the tutorial pop the code into the Pico folder that we created before and make sure all of the Buzzer modules work - just change the addr argument buzz = PiicoDev_Buzzer(volume=2, addr=<YOUR ADDRESS HERE>)
Keep the PiicoDev code handy, we’ll need it later!

If you're unsure which addresses are being used run the following code in the REPL:

from machine import I2C
i2c = I2C(0)
i2c.scan()
  1. Head over to my GitHub to download the code for the BuzzBox, it leans on the Python-Midi-Analysis Repo that Cornerback24 crafted.

BuzzBox’s Git Repo

Unfortunately, this is script is too large to run on the Pico, that's why I have made it a program that you are able to run on a beefier computer. There is always the option to add the PiicoDev adapter for Raspberry Pi and export and play the audio from the one device, I opted to use the Pico so it's more accessible to Makers.

downloading-programs-from-github

  1. To export a MIDI, download a .mid file, and put it in the Midis directory, load up the MIDI2CSV.py file and change the file_to_convert to the file that you wanna play, run the script, then upload the CSV along with the BuzzerBox.py and main.py (you can overwrite the main file from the tutorial) from the Midi’s folder and move it to the same directory that you have the Pico files in, be sure to include the PiicoDev Unified and Buzzer modules as well.

changing-file-name-for-export

  1. Upload all of the files to the Pico, just change the argument to the loadMusic function

main-thonny-code-uploaded-to-pico

  1. Click play in Thonny and the Buzzers should startup!!

Take a look at the photos that Luke took!

buzzbox-standing-up

buzzbox-modules-inside-lid-ontop

buzzbox-internals-inside-case

Have a question? Ask the Author of this guide today!

Please enter minimum 20 characters

Your comment will be posted (automatically) on our Support Forum which is publicly accessible. Don't enter private information, such as your phone number.

Expect a quick reply during business hours, many of us check-in over the weekend as well.

Comments


Loading...
Feedback

Please continue if you would like to leave feedback for any of these topics:

  • Website features/issues
  • Content errors/improvements
  • Missing products/categories
  • Product assignments to categories
  • Search results relevance

For all other inquiries (orders status, stock levels, etc), please contact our support team for quick assistance.

Note: click continue and a draft email will be opened to edit. If you don't have an email client on your device, then send a message via the chat icon on the bottom left of our website.

Makers love reviews as much as you do, please follow this link to review the products you have purchased.