The AKY player

The AKY player is some kind of YM-like format, but more clever :). Basically, the YM format (invented by Leonard/Oxygen) is a stream of the values sent to the PSG, frame by frame. Obviously, it takes quite a lot of space (about 45 kb per minute of music). The biggest advantage of such format is that, once decoded, playing a frame is trivial and fast.

A LZH compression is then added to reduce the size to a few kilobytes. Sadly, decoding it in real-time takes too much resources for most 8-bit computers.

Various format exists to try to find a good compromise between memory and speed (AYC by Madram on CPC, MYM on MSX), with the raw YM stream as an input. Well, AKY is most of the times, much better than them :).

Basically, AKY relies on the structure of the song to determine when tracks and notes start and end, and try to code sub-sequences into bigger sequences, optimizing what is needed to be encoded.

Pros:

  • Short and very fast player.
  • Contrary to the aforementioned YM alternatives, AKY does NOT relies on any buffer! Only the song and the player have to be accounted for.

Cons:

  • Bigger song than with “generic” player (i.e. players that don’t rely on a stream).

 

AkyPlayer / AkyPlayerAccurate

You will find that there are two AKY players. One one them is dubbed “accurate”. Why and which one to choose?

A small technical explanation: in the AKY format, the AY register blocks are stored in an optimized way, most of the time only differences are encoded. The problem is that, in some cases, some shared values between channels (such as noise/hardware envelope/period) can be considered “the same” whereas they are not (one channel modifies the value, but the second channels considered it “equal, not changed”). As a result, the player might use the first value and not the second, which it should. Most of the times, only a few frames are different so you will probably not hear the difference.

So to sum up, the problems will arise only if you change the noise in two or three channels at the same time, in close vicinity (or you use 2 or 3 hardware sounds at the same time). This doesn’t happen often, this is even not advised. However, the musician is free to do what he wants!

In that regard, you can use the AkyPlayer safely. If you really feel the difference, then use the AkyPlayerAccurate, which takes care of the problem. However, managing it is a bit slower (2 scanlines I guess), and this player does not exist in a stabilized version. It’s up to you to choose!

 

How to make an optimized AKY

If you are working on a demo and you know you need a fast player, please read (or have your musician read) the following to have an efficiently built AKY song.

  • Tracks that sound the same are optimized away. I emphasize on “sound”. Tracks may be the same in your song, but may sound differently (for example, an effect can affect the second iteration of the track (a change of volume, an arpeggio, etc.)). Make sure your tracks are as “unique” as they pretend to be: reset all the effects at the beginning of each track.
  • Avoid long and not repeated sequences, such as long slide. Each frame being different, they have to been fully encoded and the odds they can be reused is thin.┬áVibratos are fine.