AY tracker routine

edited April 2009 in Development
Hi.
Yesterday i played with some ay tracks and was surprised how big are tracker routines and music data (over 1.5KB for Pro Tracker routine and 4-6 KB for data).

So my questions are:

1) Is here a way to create more compact music ?

2) I know that intros and minigames uses its own custom players and data format. What you think is minimum of player features to create reasonable music ?

3) Is here an utility dedicated to create compact music ? Something which could be called "Minimal Tracker" or so ?

4) Do someone know how hungry are common tracker routines in sense of memory footprint and T-states taken ? Somehow i can't believe that all that demo coders were satisfied with routine which takes more than 15000 T every interrupt (i estimate that Pro Tracker takes about 20000 T).
Post edited by Fikee on

Comments

  • edited March 2009
    I'd think that the bare minimum that you'd want for in game music is note pitch and length control. Just chuck a note out at the right pitch every nth interrupt until it's time to change note and that'll give you a tune of sorts.

    Adding functionality for a second (or third) channel, rests and hardware envelopes comes fairly cheap if you want to use them. Some sort of loop control will probably help you store your songs more efficiently too.

    I'd reckon that it ought to be possible to do the above in a few hundred bytes and less than a thousand t-states per interrupt.

    On the other hand, if you need things like pitch bends, software envelopes, arpeggios and percussion you're probably best off sticking with a tracker for the moment.
  • edited March 2009
    Fikee wrote: »
    3) Is here an utility dedicated to create compact music ? Something which could be called "Minimal Tracker" or so ?
    Gasman wrote a kinda micro-tracker for a 1k intro I think - have a looksee on his blog or do a search on raww.org perhaps. I think it may have been 6-channel.
    Fikee wrote: »
    4) Do someone know how hungry are common tracker routines in sense of memory footprint and T-states taken ? Somehow i can't believe that all that demo coders were satisfied with routine which takes more than 15000 T every interrupt (i estimate that Pro Tracker takes about 20000 T).

    I'd be surprised if ProTracker used that much time to play music. Head over to Sergey Bulba's webpage (bulba.untergrund.net) and you can grab his PT3 player... it lists the min/avg/max time to play each "frame" of a few tracks. I have a version which if marginally smaller than Sergeys (I removed some unnecessary stuff), but it comes in at 2125b.


    ...Actually, I have Sergey's player with me - here's the time for various tracks.
    ;Module name/author	Min tacts	Max tacts	Average
    ;Spleen/Nik-O		1720		9256		5500
    ;Chuta/Miguel		1720		9496		5500
    ;Zhara/Macros		4536		8744		5500
    
  • edited March 2009
    icabod wrote: »
    Gasman wrote a kinda micro-tracker for a 1k intro I think - have a looksee on his blog or do a search on raww.org perhaps. I think it may have been 6-channel.

    That'll be Apology - not particularly useful for this topic, as the tracker there was written to handle one special case (6-channel sound, no effects, just one big list of notes really).

    I seem to remember that someone from Russia (possibly MMCM / Sage?) was working on a minimal tracker a few years back - actually called Minimal Tracker. I didn't look at it (not sure if it was ever finished, in fact) - normally my music for <=4K intros (of which Haiku and my latest effort Starlet Guitarlet are the most notable) is hand-coded in assembler.

    As aowen says, doing it that way means that you only have to code in the effects you actually use, but for Haiku I ended up implementing pretty much the entire feature set of SoundTracker. There were two major techniques I used to save space: firstly, expressing samples as changes over time (so rather than storing it as 15, 15, 14, 14, 13, 13, 12, 12... store it as "begin at 31, decrement by 1 each time (and shove an SRL A instruction somewhere in the player code)").

    Secondly, and more importantly, exploit the hell out of self-similarity and repetition in the music. Trackers do this at a very basic level, by dividing the song into patterns which are played back in a defined sequence - some of them, like SQ Tracker, go a bit further by having individual patterns per channel - so if you have drums that just keep going bum-tish ba-dum-dum tish, you can just have one channel playing that one pattern all the time. You can take this a lot further though - for example, the opening theme of Haiku has three bars with a different melody but exactly the same rhythm, so it makes sense to treat the "rhythm pattern" and "pitch pattern" as two separate things, where rhythm repeats and pitch doesn't.

    (Actually, the accepted wisdom handed down from the PC demoscene is *not* to explicitly code the repetition as a loop - just have lots of long repeating data streams, and let your packer deal with them. This may or may not be helpful, depending on what you're optimising for - runtime size or packed size...)

    The master plan for Starlet Guitarlet was to take this to the extreme - I was covering a dance track, so obviously there's going to be a lot of repetition, and if you analyse it closely there's a sort of fractal nature there - repetition at lots of different levels, right from the overall progression of the song down to the makeup of individual notes. I was hoping that once I'd effectively decomposed it into a sequence of sequences of sequences of sequences of sequences of sequences of AY register writes, I'd be able to pick out a pattern in my code that would represent "sequence-ness", and I could work out a way to say 'do this thing 6 times'. Unfortunately, time and space constraints meant that I didn't get that far...

    I don't know where I'm going with this really. :-) I suppose my point is something like this: trackers do a pretty damn good job of dividing music into repeatable building blocks. People can do an even better job, because the brain is very good at finding patterns. Trying to do this automatically is hard. Interesting, but hard.
  • edited March 2009
    gasman wrote: »
    I seem to remember that someone from Russia (possibly MMCM / Sage?) was working on a minimal tracker a few years back - actually called Minimal Tracker.

    Well, actually the program is here:
    http://trd.speccy.cz/system/MIN_X.ZIP
    ZX Spectrum 48K BEEPER Music:
    http://mister_beep.republika.pl/
  • edited March 2009
    Another thing to think about before anyone starts writing a new music player with it's own bespoke format is that, eventually, someone actually has to write some music for it. Musicians like tools like Vortex tracker and get wonderful results from them because they have invested time in learning the tool and because the tool is mature and written by someone who really knows what they are doing. If you create a new format then, chances are, you'll get very unimpressed looks from any musicians that you ask to write tunes for you. Of course, this is fine if you are a great musician and are able to write the music yourself as well as being a great coder who can make a sweet sounding tracker routine in the first place.. but we can't all be Gasman! ;)

    As far as being worried by the memory footprint of modules... well.. it bothers me a little, but then I just stick it in a spare 128k memory bank and forget about it

    ..and on the subject of writing music that takes up only a small amount of space - embrace randomness! IIRC the whole player code and music data for some of my 1k intros is only a couple of hundred bytes long when compressed, and the melody data comes from the Spectrum ROM - it's all about taking "random" data and being able to bend it into something musical using a simple ruleset
  • edited March 2009
    I had the same problem when I was trying to write my own minigame.

    Eventually I wrote my own simple routine. It uses only one channel at constant volume.

    The results can be seen here:

    http://www.worldofspectrum.org/infoseekid.cgi?id=0018326

    If you like, I could send you the game code.
  • edited March 2009
    evilpaul wrote: »
    but we can't all be Gasman! ;)


    Sad. Very sad but true.


    Metallica will sue me.
    ZX Spectrum 48K BEEPER Music:
    http://mister_beep.republika.pl/
  • edited March 2009
    Fikee wrote: »
    1) Is here a way to create more compact music ?

    Years ago I have written my own player and compiler for the polish ProTracker (1.1 it was, I guess). Later I found the ProTracker was originally accompanied with a compiler of their own, it just didn't found its way here as someone didn't suppose its important enough to pass it along.

    My compiler was basically doing things which gasman mentions, converting the pattern structure suitable for editing to the program-like streams commonly used in all pre-tracker players.

    The result can be seen for example in Xor 128, which I have implanted with a compiled version of one of the demo tunes which came with the ProTracker.

    I might even try to find some of the sources if you are interested, although I would expect that people today use one of the more advanced trackers instead anyway.

    Patrik
  • edited March 2009
    Patrik Rak wrote: »
    Years ago I have written my own player and compiler for the polish ProTracker (1.1 it was, I guess).

    If Polish then SOUND-Tracker (yes, 1.1).
    ProTrackers are Russian.
    ZX Spectrum 48K BEEPER Music:
    http://mister_beep.republika.pl/
  • edited March 2009
    Yes, you are right. So many trackers since then that I lost, erm, track. :)

    Patrik
  • edited April 2009
    Just thought I'd revive this thread with a link to a 1k music program that I've just released: http://www.evilpaul.org/wp/?p=75

    It's not a tracker, but there might be some bits that you can nick - the full source code is included ;)
Sign In or Register to comment.