As we tediously brainstormed ideas in the first hour of the hackathon, we managed to consume an entire Pringles can. It was at that moment, we knew, that the can of Pringles had to be an integral part of the rest of our hackathon.
Overall, it was the combination of our desire to build whatever we want in Hack&Roll, and the Pringles can that was lying around.
What it does
This can of Pringles can produce music.
By pressing on the various mechanical keyboard switches attached to the can, it sends serial data to a computer which is then processed as MIDI signals by our custom driver. Crisp also supports changing the octave of the instrument on the fly and producing sharps and flats. Finally, the MIDI output is then registered by the visualizer. Routing the sound through MIDI enables users to use it in various software and DAWs.
How we built it
Crisp was built with three programming languages, C++ (Arduino-C), Python, and Rust.
Additionally, Crisp comprises three main constituents, (1) hardware, (2) MIDI drivers, and a (3) visualizer. (1) The hardware was built into the can of Pringles with an Arduino Mega 2560. The Arduino sends serial signals to the computer which is then processed by the drivers built with Python. (2) The Python driver translates the signals into simple MIDI function calls which either activate or deactivate the various notes in the MIDI channel. (3) Simultaneously, the visualizer built with Rust uses multithreading to asynchronously pick up the MIDI output and produce graphics with them using SDL2 bindings. These three components are bundled together to supply the user with an entertaining experience.
In summary, here are the technologies we used:
Arduino - Hardware
rust-sdl2 - Visualizer graphics
midir - Visualizer MIDI processing
pyserial - Driver serial port access
mido - Driver MIDI objects
Challenges we ran into
One challenge that was faced was multithreading the MIDI signal registration along with the graphic interface. The MIDI library used in Rust required an asynchronous callback function to be used to pick up live signals which meant that it needed to be run along with the graphics window.
Another technical challenge we encountered was that several of our digital ports which we used for registering inputs were broken. After attempting to debug the circuit several times, we eventually identified the issue was with the ports. Changing the ports resolved this problem.
Furthermore, because of the volume the wires took up, it was difficult to compress everything into a single Pringles can. Doing so required us to reorganize our wires and components, shorten the height of resistors and LEDs, as well as purchase a glue gun to help put everything together.
Accomplishments that we’re proud of
Successfully combining various frameworks and programming languages seamlessly and being able to play cool tunes on an instrument we made.
What we learned
Multithreading, MIDI byte formatting, and deserialization.
What's next for Crisp
Creating an entire orchestra of Crisp instruments.