Building a MIDI Backing Track Player for a Hobby Band

Introduction

I play drums in a hobby band. We originally started as a five-piece band, but due to various circumstances, our bassist and keyboard player were no longer able to play with us.

After a three-year break, we felt the desire to play music again and decided to get together with the remaining members. Playing together brought back old memories and made me feel alive again. I suppose that is part of the joy of making music.

After a few rehearsals, however, something felt missing. Although we had anticipated this when we decided to start again, the absence of the two instruments was more noticeable than we had expected.

This led me to the idea of building a MIDI backing track player. The idea was to use technology to fill the gap left by the two instruments.

The bass and keyboard parts would be prepared in advance as MIDI files and played back during rehearsals. I would continue playing the drums live, while the other band members would take care of the guitar and vocals.

There are already many commercial devices and software applications available for playing backing tracks. However, some are expensive, and others have certain limitations that made them less suitable for my needs.

Software-based solutions require a laptop. Since a laptop is not a dedicated real-time device, there is always a possibility of the system freezing, which makes me somewhat reluctant to rely on it during live performances. Having to operate a mouse and keyboard is also inconvenient. Standalone devices are available, of course, but their relatively high prices made them difficult to justify for a hobby band like ours.

So I decided to build one myself and began developing a MIDI backing track player.

I carried out the entire development process myself, from hardware design, PCB fabrication and assembly to firmware design, programming, and bringing the system into operation.

Project Concept

A traditional approach to backing tracks is to use prerecorded instrumental accompaniment, commonly referred to as MR (Music Recorded) in Korea. In this approach, the instrumental parts are recorded in advance without vocals, and the singer performs along with the recorded accompaniment.

I have often seen solo singers, duos, and small bands perform using this method. There are also commercial services around the world that provide prerecorded backing tracks for a wide range of songs.

However, one limitation of this approach is that the tempo (BPM) and musical key cannot be changed as freely. In addition, recording instrumental accompaniment and producing audio files in formats such as WAV is not a particularly simple task.

Nowadays, professional music production software such as a DAW (Digital Audio Workstation), as well as AI-based tools, can make the production of backing tracks relatively easy. However, I decided to take a different approach by using MIDI.

Rather than recording the actual sound, MIDI represents musical performance as data, including note pitch, timing, duration, and velocity.

This makes it possible to adjust the tempo and musical key with greater flexibility. It also makes it easier to isolate or modify individual instrument parts.

I concluded that these characteristics made MIDI a more suitable choice for the backing track player I wanted to build.

MIDI Sound Module Selection

MIDI stands for Musical Instrument Digital Interface. Rather than storing the actual sound of music, MIDI uses a digital data format to represent musical performance information.

Therefore, a MIDI file alone does not produce sound. A sound generator is required to convert MIDI data into actual instrument sounds.

While searching for a readily available MIDI sound module, I came across a compact module based on the SAM2695 chip manufactured by Dream, a French company.

The following photograph shows the MIDI sound module.

The SAM2695 supports the General MIDI (GM) standard and provides a total of 16 MIDI channels, including a dedicated percussion channel. This allows multiple instrument parts to be played simultaneously.

The module provides connection pins for power (+5V), GND, and RX, making it relatively easy to interface with a microcontroller (MCU). When the MCU transmits MIDI data, the module converts the data into instrument sounds and outputs them as audio signals.

As an initial test, I mounted an ESP32 microcontroller on a breadboard, connected it to the SAM2695 module, and wrote a simple program to play a MIDI file.

The test confirmed that the MIDI file could be played back successfully.

With this successful test, I had secured the sound generation component needed to build the MIDI backing track player.

The official website of Dream is provided below.

https://dream.fr/

MCU Selection

The MCU is responsible for reading MIDI files and transmitting MIDI data to the sound module.

It must be capable of processing MIDI files reliably and have sufficient memory to store the data of the selected song. It also needs enough GPIO pins to control various buttons and display devices. In addition, Wi-Fi connectivity is required for communication with other devices.

Based on these requirements, I considered both STM32 and ESP32 as potential candidates.

I happened to have an ESP32 development board on hand, so I mounted it on a breadboard and conducted some initial tests. The test results showed satisfactory performance.

The board I ultimately selected was the ESP32-S3-DevKitC-1.

The main reasons for choosing this board were its built-in Wi-Fi connectivity and pin headers, which allow it to be easily mounted on a custom-designed PCB.

The following photograph shows the selected development board.

 

Operating Concept

The overall operating concept of the system is as follows.

The board is equipped with an SD card socket. Users prepare MIDI files on a PC and store them on the SD card. They can store only the songs needed for a particular rehearsal or performance, or maintain a larger collection of songs as a MIDI library.

From this collection, users select the songs to be performed, create a song list in a file named setlist.txt, and save it on the same SD card.

When the SD card is inserted into the MIDI backing track player and the download button is pressed, the first song listed in setlist.txt is loaded into memory.

A foot pedal is connected to the board to control playback. Pressing the pedal starts the playback sequence.

The playback sequence begins with four beats of silence, followed by four beats of audible clicks. Once this count-in sequence is complete, the actual MIDI accompaniment begins. The band members can use these clicks to start playing in sync with the backing track.

The board also provides NEXT and PREV buttons. Pressing the NEXT button automatically loads the next song in the setlist, while pressing the PREV button returns to the previous song.

Several additional features are provided to facilitate band rehearsals.

The tempo (BPM) and musical key (KEY) can be adjusted to suit the band. Playback can also be configured to start from a specific bar (BAR).

These features allow band members to repeatedly practice specific sections of a song without having to start from the beginning each time.

Hardware Design and Fabrication

With the overall system concept established, it was time to move on to the actual hardware design.

Design Guidlines

Before proceeding with the detailed hardware design, I established several basic design guidelines.

One of these was to use through-hole (PTH: Plated Through Hole) components wherever possible and use SMD (Surface Mount Device) components only when necessary.

The main reason for this decision was to minimize manufacturing costs.

SMD components themselves are not necessarily expensive. In fact, they are often less expensive than through-hole components. However, outsourcing the assembly of SMD components onto a PCB involves additional assembly costs.

Of course, SMD components can also be soldered by hand, but the smaller the components become, the more difficult the soldering process becomes.

Since this project was intended to produce only a small number of units for use in a hobby band rather than for mass production, I considered manual assembly to be the more practical and economical approach.

Therefore, rather than minimizing component size or PCB area, I decided to prioritize ease of assembly and manufacturing costs.

In addition, the ESP32-S3 development board and the SAM2695 MIDI sound module were designed to be mounted on the PCB as complete modules rather than integrating the individual chips directly into the PCB design.

This approach simplifies the circuit design and makes it easier to replace a faulty module during testing or repair.

Key Component Selection

Based on these design guidelines, the following key components were selected.

Category Selected Component Main Function
MCU ESP32-S3-DevKitC-1 MIDI file processing and overall system control
MIDI Sound Generator SAM2695 Module Conversion of MIDI data into instrument sounds
Storage MicroSD Card Socket Storage of MIDI files and setlists
Display TM1640-based 7-Segment LED Display of SONG, BPM, KEY, and BAR
User Controls Push-Button Switches Song selection and function settings
Playback Control Foot Pedal Switch START/STOP control
Audio Output Audio Connectors Connection to amplifiers and PA systems

I decided to use the ESP32-S3 development board and the SAM2695 MIDI sound module selected earlier.

The MicroSD card socket was positioned in an easily accessible location to facilitate MIDI file updates and card replacement.

A 7-segment LED display was selected to show the song number, tempo, musical key, and current bar number.

The control buttons were organized according to their functions for ease of operation during performances, while the START/STOP function was assigned to a foot pedal.

With these key components selected, I proceeded with the overall circuit design and PCB layout.

PCB Design

I used Autodesk Fusion 360 for the PCB design.

I had previously used EAGLE, but with its discontinuation, I had little choice but to switch to Fusion 360.

EAGLE is a standalone application that is lightweight and fast, whereas Fusion 360 relies on cloud-based features and tends to be somewhat slower.

On the other hand, since Fusion 360 stores design files in the cloud, I can access and work on my designs from anywhere without having to carry the design files with me.

Another advantage of Fusion 360 is the integration of PCB design and 3D modeling, which is particularly useful when designing and fabricating an enclosure for the device.

The following image shows the PCB designed using Fusion 360.

After completing the PCB design, I proceeded with PCB fabrication.

The PCBs were ordered from JLCPCB.

The following photograph shows the bare PCBs manufactured and delivered by JLCPCB.

PCB Assembly and Completion

After receiving the PCBs manufactured by JLCPCB, I proceeded with component assembly.

Since this board was a prototype intended for functional verification, I soldered and assembled the components by hand wherever possible.

The ESP32-S3 development board, SAM2695 MIDI sound modules, various control buttons, display devices, and connectors were mounted on the PCB.

The following photograph shows the fully assembled PCB.

The board was designed to accommodate two MIDI sound modules.

One module is intended to generate the MIDI accompaniment for the actual performance, while the other is intended to provide a separate monitoring output containing both the click track and the accompaniment.

This configuration allows the backing track sent to the venue’s PA system to be separated from the monitoring audio heard by the performers.

At this stage, only one MIDI sound module has been installed for functional testing. The separate monitoring output will be implemented in a future development stage.

Firmware Development and Key Features

Development Environment

The MCU used in this project is an ESP32 from Espressif Systems.

The ESP32-S3-DevKitC-1 development board is equipped with an ESP32-S3-WROOM-1-N16R8 module, which features built-in Wi-Fi connectivity, 16 MB of Flash memory, and 8 MB of PSRAM.

Firmware development for ESP32 devices is typically carried out using ESP-IDF, the official development framework provided by Espressif.

For this project, however, I decided to use Zephyr, a real-time operating system (RTOS).

One of the main reasons for choosing Zephyr was its portability.

Zephyr supports MCUs from a wide range of manufacturers, allowing a substantial portion of the existing firmware to be reused even if a different MCU is selected in the future.

In addition, multiple tasks can be organized into independent threads, while timers and interrupts allow operations such as MIDI playback and button input to be handled in a structured manner.

Fortunately, Zephyr already supports the ESP32-S3-DevKitC-1 development board, making hardware configuration relatively straightforward.

Visual Studio Code was used for source code editing and build operations. The actual firmware build process was carried out using Zephyr development tools, including West.

Key Firmware Features

The firmware is responsible for reading MIDI files stored on the SD card, transmitting MIDI data to the sound module, and controlling various buttons and display devices.

In addition to basic MIDI file playback, several features have been implemented to make the device convenient to use during actual band rehearsals and live performances.

The key features are described below.

MIDI File Playback

The firmware reads Standard MIDI Files (SMFs) stored on the SD card, extracts the musical performance data, and transmits it to the SAM2695 sound module to generate audio output.

A MIDI file contains information such as the note pitch, timing, duration, and velocity of each instrument part.

The firmware processes this information to ensure that each note is played at the appropriate time.

One of the most important aspects of this process is playback timing.

The bass and keyboard parts must be played with precise timing so that they blend naturally with the drums and other instruments being played live.

To achieve this, I used Zephyr’s timer functionality to manage the timing of MIDI events during playback.

Song Selection and Loading

Multiple MIDI files can be stored on the SD card.

Two operating modes are provided for song selection: ONE mode and LIST mode.

ONE mode allows the user to select an individual song by its song number. After selecting the desired song number, pressing the Download-One button reads the corresponding MIDI file from the SD card and loads it into memory.

LIST mode uses a predefined setlist prepared for a live performance or band rehearsal. The user creates a setlist.txt file on a PC and saves it to the SD card. Pressing the Download-List button loads the first song in the setlist. The NEXT and PREV buttons can then be used to move to the next or previous song in the setlist.

Rather than loading all the songs into memory at once, the system loads only the selected song. This approach allows a large collection of MIDI files to be stored on the SD card without significantly increasing memory usage.

The following image shows the contents of the SD card, including MIDI files and the setlist.txt file.

The following shows the contents of the setlist.txt file.

The order in which the songs are to be played can be specified, and the musical key (KEY) and tempo (BPM) can be set individually for each song if necessary.

The first song was transposed down by one whole tone from its original key to F major, and its tempo was set to 124 BPM.

For the remaining two songs, no additional settings were specified, so the original musical key and tempo of each MIDI file are retained.

By defining the song order and performance settings in advance, the user can easily select the next or previous song during a live performance or band rehearsal using only the NEXT and PREV buttons.

Please note that some text in the screenshots appears in Korean because I am using the Korean-language version of Windows. Thank you for your understanding.

Playback Control Using a Foot Pedal

Since drummers use both hands while playing, operating buttons during a performance can be difficult. For this reason, the START/STOP function was assigned to a foot pedal.

Once a song has been selected and loaded, pressing the foot pedal starts the playback sequence. However, if the backing track begins immediately when the pedal is pressed, it can be difficult for the other band members to start playing at exactly the right moment.

To address this issue, I implemented a count-in sequence before the actual playback begins.

The first four beats are silent, followed by four beats of hi-hat clicks, with one click per beat.

Once this sequence is complete, the MIDI accompaniment begins.

The band members can listen to the clicks and synchronize the start of their performance with the backing track.

Pressing the foot pedal again during playback stops the backing track. Playback also stops automatically when the song reaches its end.

BPM Adjustment

During band rehearsals, the original tempo of a song may not always suit the band.

To address this, I implemented a feature that allows the playback tempo to be adjusted by changing the BPM (Beats Per Minute). Increasing the BPM makes the playback faster, while decreasing it makes the playback slower.

Since the system uses MIDI, the playback tempo can be adjusted without modifying the original MIDI file.

In LIST mode, the BPM can also be specified individually for each song in the setlist.txt file.

This allows the desired tempo of each song to be configured in advance before a live performance.

Musical Key Transposition

Depending on the vocalist’s vocal range, it may be necessary to change the musical key of a song.

For this purpose, I implemented a key transposition feature.

For example, if the original song is in G major and needs to be transposed down to F major to suit the vocalist’s range, the user can simply change the KEY setting.

The firmware adjusts the pitch of the MIDI notes during playback, so there is no need to modify the original MIDI file.

Of course, percussion channels, such as the drum channel, are excluded from transposition.

This feature is particularly useful when adapting songs to suit the vocalist’s vocal range.

Playback from a Specific Bar

During band rehearsals, it is often necessary to focus on a particular section of a song rather than playing the entire song from beginning to end.

For example, if a guitar solo begins at bar 30, it would be more convenient to start directly from bar 30 instead of playing the song from the beginning.

For this purpose, I implemented a BAR function that allows the user to specify the starting bar.

After the user sets the desired bar and presses the foot pedal, the count-in sequence begins, followed by playback from the specified bar.

This feature saves time when repeatedly practicing sections that require further improvement.

Display and Control Buttons

Numeric LED displays are used to show the currently selected song and playback status.

The following information is displayed:

  • SONG: Currently selected song number
  • BPM: Playback tempo
  • KEY: Current musical key
  • BAR: Current bar number during playback

Various control buttons allow the user to select and load songs, adjust the BPM, change the musical key, and specify the starting bar.

To prevent accidental changes during playback, settings such as BPM, KEY, and BAR cannot be modified while a song is playing.

The READY LED indicates whether the selected song has been successfully loaded and is ready for playback.

The LED turns green when the song is ready. It turns red when no song has been loaded or when the selected song does not match the song currently loaded into memory.

The following photograph shows the display and control buttons.

The numeric display at the top of the photograph indicates the song number (SONG). It can display song numbers up to 999, and song No. 1 is currently selected.

The display at the lower left indicates the musical key (KEY). Since displaying alphabetical characters on a 7-segment LED display is difficult, musical keys are represented numerically.

C major is represented by 1, C-sharp major by 2, and so on, up to B major by 12. In the photograph, the displayed value is 6, which represents F major.

The center display indicates the playback tempo (BPM), which is currently set to 124 BPM.

The display on the right provides bar information (BAR). Before playback begins, it displays the time signature. Once playback starts, it displays the current bar number, starting from bar 1.

In the photograph, the displayed value is 404, indicating that the currently selected song is in 4/4 time.

Band Rehearsal Testing

After implementing these features, I prepared the MIDI files and tested the system during actual band rehearsals.

The MIDI player provided the bass and keyboard parts, while the existing band members performed the drums, guitar, and vocals live.

Initially, I was concerned about whether the MIDI accompaniment would blend naturally with the live instruments.

However, by synchronizing the start of the performance and maintaining a consistent tempo, I confirmed that the system could be effectively used in actual band rehearsals.

In particular, the MIDI accompaniment helped fill much of the gap left by the absence of the bass and keyboard players.

The following photograph shows the board used during the actual rehearsals.

With this, I successfully implemented the basic features of the MIDI backing track player as originally envisioned and verified its operation in actual band rehearsals.

Expansion to a Lyrics Monitoring System

After completing the MIDI backing track player and using it during actual band rehearsals, another idea came to mind: would it be possible to automatically display the lyrics of the song being played?

System Concept

The first thing I considered was how to synchronize the lyrics with the music.

Conventional lyrics display applications typically require someone to advance the screen manually or display lyrics according to predefined timing.

However, the MIDI player I developed already knows which song is being played and the current bar number (BAR).

This led me to the idea of transmitting this information to an external device and displaying the lyrics corresponding to the current bar.

For example, if the first line of lyrics begins at bar 7 and the second line begins at bar 11, the MIDI player simply transmits the current bar number, and the lyrics monitor displays the corresponding line.

With this approach, there is no need to run a separate timer or calculate the elapsed playback time for displaying lyrics.

I also designed the system so that whenever a different song is selected on the MIDI player, the lyrics monitor automatically loads the lyrics for that song.

ODROID-N2 Selection

I selected the ODROID-N2 as the device for displaying lyrics.

The ODROID-N2 is a compact single-board computer capable of running the Linux operating system.

It features an HDMI output, allowing it to be connected to a standard monitor or projector, and also supports network communication.

Since I already had an ODROID-N2, I was able to use it without purchasing an additional computer.

The following photograph shows the ODROID-N2 installation.

I decided to develop the lyrics monitoring application in Python.

The role of the application is relatively simple. It receives the song number transmitted by the MIDI player, loads the corresponding lyrics file, and displays the lyrics according to the current bar number.

The monitor displays one line of lyrics at a time in large white text against a black background.

The application is also designed to run in full-screen mode upon startup, allowing it to function as a dedicated lyrics monitor without requiring any additional user interaction.

MQTT-Based Communication

I used MQTT for communication between the ESP32-S3 and the ODROID-N2.

MQTT is a communication protocol that allows devices connected to a network to exchange messages. In this architecture, a Broker distributes messages, while Clients publish or receive messages.

For this system, I installed Mosquitto, an MQTT Broker, on the ODROID-N2.

The ESP32-S3 connects to the network via Wi-Fi and transmits the currently selected song number and the current bar number during playback as MQTT messages.

The lyrics monitoring application running on the ODROID-N2 receives these messages and displays the corresponding lyrics.

In this configuration, the ODROID-N2 serves as both the MQTT Broker and the lyrics display Client.

One of the reasons I chose MQTT was its ability to easily connect multiple devices.

The MIDI player does not need to know how many lyrics monitors are connected. It simply publishes the song number and bar number once, and all devices subscribed to the corresponding MQTT topics can receive and use this information.

Therefore, additional lyrics monitors can be added in the future without modifying the basic communication architecture of the MIDI player.

For live performances, a dedicated wireless router can be used to establish a local network without relying on an external Internet connection.

The ESP32-S3 connects to the router via Wi-Fi, while the ODROID-N2 connects via wired Ethernet.

Lyrics File Structure

The lyrics for each song are stored in a separate file on the ODROID-N2.

I chose JSON as the file format. JSON is a text-based format that allows data to be stored in a structured manner.

Each file contains the song number, song title, bar numbers at which the lyrics should be displayed, and the actual lyrics.

For example, the lyrics for song No. 1 are stored in 001.json, while those for song No. 2 are stored in 002.json.

When song No. 1 is selected on the MIDI player, the ODROID-N2 loads the 001.json file.

Once playback begins, the corresponding lyrics are displayed on the screen according to the BAR information transmitted by the MIDI player.

The advantage of this approach is that MIDI files and lyrics files can be managed independently.

Even if the lyrics or their display timing need to be changed, there is no need to modify the MIDI file.

Furthermore, since lyrics files can be edited using a standard text editor, adding new songs or modifying existing lyrics is straightforward.

The following example shows the contents of a JSON file containing song lyrics.

System Operation Testing

After installing the MQTT Broker and the lyrics monitoring application on the ODROID-N2, I connected it to the MIDI player and tested the system.

I confirmed that selecting a song on the MIDI player automatically loaded the corresponding lyrics file and that the lyrics were updated according to the current bar number once playback began.

When changing songs using the NEXT/PREV buttons, the lyrics monitor also correctly displayed the lyrics of the newly selected song.

Korean lyrics were displayed correctly, and the system was also designed to transmit changes in KEY and BPM from the MIDI player to the lyrics monitor.

The ODROID-N2 was configured to automatically launch the lyrics monitoring application after power-up and login.

The screensaver was also disabled to prevent the screen from turning off during live performances.

With this, I successfully implemented a system that automatically synchronizes the lyrics display with the playback progress of the MIDI player.

The following image shows the actual screen of the lyrics monitoring system.

Furthermore, since the system uses MQTT for communication, additional ODROID-N2 units can be connected to display the same lyrics on multiple monitors.

This makes it possible to display lyrics not only on monitors for the musicians but also on a projector for the audience, encouraging audience participation through sing-alongs.

In this way, the lyrics display can be fully automated simply by transmitting playback information from the MIDI player.

The key advantages of this system are that no dedicated operator is required to control the lyrics display and that additional monitors can be incorporated without modifying the existing MIDI player configuration.

Conclusion

This project began with a simple idea: to fill the gap left by the absence of the bass and keyboard players in our hobby band.

Although I encountered various challenges while designing the hardware and developing the firmware, I was able to implement the features I had envisioned, one by one.

Above all, I found it particularly rewarding to achieve satisfactory results during actual band rehearsals.

With the addition of the lyrics monitoring system, the potential applications of the system have expanded beyond what I originally imagined.

The system is still at the prototype stage, intended primarily for functional verification. Going forward, I plan to identify and address areas for improvement through actual rehearsals and live performances, while making the hardware more compact and developing it into a more refined piece of equipment.

I believe the greatest achievement of this project is that an idea born out of a small practical need has been transformed into a piece of equipment that can actually be used.

댓글 남기기