Playing Atari music on Amiga for free

nopakos1 pts0 comments

Playing ATARI music on Amiga for free!

Audience

This post is for anyone who loves the technical and historical aspects of chiptune music, as well as enthusiasts of the Amiga PAULA and Atari YM2149 audio chips.

The Context

In my Cycle-Op demo, I showcased a classic sin-dots effect that rendered 6405 dots at 50 FPS on the Amiga 500. Two years later, Amiga legend Hannibal released the long-awaited 3D Demo 3, packed with a lot of impressive effects. Among them was his own sin-dots record, beating mine with 6682 dots.

To top it all off, and in the classic demo scene tradition of playful roasting, Hannibal left me this message:

“Hi Leonard, you optimized your dots well for an Atari programmer. But there were hundreds of dots left if you optimize like an Amiga expert.”

That was too good to ignore. I had to respond by finding a way to beat his new sin-dots record and, as a bonus, come up with a clever twist to answer this “Atari programmer” jab :)

The Goal

As a nod to Hannibal’s remark, I immediately had the idea of playing Atari music on the Amiga during my future dot record attempt. To do that, I needed to emulate the YM2149 sound chip. I had already written an Atari music emulator for the Amiga back in time in my AmigAtari demo.

However, accurately reproducing modern Atari music effects, such as SID voices, Sync Buzzer, and Digidrums, requires emulating not only the YM2149 but also the Atari’s hardware timers. This kind of emulation is extremely CPU intensive, consuming around 50% of the frame time in my 2020 AmigAtari demo. That makes it impossible to break a sin-dots record at the same time.

So I needed a much simpler solution: a way to play Atari music on the Amiga without using any CPU at all.

My first rough idea was straightforward: Why not use the Amiga PAULA chip itself to emulate the YM2149, leaving the poor Motorola 68000 entirely dedicated to drawing sin dots?

YM2149 and PAULA

On paper, these two chips are very different.

The YM2149 is a slightly modified version of the AY-3-8910, rebranded by Yamaha. It is a relatively simple sound chip. It has three voices capable only of generating square waves. A pseudo-random noise generator and a basic hardware volume envelope, intended as a cheap ADSR envelope substitute

PAULA , the Amiga’s audio chip, takes a completely different approach.<br>It is a PCM sample playback chip with no built-in support for square waves, noise generation, or envelopes. PAULA can play four independent signed 8bit PCM samples directly from main memory, each with its own playback rate and volume.

For a chip introduced in 1985, this design was remarkably advanced.

First Idea and Prototype

Most Atari music relies heavily on square waves, which made the initial concept seem simple. I stored a single cycle of a square wave in memory as 8bit samples and played it in a loop using one PAULA voice.

To avoid porting a full Atari music driver to the Amiga, I used a technique similar to the one I developed for my ultra fast Amiga MOD player, LSP : pre-compute all PAULA state per frame in a dedicated data stream.

The plan was:

Write a PC tool that reads an Atari .sndh music file and simulates it frame by frame

Extract the period and volume values of the three YM voices at 50 Hz

Convert these values into PAULA-compatible period and volume values

Store the result in a dedicated data file

On the Amiga side, playback became extremely lightweight: each frame, the program simply reads a few values and updates the period and volume of three PAULA channels, each looping a tiny square wave sample.

First boring result

What kind of Atari music can you play using nothing but square waves? Let’s try Buggy Boy, a very old ATARI game.

Not very exciting, is it? No offense to the original Atari port, but pure square waves sound rather bland and certainly not epic enough to accompany a future Amiga sin-dots world record.

I needed something better.

YM Envelope Trickery

By the late 1980s, several talented demoscene musicians had discovered ways to coax much richer sounds from the YM2149. One of the most influential was Jochen Hippel, better known as MadMax of TEX.

The YM envelope hardware, originally designed as a simple ADSR substitute, was rarely used as intended. The main reason is that the chip provides only a single envelope generator shared across all three voices. This means all channels would have to use exactly the same envelope shape.

But inventive musicians discovered a great work around. Rather than using the envelope to modulate the volume of a square wave, they used the envelope itself as the sound source. This produced the sweeping, buzzing timbres heard in many classic Atari soundtracks, such as the legendary Thalion Software intros:

How the hell my poor YM could output such a bad ass sound?

For anyone who grew up listening to simple tunes like Buggy Boy, hearing this for the first time was a revelation. There is no official name for this distinctive sweeping...

atari amiga music dots paula square

Related Articles