Atari Riff Machine


The atari-riff-machine is a semi-serious, semi-fun tool to let Atari 2600 programmers generate simple looping music.

(Here is a brief introductory video if you prefer a more guided way of taking in information.)

Specifically, while the loops you can lay out here are played back in the browser as samples, they follow the restrictions of the real hardware (2 channels each playing one kind of tone at once.) The loops set up can then be used to generate ready-to-run batari Basic code.

You can also play around with atari-sound-forger - it maps the Atari sounds to the keyboard and can record and play back in the browser or as batari Basic code.

About Sounds on the Atari 2600

Music on the Atari is famously a little weird - two tones at once, each one set to one of 10 or so different "distortions". The frequencies used to make different pitches are based on very simple division, so if you're trying to make notes instead of sound effects, you will have trouble matching pitches of other instruments exactly.

The Atari updates the screen at 60 frames a second (50 in Europe - some North American bias has snuck in I'm afraid) and every frame you can adjust the volume (loudness), frequency (pitch), and distortion (kind of sound). You can get more complicated sounds by thinking in terms of "envelopes" - i.e. a note is struck, is possibly sustained, and then quickly gets quieter. There are more advanced techniques (like quickly alternating between two different voices) that are possible in the atari-riff-machine but are not particularly well supported for now.

I go into more details in do re bB and Random Terrain's Atari 2600 Music and Sound Page has some deeper dives by Glenn Saunders and Eckhard Stolberg. (Random Terrain also generously permitted use of the Atari 2600 sounds he recorded and of the Basic music engine he collaborated on.) Also, Paul Slocum's Atari 2600 Music And Sound Programming Guide is worth checking out.

Using This Program

Each Channel has its own little grid/canvas. You can select the set of sounds (group by distortions) in the select box atop each. (If you change sound sets, you will still see sound rows you put down notes for from the previous voice, but the row positions might be switched around3.) Each row shows the distortion (in bold) and the frequency. For some notes to the left of those values will be a music note that distortion/frquency is most near.

A blue highlight shows you where the note will start if you click, the red highlight lines up the distortion/frequency.

Under each grid are settings for:

Above both grids is a simple Playback button to hear your creation. The grids aren't very smart about picking up changes in real time.

Under both grids is the option to dump the data as batari Basic code. The code isn't terribly efficent (contributions welcome- actually warning, I feel like there might be something incorrect and two passages will eventually get out of synch?) Each change in volume, distortion, frequency for each voice adds a new 4-tuple of data, (the 4th value being the duration to be loaded into a countdown timer until the next change.) If you only have notes at a fixed volume or with a specific distortion, you could make your own more efficient system.

(I recommend the "Atari Dev Studio" plugin for Visual Studio Code, if you are on a Mac or just appreciate simple one-stop-shopping, clean editors - it embeds the compiler and emulator and allows for one-click running of your batari program.)

Incidentally currently there is no real way of reloading previous work (if enough people ask for it I will add it) but if you reload or come back to the page in the same browser you work will still be there.

This program was made in React. In retrospect, that may have been a mistake - React doesn't play super-well with the timers and intervals I used to recreate the timing, and I think I should have had a single app controlling both grids' worth of data. That's some of why I stalled out and didn't incorporate some of the ideas for more keyboard recording/quantization in it.

Other improvements might include making a UI for doing "chords", one channel quickly alternating between frequencies. Also a UI for saving and loading. As usual, I thrive on feedback and attention, so if you make your pitch and it doesn't seem like too much work I might be inclined... or if you know how to code, help out yourself! You can fork