Sunday, May 24, 2009

Since the 23rd was the starting day of the GSoC, I will give this blog some live and will try to update it atleast once a week.

This time I will outline my task a bit, I will start explaining a bit about TFMX.

Soundgeneration on computers can be summed up roughly in 2 categories:

  • Noteplayers: You give them a frequency and they produce the right tone until a specified time runs out or you tell them to. Most early Computers and Consoles (C64, Nes, etc ) were limited to this kind of music. The familiar PC-Beeper is another example.
  • Sampleplayers: Instead of simple tones, you can playback any kind of sample.

Since you can easily "abuse" a Sampleplayer by feeding it sampled tones, any Sampleplayer is also a Noteplayer - it just potentially needs alot more Ram as you might need multiple samples for different tones, instead of simply specifying a frequency. An example for a Sampleplayer is Wav/Mp3 Playback (doesnt matters if the sample is compressed or not).

TFMX is one of these so-called Trackers (not a 3rd category as it also uses samples in the end), it consist of a Timetable in which certain actions can occur, be it notes / samples to play, or effects enabled. Perhaps best way to understand whats happening is to simply look at some of those trackers working ;) (you see the patterns flowing for 4 channels flowing through): There are a few on youtube 

To summarize the Format, heres an attempt at an overview:
On top of everything is the trackstep, its a series of commands that are processed in order, like stopping playback, repeat a pattern n times, play this pattern.
Next are the patterns, those could be compared to note-sheets for musicians, but are more than that. A pattern is most of the time in control of a single channel, and this means that a couple of them are running in parallel (Amiga has 4 Hardwarechannels). To make matters complicated, patterns not only contain simple notes, but can trigger more complex effects and even execute some simple command like branches,loops and subroutines (to other patterns). Those branches and subroutines make it hard to predict which patterns belong to a song and how often each pattern is played (and this is why players often cant reliable seek or even predict the length in such formats)
Lastly macros are some of the effects patterns can start/stop. Most importantly though they are responsible for playing back samples.

So what I`m doing now for is using the existing format-documents, some pieces of source-code and a bit of trial-and-error to get a rudimentary TFMX-Player going.
Its rudimentary in the sense as its not required to sound anything like the real thing (or produce usefull output at all =) ), its purpose is simply to run through the right patterns in the right order. I expect to be occupied with that for the coming week.