From personal experience, starting on working with Arduinos can be challenging. In particular, many have been tasked to code a celebratory song for their robot at the end of a maze, a part of the project that is always unnecessarily tedious.
The song is typically hardcoded and the coder has to be able to read the notes off a song sheet or transcribe it directly from the song to add it to their code. This means the code is prone to errors and takes a long time to complete, especially for those unfamiliar with music notation. They would also have to wait for their code to compile and run on the Arduino which makes the process even longer.
Since it is such a time consuming part of the code with little real learning value, we decided to automate this process, making it easy for everyone to add a little music to their project.
What it does
This tedious task can be easily completed with the help of ARe u DUIN OK? Our project consists of 3 different interfaces for users to easily generate the codes for their Ardunio to create music.
1) The CLI interface
For users that already know how to read musical notations or have a simple song sheet consisting of alphabetical music notes of a song that they can refer to, the CLI interface helps them easily convert their song into Arduino
2) The Virtual Piano Interface
For the more musically inclined users they can simply play the song on our virtual piano. The piano has two inputs, clicking the piano key buttons on the screen, or playing the piano using the keys on their keyboard. Users can save their songs and play them back to see how they sound. They can then click the Save button to convert their song into Arduino code.
In addition to allowing users to easily transcribe their music, the virtual piano allows users to easily create and save their own songs without the need for external software.
3) Converting a Wav file to C code
For the users who have no concept of music notation and just want a fast way to convert their music files directly into working Arduino codes, the Wav file converter is the go to interface for them. All they need to do is to run the python
This wav file can either be from a song they like, or it can be generated from an external software such as bandlab lab and exported. For instance, in my video example the testNotes.wav song was created by me in bandlab, which offers more advanced features for song creation.
With these 3 interfaces, users are sure to be able convert their songs to Arduino codes easily
How we built it ( ͡❛ ͜ʖ ͡❛)✌
- It is built with python to create the user interface and the notes generation code.
- tkinter was used to develop the GUI for the virtual piano
- A lot of research to try and figure out how music works lol
Challenges we ran into
- Figuring out how to write codes in C syntax again, as I have not written C codes for the Arduino in a while.
- Finding a way to extract the notes from the wav files.
- Figuring out how to build a virtual piano for tkinter that could handle inputs from both button presses on the screen and keypresses for the keyboard
- Had a few issues testing the codes on the Arduino since the buzzers I had weren't working very well
- Trying to understand the musical notation needed to even create music in the first place
Accomplishments that we're proud of (っ＾▿＾)💨
- We managed to create the working code
- Managed to figure out why some of the packages that I wanted to work with for other projects *were never working and finally managed to use them in this project.
- Completing the project with a two man team
- Creating a decent looking ui for the virtual piano
What we learned ✍(◔◡◔)
- How to generate music directly from python without the need to relying on individual note wav files (see the python playByFreq.py file)
- How to read keyboard inputs using python
- How to change the qualities of music (eg pitch , speed) and how that can be translated into Arduino code
- How to create a High Fidelity User Interface with Figma.
What's next for ARe u DUIN Ok? 👊 ( ͡❛ ͜ʖ ͡❛)
- We hope that “ARe u DUIN Ok?” can create more simplified codes for beginners. For example,
- Upon request or feedback from the users, we can create new codes to make it easier for them to get through their University Courses.
- Integrate the 3 components together and convert it into an executable for people to use
- More options for sound editing in the post processing such as adjusting the octave, speed, and amplitude of the song, and even allowing users to play their songs in reverse.
- Additional documentation to make the product even more accessible to beginner coders
You can also watch our youtube video to see our code in action!