Zamuel_a wrote:I noticed that the intro music (when the static picture is showing) in Giana Sisters is some kind of digital sample / tracker or similair. I also found it in the SNDH archive in the Mad Max folder and the name was giana_title_digi something... It only takes 82k so how can they fit a sample for several minutes into that?
It's a Soundtracker-style song (with that I mean it's not Soundtracker/Protracker but a homecooked format by TEX). Technically it's a sample mixer (four channels) and samples for instruments like any Soundtracker routine.
Digi sound on YM is not that hard in theory. You got three channels with 4-bit volume on each. Combining the volumes will give you slightly better precision than 8-bits. So what you do is create a volume table of all volume combinations to cover an 8-bit sample. The higher sample frequency, the more often you need to change the volumes of the YM.
So an unoptimized player can look like:
move.b (a0)+,d0 ;get sample data 8 bit unsigned
lsl.w #2,d0 ;align to volume tab 4 byte per entry (ABC-)
move.b #8,$ffff8800.w ;select channel A
move.b (a1,d0.w),$ffff8802.w ; set volume A
move.b #9,$ffff8800.w ;select channel B
move.b 1(a1,d0.w),$ffff8802.w ; set volume B
move.b #10,$ffff8800.w ;select channel C
move.b 2(a1,d0.w),$ffff8802.w ; set volume C
And that's it. Now do that 15000 times per second for a 15 kHz sample
Of course that's dreadful horribly slow code. But should be easy to read and easy to come up with optimizations.
So that's the good part. The bad part is that the volume table will be all f.ucked up if you do it the normal mathematical way. Due to a really bad mixer when the Atari combine the channels, there seems to be feedback going from channel to channel. So a good volume table isn't linear and nice at all. Some unlucky dudes back int he 80's did analysis of the various volume combinations and came up with volume tables that actually works. Most people are using the ones from Quartet or ST Replay.