Re: Envelopes
Posted: Mon May 21, 2012 9:15 pm
Key Scale Rate
The actual rate of the envelope depends on more than just AR / DR and RR. It is also controlled by BLOCK, F-NUM, KSR and NTS.
The rate of the envelope increases as the frequency of the note increases. Initially a value documented as the key scale number is derived. This is taken from the BLOCK and one of the two MSB of the F-NUM. If NTS = 0 the bit 9, the MSB of F-NUM is used. If NTS = 1 the bit 8 of F-NUM is used instead. This key scale value is the BLOCK * 2 + F-NUM bit (either bit 9 or bit 8). If KSR =0 then the key scale number is then right-shifted two bits to the right to give a value between 0 and 3, if KSR=1 the key scale number remains between 0 and 15
The actual rate for an envelope phase is the envelope phase register value (e.g. AR) multiplied by 4 and added to the key scale number. This rate is clamped to between 0 and 63
the 4 MSB of the rate behave as documented in my previous posts in this topic on the Attack, decay and release rates. The 2 LSB have a subtle effect to accelerate things.
If I select a decay rate DR of 9, and low frequency leading to a key scale number of 0, the actual rate is 36 and the envelope amplitude changes by 8 every 16 samples.
if the key scale number is 1, the actual rate is 37 and the envelope amplitude changes by 8 after 16 samples, 8 after the next 16 samples, 8 after the next 16 samples, 8 after the next 8 samples and 8 again 8 samples later. So for every 64 samples we actually make 5 step transitions
if the key scale number is 2, the actual rate is 38 and the step lengths become 16, 8, 8, 16, 8, 8.
Similarly for a rate of 39 the step lengths are 16, 8, 8, 8, 8, 8, 8.
Rate Step lengths
40 8,8,8,8
41 8,8,8,4,4
42 8,4,4,8,4,4
43 8,4,4,4,4,4,4
44 4,4,4,4
45 4,4,4,2,2
The actual rate of the envelope depends on more than just AR / DR and RR. It is also controlled by BLOCK, F-NUM, KSR and NTS.
The rate of the envelope increases as the frequency of the note increases. Initially a value documented as the key scale number is derived. This is taken from the BLOCK and one of the two MSB of the F-NUM. If NTS = 0 the bit 9, the MSB of F-NUM is used. If NTS = 1 the bit 8 of F-NUM is used instead. This key scale value is the BLOCK * 2 + F-NUM bit (either bit 9 or bit 8). If KSR =0 then the key scale number is then right-shifted two bits to the right to give a value between 0 and 3, if KSR=1 the key scale number remains between 0 and 15
The actual rate for an envelope phase is the envelope phase register value (e.g. AR) multiplied by 4 and added to the key scale number. This rate is clamped to between 0 and 63
the 4 MSB of the rate behave as documented in my previous posts in this topic on the Attack, decay and release rates. The 2 LSB have a subtle effect to accelerate things.
If I select a decay rate DR of 9, and low frequency leading to a key scale number of 0, the actual rate is 36 and the envelope amplitude changes by 8 every 16 samples.
if the key scale number is 1, the actual rate is 37 and the envelope amplitude changes by 8 after 16 samples, 8 after the next 16 samples, 8 after the next 16 samples, 8 after the next 8 samples and 8 again 8 samples later. So for every 64 samples we actually make 5 step transitions
if the key scale number is 2, the actual rate is 38 and the step lengths become 16, 8, 8, 16, 8, 8.
Similarly for a rate of 39 the step lengths are 16, 8, 8, 8, 8, 8, 8.
Rate Step lengths
40 8,8,8,8
41 8,8,8,4,4
42 8,4,4,8,4,4
43 8,4,4,4,4,4,4
44 4,4,4,4
45 4,4,4,2,2