Romford: the ROM beeper tracker

Introduction

Romford is a music engine and tracker designed for use on the 16K Spectrum. All sound is played through the ROM's BEEP routine (thus avoiding the issue of timing the routine correctly in contended memory); it runs for a roughly-controllable fraction of the frame time, making it suitable for background music; and it compiles to a reasonably compact format.

For best results, run in Firefox. (It should run in other recent browsers too, but then it requires Flash for audio, which isn't as responsive.)

Concepts

Multi-channel sound is faked by rapidly cycling between notes every 1/50 of a second. There's effectively no limit to the number of channels, although the more you have, the worse it will sound. (Also, having a number of channels which divides exactly into the tempo tends to work best - otherwise you'll get an 'uneven' kind of sound where some notes get more repeats than others on any given row.)

Romford follows the SQ-Tracker model where each pattern is a single channel; each position indicates which patterns are played together at that point in the song, along with a tempo and pattern length. This means that you can write a single bass pattern and re-use it over several sections of the song, for example. There's also nothing to stop you playing several copies of the same pattern at once.

Note that position and pattern numbers both start from zero.

Volume control is another fake (because the ROM BEEP routine doesn't support it): "quieter" notes are simply played in shorter bursts. At full volume (denoted by 99 in the tracker), a note will play for half the frame time (i.e. 1/100 of a second) - or rather, as close to that as possible; at half volume, it will play for a quarter of the frame time (i.e 1/200 second). However, bear in mind that at these sorts of durations, accuracy is very limited - especially with lower notes, where playing for 1/100 of a second means we're only actually playing one or two cycles of the note. For any volume level, there's a limit to how low bass notes can go before they won't play at all (it's logically impossible to play a 100Hz note for 1/200 second, for example).

The 'Master volume' control scales all volume levels in the song by a constant amount, from 1 to 99. (Useful if you need to free up some Z80 time for other things...

Controls

Loading / saving

This is a bit odd (due to browser security limitations), but it does the job :-) To save a song, hit the 'load/save' link, then copy and paste the contents of the text box into your favourite text editor, where you can save it properly (or email it to yourself, or whatever you want really). To load a song back, hit the 'load / save' link, paste your previously saved text blob into there, and hit the 'load' button.

'Export' allows you to save the song in binary format (probably with a gibberish filename by default, but that's easy enough to change - I use the file extension .rmfd as standard) for playing on the Spectrum. Machine code programmers can refer to the player source code (rmfd_player.asm) - call rmfd_init with the start address of the .rmfd song data in HL, then call rmfd_play once every frame. For everyone else - if you just want a standalone program to play the music, then you can re-use the routine in summer_of_69.tap - use your emulator's 'load binary data' option to load the .rmfd file at address 26237.

Example songs

Summer Of 69 (Bryan Adams)

Somebody To Love Remix (Justin Bieber)

Matt Westcott - 2011-09-17