Re: [cc65] abc music specification

From: Karri Kaksonen <>
Date: 2004-12-23 05:24:48
On Thu, 23 Dec 2004, Groepaz wrote:
> so how memory intense are those tunes commonly?

I downloaded an archive with 14873 tunes and it used 5.8M.
So the average is less than 400 bytes/tune. As an example I
picked tune number 9 from this archive:

X: 9
T:Clare polka #2
S:Han Speek, Ir-Trad, 9/97
S:Conor Keane
C:Trad. arr. Conor Keane
|: A2 GE | cd e>d | cA BG | AG E/2F/2G |
A2 GE | cd e>d | cA BG | A2-A z :|
|: ea e>d | ea e>d | cd ef | gf/2g/2 ag |
ea e>d | ea e>d | cA BG | A2-A z :|

What you would feed to the music module in you code could be:

 "|: A2 GE | cd e>d | cA BG | AG E/2F/2G |
  A2 GE | cd e>d | cA BG | A2-A z :|
  |: ea e>d | ea e>d | cd ef | gf/2g/2 ag |
  ea e>d | ea e>d | cA BG | A2-A z :|");

The characters | and ' ' are there for readability only.
The character '-' ties notes together. E/2 and E/ is the same thing.
So you can save space and type it like:


The whole tune almost fits on a line.

> and as for speed, "modern" c64 player typically run at about $18 rasterlines per frame,
> which means 63*$18=1512 cycles per player call. can you give a simelar figure for yours?

I only call the code once/frame during the vertical blank interrupt.
But I have not calculated how many cycles it will use.
Basically it decrements a counter and if it is zero it fetches the next
note from the tune, makes a table lookup to see what the new sound
oscillator setting is and transfers it to a timer. But this will of course
be a hardware dependent thing that is different on every platform.

> oh, and we shouldnt forget about sound effects. ie the driver should provide funtions
> to play predefined sounds independently from each other, and with- or without the
> music playing at the same time.

That is simple in case you have separate sound channels available. But if
you need to interrupt your music, play an effect, continue with music,
then it gets more complicated.

The Lynx has 4 channels with identical properties. You can use any channel
for samples or generate patterns of 0's and 1's from a polynomial counter.
The pattern can be fed to a clipping integrator for producing complex



To unsubscribe from the list send mail to with
the string "unsubscribe cc65" in the body(!) of the mail.
Received on Thu Dec 23 05:24:56 2004

This archive was generated by hypermail 2.1.8 : 2004-12-23 05:25:06 CET