Using Beepbox for GBA Music Composition#

Original post I made in GBA JAM 2021's itch.io community here.

I've been able to use Beepbox to compose music tracks, export them to MIDI files, and then import those MIDI files to OpenMPT, finally converting them to Impulse Tracker files for use with my GBA game I'm working on using Butano.

What's Beepbox?#

Beepbox is a web-based application for composing chiptune music tracks made by John Nesky.

To quote the application itself:

BeepBox is an online tool for sketching and sharing instrumental melodies.

It has instructions that provide a quick explanation of its features and how to use it on its webpage.

Why Use Beepbox?#

Beepbox is a handy way to make the basis of a track's composition faster if you don't have much experience using the pattern editor in mod tracking software like OpenMPT.

Composition in Beepbox#

To avoid re-inventing the wheel I shall link to this video tutorial here by ShifterChaos95 on YouTube. I think it's a well-made quick overview of using Beepbox and it also covers some relevant audio principles involved when one decides to MAKE A MUSIC.

Exporting/Importing a MIDI to/from Beepbox/OpenMPT#

In Beepbox's menu there are four options for export:

  • WAV: Use this for a typical audio file of your song that uses MiBs of disk space carefree.
  • MP3: Use this for a typical audio file of your song that bothers using compression so it takes less space.
  • MIDI: Exports song's note information to a MIDI format file. This is the one we're after.
  • JSON: A way of saving a Beepbox song to a file to import back into Beepbox to edit again (an alternative to saving the URL).

Now the saved MIDI will have the song's notes (when they play, how long, what pitch, etc.) but doesn't include sound data or Beepbox's exact instruments. When you import this file into OpenMPT, chances are it'll sound very different since OpenMPT will have to use whatever standard samples it has on hand to try to match what instrument was used in Beepbox but this doesn't always result in the song successfully retaining it's intended demeanor. However after converting the MIDI to IT format, you can replace the sound samples in OpenMPT to change how the music sounds.

Converting from MIDI to a Mod Tracker Format#

OpenMPT supports five different mod tracking file formats:

  • MOD: Format used by the Commodore Amiga.
  • S3M: Format introduced by ScreamTracker 3.
  • XM: Format introduced by FastTracker 2.
  • IT: Format introduced by Impulse Tracker. This is our target format (or at least the one I recommend/used).
  • MPTM: Format introduced by OpenMPT.

Impulse Tracker Being the Target Format#

In short, IT is the format I went with because it is the most advanced of the formats that Maxmod (middleware for playing mod tracker music on the GBA and DS, which is used by Butano for handling audio) supports. MPTM is more advanced but this is not supported by Maxmod and is not needed anyway since IT is adequate for the purpose of using music made in Beepbox in mod tracking format. The OpenMPT Wiki has more in-depth information about the mod tracking formats if you're interested in reading about them.

Obtaining the Correct Music Speed on the GBA#

I've noticed when a MIDI track exported from Beepbox is imported to OpenMPT and them converted to IT, the Initial Tempo is set to 300 and the Ticks/Row is set to 6. In my experience, this results in the music not playing at the right speed once in a compiled GBA game (a Butano project to be precise). Changing the Initial Tempo to 250 and the Ticks/Row to 5 maintains the appropriate speed in OpenMPT and results in that speed actually being achieved once in a running GBA game.

Replacing Sound Samples#

In the left pane of OpenMPT you'll see instruments and samples. In the case an instrument is tied to one sample, just replace the sample with a sound sample of your choice to change how that instrument sounds in the mod tracker version of the song. Sometimes a single instrument (corresponding with an instrument row in Beepbox will have multiple samples, I modify the instrument to use one sample and replace that sample in that case.

OpenMPT has a bunch of included sound samples located at C:\Program Files\OpenMPT\ExampleSongs\Samples.

Once you've replaced the samples and the music sounds as you intend it to, just save the IT file and throw it into your project. I've only tested this with Butano but I imagine this would work with anything that uses Maxmod for music playback.

Adjusting Audio Mixing Quality in Butano#

Music is typically used with a reduced sample rate to reduce the amount of the GBA's CPU spent processing audio playback. However this may result in noticeable levels of white noise in the audio. For mixing audio for playback, Butano defaults to a sample rate of 16Khz. Other sample rates of 8Khz, 10Khz, 13Khz, 18Khz, 21Khz, 27Khz and 31Khz can be selected using #define BN_AUDIO_MIXING_RATE_16_KHZ replacing 16 with the desired sample rate for audio mixing. A higher mixing rate will increase audio playback quality at the cost of more CPU usage, a lower mixing rate will cost less CPU but result in lesser audio playback quality. However, keep in mind that the actual quality of a given audio sample will depend on the audio sample's own sampling rate, specifying a higher audio mixing rate than a given audio sample's rate will not improve that audio sample's quality; an audio sample's rate must be equal to or better than the audio mixing rate to play at the level of quality of the audio mixing rate.

Edit
Pub: May 20 2021 01:02 UTC
Edit: Jul 02 2021 04:05 UTC
Views: 340