ECE434 Project - MIDI Sequencer

Team members: Gaven Williams, Brendan Perez

Grading Template
I'm using the following template to grade. Each slot is 10 points. 0 = Missing, 5=OK, 10=Wow!

 Add Extras

09 Executive Summary 09 Packaging 09 Installation Instructions 09 User Instructions 09 Highlights 09 Theory of Operation 09 Work Breakdown 09 Future Work/Conclusions 09 Hackster.io 09 Demo/Poster 00 Not Late

Score: 90/100

Executive Summary


Final hardware implementation of the MIDI Player

Our project is a MIDI/WAV music player. The user can browse through a selection of .mid and .wav files using pushbuttons and an LCD screen, or put the player in "shuffle" mode. While in MIDI mode, the user also has the option of selecting a soundfont, which will then be used in MIDI synthesis.

We have finished implementing all of these features.

Source code: https://github.com/rhit-perezbe/MIDI-Player

Packaging


We constructed a small UI box that houses the pushbuttons and LCD screen.

The CAD file (boxhole2.DXF) is located on our GitHub as well: https://github.com/rhit-perezbe/MIDI-Player

Installation Instructions
All installation instructions can also be found on our GitHub repo: https://github.com/rhit-perezbe/MIDI-Player

User Instructions
To get started with our program:

bone$ cd MIDI-Player

bone/MIDI-Player$ sudo ./midiPlayer.py

Now that it's running, the user can operate the player solely from the LED pushbuttons and LCD display.

User control is pretty straightforward, since the LCD display tells you each colored button's functionality. Additionally, depending on what state the player is currently, the available pushbutton options will be illuminated. Any non-illuminated buttons don't do anything when pressed in that state.

There are essentially 3 states of the player: Stopped, playing, and settings.

While stopped, these are the user options:

Green: Play currently displayed song (enters playing state)

Red: N/A

Orange: Skip to next song

White: Open setting menu

While playing, these are the user options:

Green: N/A

Red: Stops playback (enters stopped state)

Orange: Skip to next song

White: N/A

While in settings, these are the user options:

Green: Switches to next soundfont

Red: Toggles shuffle mode (illuminated while on, dark while off)

Orange: Toggles MIDI/WAV mode (illuminated while in MIDI mode, dark while in WAV mode)

White: Return to stopped state

Highlights
Our project was designed to be as robust and versatile as possible, while still maintaining a simple and accessible user interface.

One such feature is the ability to switch between soundfonts. This allows for any one MIDI file to be played with a variety of samples and instruments, giving the user a wide range of choices for how they want to listen to a certain song. We even included the infamous "meowsynth" if the user insists on hearing their music sung by the dulcet tones of a cat.

Anyone who downloads our project can add any MIDI, WAV, and soundfont (SF2) files to their respective folders to expand the library of music. Additionally, uploading a 200x200 pixel image with the same name as a MIDI or WAV file will display that image when that song is playing. If a song without a dedicated image plays, a default image will display during that song.

The user interface is clean and simple, streamlining the listening experience. There are 4 buttons, which are clearly labeled on the LCD screen. For additional simplicity, only illuminated buttons are functional in certain states.

Demo video: https://youtu.be/UhCBo8olzPY

Hackster.io Page: https://www.hackster.io/brendan8/beaglebone-black-midi-wav-player-f443a9

Theory of Operation
MIDI/WAV playback - For playing the audio, both fluidsynth and aplay will block the rest of the program from running. This is an issue because that means the buttons would not work while a song way playing. To fix this, the program will make the audio player a background process, which allows the program to continue. To end the sound after the user requests to stop, the program will issue a kill command like. The buttons are read every 100ms and are polled and we are using gpiod to use the buttons. Because they are polled, it is possible to press one and have it miss reading a press. Also, some of the MIDI files are more resource intensive than others. This makes the button reading slower as the MIDI player uses up more CPU time than the python program. The WAV player does not have this problem. The screen is rendered using pygame. Pictures are searched for in the images/ directory. If there is no picture matching the name of the playing song, a default 'No Image' file is used.



While stopped, these are the user options:

Green: Play currently displayed song (enters playing state)

Red: N/A

Orange: Skip to next song

White: Open setting menu

While playing, these are the user options:

Green: N/A

Red: Stops playback (enters stopped state)

Orange: Skip to next song

White: N/A

While in settings, these are the user options:

Green: Switches to next soundfont

Red: Toggles shuffle mode (illuminated while on, dark while off)

Orange: Toggles MIDI/WAV mode (illuminated while in MIDI mode, dark while in WAV mode)

White: Return to stopped state

Work Breakdown
For the vast majority of this project's tasks, Brendan and Gaven worked together. There were two elements of the project that were more individual: Brendan handled the pushbutton logic, and Gaven handled the LCD display design and integration. Everything else was done together.

Full breakdown:

BeagleBone playing .wav files - Brendan and Gaven

BeagleBone playing .mid files given a soundfont - Brendan and Gaven

Can stop song playing (kills fluidsynth process) - Brendan

Breadboarding user hardware - Brendan

Software for user buttons - Brendan

Start software for LCD display - Gaven

Integrate LCD display software into main code - Gaven

Put together box for user hardware - Brendan and Gaven

Finalize documentation (hackster.io, wiki page, etc) - Brendan and Gaven

Future Work/Conclusions
If we were to have more time on this project, we may have designed it such that the BeagleBone itself could have also fit in the enclosure. We may have been able to use a PocketBeagle to meet this goal. Otherwise, we are very satisfied with our final design from a code and user standpoint.

Timeline
Fri 27-Jan-2023: BeagleBone playing .wav files

Mon 30-Jan-2023: BeagleBone playing .mid files given a soundfont

Sun 5-Feb-2023: Can stop song playing (kills fluidsynth process)

Mon 6-Feb-2023: Breadboarding user hardware

Tues 7-Feb-2023: Software for user buttons

Fri 10-Feb-2023: Start software for LCD display

Mon 13-Feb-2023: Finalize software for LCD display

Fri 17-Feb-2023: Put together box for user hardware

Sun 19-Feb-2023: Finalize documentation (hackster.io, wiki page, etc)

Wed 22-Feb-2023: Final project DUE