Why change TL before key on ?

For anything related to sound (YM2612, PSG, Z80, PCM...)

Moderator: BigEvilCorporation

Post Reply
tryphon
Very interested
Posts: 303
Joined: Sat Aug 17, 2013 9:38 pm
Location: France

Why change TL before key on ?

Post by tryphon » Sun Jun 09, 2019 7:05 pm

I'm "disassembling" some VGM from MD games, and notice many weird stuffs. For example, I have something like that :

Code: Select all

000000: [channel 1] [operator 3] TL = 16
000000: [channel 1] key off
000000: [channel 1] [operator 3] TL = 8
000000: [channel 1] [operator 3] TL = 29
000000(1FD6): [channel 1] key off
000000(1FD9): [channel 1] key off
000000: [channel 1] frequency = 16 Hz
035037(548C): [channel 1] key off
035045: [channel 1] frequency = 164 Hz
035048: [channel 1] key on (mi3)
(the 1st number is the number of "ticks" of 1/44100th of a second since the beginning)

So as you can see, operator 3 TL is changed twice while the key is set off, frequency is also changed while key off.

Is there a reason for such a thing or can I assume this disassembling is equivalent to this one :

Code: Select all

000000: [channel 1] [operator 3] TL = 29
000000(1FD6): [channel 1] key off
035045: [channel 1] frequency = 164 Hz
035048: [channel 1] key on (mi3)
?

Also, do have 2 consecutive key-off commands an effect that only one key-off has not ?

Stef
Very interested
Posts: 2982
Joined: Thu Nov 30, 2006 9:46 pm
Location: France - Sevres
Contact:

Re: Why change TL before key on ?

Post by Stef » Tue Jun 11, 2019 8:17 am

TL parameter is changed "live" so it will affect immediately the sound generation.
Don't forget KEY OFF doesn't mean you immediately stop sound, it just a "release key" event so depending the RR (Release Rate) the operator can still output signal / sound (and if i remember correctly frequency setting is also immediately applied).
However having 2 consecutive KEY OFF has no use, these duplicated writes come from how the driver is coded, it's why you have VGM optimization tools (xgmtool in SGDK can do that) to remove all useless command and reduce (a lot) the VGM file size.

tryphon
Very interested
Posts: 303
Joined: Sat Aug 17, 2013 9:38 pm
Location: France

Re: Why change TL before key on ?

Post by tryphon » Sat Jun 15, 2019 9:14 am

Thanks, that confirms what I thought!

Post Reply