Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
Tags

Using Beepbox for GBA Music Composition

A topic by Deft Spade created May 19, 2021 Views: 1,752 Replies: 11
Viewing posts 1 to 6
Submitted (7 edits) (+1)

Hi everyone,

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.

Jam HostSubmitted

Nice, thanks for the guide!

Submitted

No problem! 👍

Submitted

Thanks for this guide! Anyone know why I'm getting loud white noise whenever a note plays? I only get noise in mgba, not in beepbox nor openmpt. See this video:

https://github.com/blaise-rascal/KnightOwls/blob/main/screenshots/noise.mp4

To transfer my song to my game, I'm doing the following:
1. IN BEEPBOX: Export as .mid
2. IN OPENMPT: Open the .mid file
3. IN OPENMPT: Go to View -> Song Properties and change Type to Impulse Tracker IT. Click OK.
4. IN OPENMPT: Click File -> Compatibility Export -> save it in a place where my butano game can see it.

You're welcome to see my source code as well, by checking out the github repo above. And here's the beepbox file. (Itch.io won't let me embed the beepbox link, so just click this file and copy the string into your browser.)
https://github.com/blaise-rascal/KnightOwls/blob/main/editables/beepbox-link.txt

I've tried a bunch of things, but nothing seems to be working. Any help would be greatly appreciated!

Submitted (1 edit)

After discussion with GValiente in the Discord about how Butano works with audio sampling rates and updating my guide, turns out the likely scenario here (according to my understanding) is that increasing the Butano mixing rate and making sure the audio samples likewise have a sufficiently high sampling rate would likely reduce/remove the noise.

Submitted
Deleted 2 years ago
Submitted

Thank you so much for the reply, Deft Spade!

I've managed to mostly solve my issue by choosing louder samples and cranking up their volume, to drown out the noise. (If you make your song in beepbox, the instruments that work well for this include, at the very least: contrabass, voice synth, french horn, cello, and standard drumset; just export as .mid and convert to xm by openmpt and it should work fine.) And I'm also learning to embrace the noise. It is perhaps part of the "charm" of developing for these old systems... Oh, and maybe I'll try increasing the mixing rate. Thanks so much for the help, Spade, and everyone else! Making music this way is pretty fun :)

Submitted

Glad to hear you’ve managed to sufficiently mitigate the issue. 👍 I’ve also been enjoying the process of making music via Beepbox and mod tracking, it works pretty well IMO.

Hi, I opened my midi file into openMPT but I can't hear anything, has anyone else had this problem before?

Submitted(+1)

Have you imported sound samples (e.g. OpenMPT’s included sound samples at C:\Program Files\OpenMPT\ExampleSongs\Samples) into the song? If you haven’t imported sound samples into the song, it might be worth doing so and seeing if those work instead since OpenMPT by default uses GM.DLS; DirectX’s default soundfont included with Windows for playing back MIDI files. This MIDI sound library might be having issues on your install of Windows (or WINE on Linux). I haven’t had this issue myself though so all this is just my speculation.

thanks :)

im using crossover on Mac so im probably just going to have no music in my game as any other program I try to use on crossover either works perfectly or not at all.


I can still make sound effects in audacity though :D

Host

Thanks for the guide! Maybe we can post this on https://gbadev.net?

Submitted

Sure, there’s a version of the guide on https://rentry.org/ at https://rentry.org/beepbox-gba-music. That’ll be the best version to link to from https://gbadev.net or anywhere else.