envelope level at dx7

1,375 views
Skip to first unread message

ali.al...@kommunikationstechnik.org

unread,
May 8, 2013, 2:00:58 PM5/8/13
to music-synthesi...@googlegroups.com
Dear All,

i am new with this topic. I have a question regarding the dx7 Yamaha. 
my question is: what is the relation between the output level operator and the envelope generator levels (L1, L2, L3, L4)? for example if the output levet is 99 and the envelope generator is L1= 99, L2=80,  L3=74, L4=0, what is the actual output level? there is any equation for that?
the second question is about the Envelope rates(R1,R2,R3,R4), for example if R1= 99,R2=84,R3=74,R4=20, how can i calculate the time in second form the attack to the release stage?


thanks in advance,
Ali

Raph Levien

unread,
May 10, 2013, 2:08:54 AM5/10/13
to music-synthesi...@googlegroups.com

That also contains a pointer to a JavaScript emulation http://wiki.music-synthesizer-for-android.googlecode.com/git/img/env.html . The code is not that complicated, so if you're comfortable reading that, it should tell you everything you want to know.

But let me try to give you a quick answer. The output level is in units of .75db (8 units is one doubling of level = 6dB). This is strictly true for output levels >= 20, and for values less than that there is a nonlinear curve (this is var outputlevel = [...] in the JS source) with a more rapid falloff (thus, level 0 is -95.5dB from level 99, where with a linear curve it would be 74.5dB). Another detail is that levels L1...L4 (as opposed to output level) are actually quantized to steps of 1.5dB. This helps the post-lut levels fit in 6 bits.

The rates are in terms of dB/s - so the amount of time that it takes is proportional to the dB level difference between L_i and L_(i+1). The exact formula is in the wiki page, but a passable approximation is 0.2819 * 2^(rate * 0.16) dB/s. So a rate of 0 is 0.2819dB/s, meaning that it takes about 10 minutes to decay from full to minimum level. A rate of 99 is 16165dB/s, meaning that it takes about 6ms. (Note: I need to update the equation in the wiki to 0.2819, the old version said 0.014095 which is off by a factor of 20.)

Attacks are faster than decays, and have a nonlinear curve (again, explained precisely but tersely on the wiki, and easy to visualize).

Plugging in your data, L2 is 14.25dB down from L1, and L3 is 18.75 dB from L1. It will reach L3 (the sustain level) in 495 samples, almost exactly 10ms. Then, after key-up it will take about 43 seconds for your note to go entirely silent (76dB at 1.75dB/s).

I hope this answers your questions.

Raph



--
--
You received this message because you are subscribed to the Google
Groups "music-synthesizer-for-android" group.
To post to this group, send email to
music-synthesi...@googlegroups.com
To unsubscribe from this group, send email to
music-synthesizer-fo...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/music-synthesizer-for-android?hl=en
Or visit the project homepage at http://code.google.com/p/music-synthesizer-for-android/
 
---
You received this message because you are subscribed to the Google Groups "music-synthesizer-for-android" group.
To unsubscribe from this group and stop receiving emails from it, send an email to music-synthesizer-fo...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

ali.al...@kommunikationstechnik.org

unread,
May 10, 2013, 6:54:01 AM5/10/13
to music-synthesi...@googlegroups.com

Dear Raph,

 

thanks for your reply.

i am still confusing, i have read the article https://code.google.com/p/music-synthesizer-for-android/wiki/Dx7Envelope and seen the program at the wiki.

is it possible to make a chat with you (when you have a free time) so i can ask you directly?

 

thanks,

Ali

 



Am Freitag, 10. Mai 2013 08:08:54 UTC+2 schrieb raph:

That also contains a pointer to a JavaScript emulation http://wiki.music-synthesizer-for-android.googlecode.com/git/img/env.html . The code is not that complicated, so if you're comfortable reading that, it should tell you everything you want to know.

But let me try to give you a quick answer. The output level is in units of .75db (8 units is one doubling of level = 6dB). This is strictly true for output levels >= 20, and for values less than that there is a nonlinear curve (this is var outputlevel = [...] in the JS source) with a more rapid falloff (thus, level 0 is -95.5dB from level 99, where with a linear curve it would be 74.5dB). Another detail is that levels L1...L4 (as opposed to output level) are actually quantized to steps of 1.5dB. This helps the post-lut levels fit in 6 bits.

The rates are in terms of dB/s - so the amount of time that it takes is proportional to the dB level difference between L_i and L_(i+1). The exact formula is in the wiki page, but a passable approximation is 0.2819 * 2^(rate * 0.16) dB/s. So a rate of 0 is 0.2819dB/s, meaning that it takes about 10 minutes to decay from full to minimum level. A rate of 99 is 16165dB/s, meaning that it takes about 6ms. (Note: I need to update the equation in the wiki to 0.2819, the old version said 0.014095 which is off by a factor of 20.)

Attacks are faster than decays, and have a nonlinear curve (again, explained precisely but tersely on the wiki, and easy to visualize).

Plugging in your data, L2 is 14.25dB down from L1, and L3 is 18.75 dB from L1. It will reach L3 (the sustain level) in 495 samples, almost exactly 10ms. Then, after key-up it will take about 43 seconds for your note to go entirely silent (76dB at 1.75dB/s).

I hope this answers your questions.

Raph

On Wed, May 8, 2013 at 11:00 AM, <ali.al...@kommunikationstechnik.org> wrote:
Dear All,

i am new with this topic. I have a question regarding the dx7 Yamaha. 
my question is: what is the relation between the output level operator and the envelope generator levels (L1, L2, L3, L4)? for example if the output levet is 99 and the envelope generator is L1= 99, L2=80,  L3=74, L4=0, what is the actual output level? there is any equation for that?
the second question is about the Envelope rates(R1,R2,R3,R4), for example if R1= 99,R2=84,R3=74,R4=20, how can i calculate the time in second form the attack to the release stage?


thanks in advance,
Ali

--
--
You received this message because you are subscribed to the Google
Groups "music-synthesizer-for-android" group.
To post to this group, send email to
music-synthesi...@googlegroups.com
To unsubscribe from this group, send email to

For more options, visit this group at
http://groups.google.com/group/music-synthesizer-for-android?hl=en
Or visit the project homepage at http://code.google.com/p/music-synthesizer-for-android/
 
---
You received this message because you are subscribed to the Google Groups "music-synthesizer-for-android" group.
To unsubscribe from this group and stop receiving emails from it, send an email to music-synthesizer-for-android+unsub...@googlegroups.com.

Raph Levien

unread,
May 11, 2013, 11:17:31 PM5/11/13
to Ali Al-Humairi, music-synthesi...@googlegroups.com



On Fri, May 10, 2013 at 11:29 AM, Ali Al-Humairi <ali.al...@kommunikationstechnik.org> wrote:
Dear Raph,

okay, i just want to get the answer faster because i am a new at this field and  have many questions. 
I appreciate if you can help me. Thanks in advance, 

You're quite welcome. I enjoy explaining this, and thanks for letting me do so on the mailing list so other people can get the benefit.
 
 
A. Regarding the JavaScript program: 
1. what is the frequency sampling? ist it like in yamaha dx7 (fs= 60 KHz)?

The sample rate on the DX7 is 49096 Hz. This is based on the service manual, and also spectral measurement of the DAC of the actual device (it shows frequency mirroring consistent with a Nyquist limit of half 49096). For the service manual reference, see http://homepages.abdn.ac.uk/mth192/pages/dx7/manuals/dx7-9_service_manual_1.pdf and the 20.368032 usec specification for the complete cycle of the OPS chip.
 

 
1. The conversion from level parameter (L1, L2, L3, L4 in the patch) to actual level is as follows:
Level 0..5 -> actual level = 2 * l
Level 5..16 -> actual level = 5 + l
Level 17..20 -> actual level = 4 + l
Level 20..99 -> actual level = 14 + (l >> 1)
what is this symbol "l" mean? is it the envelope level for example 99.

2.  the total level is  64 * actual level + 32 * output level, and this total level is in units of approx 0.0235 dB.
 
-   is it mean that i multiply the total level by 0.0235 to get the result at dB?
-   for example if the total level is 120 than it will 120*0.0235 in dB?
- the total level means the result of the interaction between the output level and the envelop level, is that correct?
- for example during the attack time, the level is 80 and the output level is 90, what is the result of the total level? 

Yes. Max possible level is 64 * 63 + 32 * 127 = 8096. If level is 80 and output level is 90, then the total output level is 64 * (14 + (80 >> 1)) + 32 * (90 + 28) = 7232 = 8096 - 864. 864 * .0235 = 20.304 dB down from max possible.

Keep in mind, these units of 0.0235dB are what's actually used in the synthesizer hardware - when I carefully plot envelope levels from measurements of the device, I can see consistent steps of this amount across the entire range. They represent exactly 1/256 of a doubling of level.

I've linked charts from the main wiki page, expressed in actual dB units, and I hope this helps make things clearer.
 

3. From measurement of timing, the minimum level seems to be clipped at 3824 counts from full scale -> 14.9375 doublings. Note, however, that velocity values > 100 can cause amplitudes greater than full scale. Full scale means both L and output level set to 99 in the patch, and no additional scaling.

-  what are these numbers stands for "3824", "14.9375 doublings" , "velocity values > 100"  ?
-  i did not understand, what is the relation between these numbers and how you are calculated these numbers?

3824 is a measurement of the number of steps between actual full scale and minimum level, based again on measurements from a real device. "14.9375 doublings" is just a different system of units: 256 microsteps = 1 doubling = 6.02dB.
 

4. As mentioned above, the decay shape is simpler than the attack. An exponential decay corresponds to a linear change in dB units. First, the R parameter in the patch (range 0..99) is converted to a 6 bit value (0..63), by the formula qrate = (rate * 41) / 64. The rate of decay is then 0.014095 * 2(qrate / 4) * (1 + 0.25 * (qrate mod 4)) dB/s. This is a reasaonably good approximation to 0.014 * 2(qrate *0.25).

-  the rate of decay is calculated by:  qrate = rate*0.6406, rate of decay= .014 * 2(qrate *0.25) . is that correct?
- what is the  6 bit value ?

qrate is a 6 bit value. Internally to the EGS chip, the EG Rate/Level parameters are stored with 6 bits per value (ie a range of 0..63) even though the patch data is in the range of 0..99. Technically, qrate = floor(rate * .6406), as it's an integer.
 

5. Attack is based on decay, multiplying it by a factor dependent on the current level. In .0235 dB units, this factor is 2 + floor((full scale - current level) / 256). Also, level immediately rises to 39.98 dB (1700 steps) above the minimum level, which helps create a crisper attack.

-  do you mean the rate of attack at this paragraph?
-  factor = 2 + floor((full scale - current level) / 256), what are the full scale, current level? ist ist full scale = 99, and the current scale for example 70?

The units are .0235dB.
 
-  how these numbers ( 39.98 dB (1700 steps) ) are calculated ?

Measured from a real device.
 
-  what do you mean "Attack is based on decay, multiplying it by a factor dependent on the current level" ? ist ist the rate of attack = factor * current attack rate.

The rate of attack = the rate of decay times this factor (which is also dependent on level). This yields a nonlinear function for the attack. The best way to get a sense of this is play with the interactive implementation, I'm not sure how I can explain it better - though I'm willing to try.
 
-  this number ".0235 dB", where can i use it?
- what about the rate of sustain and release, how are they calculated?

By "decay" here I mean any decrease in level computed by the EG, and by "attack" I mean increase. It's L1, L2, L3, L4, and, while it's traditional for L1 to be attack, etc., it's not required.

So most commonly, since sustain and release are also decreases in level, the "decay" formula applies.
 
6. The output level is computed once, at the beginning of the note, and affects both the overall amplitude of the operator and also the timing. In addition to the "output level" setting in the patch, output level is also affected by velocity and scaling. The output level in the patch is in the range 0..99, and this is scaled in units of 0.7526 dB (ie 32 steps).

-  for example if the output level = 90, then i will multiply it with 0.7526 dB to convert to the dB scale, output level in dB = 90* 0.7526;
-  what do you mean by this number "32 steps", how do you calculated?

I just mean 32 of the steps of .0235dB each. .7526 = 32 * .0235.
 

7. Careful measurement of the DX7 reveals quite rich detail on how envelopes are actually computed. Clearly the resolution for amplitude is .0235 dB, and there are 12 bits total (for a maximum dynamic range of 72.25 dB).

-  what is the relation between "resolution for amplitude is .0235 dB" and the  "12 bits" and the "maximum dynamic range of 72.25 dB"?
-  how the "maximum dynamic range of 72.25 dB" is has been caculated?

Actually I think I made a mistake here. 12 bits means values 0..4095. 4095 * .0235dB is just over 96dB. The dynamic range isn't quite that high, but is close.

 

8. At a qrate of 0, the amplitude decreases by one step every 4096 samples, in other words halves every 220 samples. Each increase of 4 doubles the clock rate. Careful examination reveals that fractional multiples of qrate (ie qrate is not a multiple of 4) are clocked out using a pattern:

-  do you speak about the decay rate? if that is correct, what is the relation with step number 4 (it is also speaks about the rate of decay)?  which one i need to use to calculate the decay rate?

It's the same thing, and the calculation should yield the same result. Here I'm talking more about the internals of the implementation inside the synthesizer, rather than the end result, which is a fairly smooth decay of a constant dB/s rate. But there is quantization of both the gain (to units of .0235dB) and also in the time domain, as described here. It's safe to ignore - the effects of this quantization should be barely audible and only really possible to measure with careful analysis techniques. I included it because I'm fascinated by the implementation, how they were able to generate such smooth and versatile envelopes with such a tiny amount of 1980's era hardware.
 
- how is the amplitude decreases by one step every 4096 samples if the qrate = 0 ?, what is  halves every 220 samples?

At qrate = 0, the level decreases in half every 2^20 samples, ie 6 dB decrease in 1.048 million samples. At a sample rate of 49096, that's 6dB in 21.3s, or .28 dB/s.
 
-  what is "clock rate", is it equal R2?
- could you please explain the last paragraph? can you give example?

9. For attacks, instead of decrementing by 1, the factor is added (thus, no actual multiplication is needed). When the clock rate increases to the point where the increment would be needed more than once per sample clock (ie for qrate >= 48), the increment value is shifted left by (qrate / 4) - 11 instead, and the increment (masked by the bit pattern above) is applied every single sample clock.

-  what is relation between number 8 and number 5? which one i need to use to calculate the attack rate
- is the clock rate = R1?
- what do you mean by " the point where the increment would be needed more than once per sample clock" ?
- increment value is shifted left by (qrate / 4) - 11 instead, and the increment (masked by the bit pattern above) is applied every single sample clock, what is this? can give example?

Again, the best way to understand this is by looking at the code.

Also, keep in mind that all this logic is implementing a continuous change of level of some attack rate factor _times_ some rate, which ranges over a wide range of actual values. But it's not implemented using floating point math, it's implemented by very clever circuitry that computes it quite accurately using a tiny number of gates (by modern standards). It's not actually important to understand the details, even to create a super-accurate emulation.

For slow decays, the circuitry decreases the level by 1 (in units of .0.235dB) some clocks, and by 0 others. But beyond a certain rate (roughly 1 unit per lock) that wouldn't be fast enough, so below a qrate of 12, it subtracts some other number. For qrate 8..11, that's 2, for qrate 4..7, that's 4, and for qrate 0..3, that's 8. For attacks, all these numbers are multiplied by the attack rate factor described above. Since all these numbers are powers of two, the multiplication can be implemented with a shift, which is inexpensive.
 


C- Regarding your email:

1.  The output level is in units of .75db (8 units is one doubling of level = 6dB). This is strictly true for output levels >= 20, and for values less than that there is a nonlinear curve (this is var outputlevel = [...] in the JS source) with a more rapid falloff (thus, level 0 is -95.5dB from level 99, where with a linear curve it would be 74.5dB). Another detail is that levels L1...L4 (as opposed to output level) are actually quantized to steps of 1.5dB. This helps the post-lut levels fit in 6 bits.

- are you using the follwoing information to calculate the output level:

Level 0..5 -> actual level = 2 * l
Level 5..16 -> actual level = 5 + l
Level 17..20 -> actual level = 4 + l
Level 20..99 -> actual level = 14 + (l >> 1)  

- do you mean that "Level 0..5 -> actual level = 2 * l, Level 5..16 -> actual level = 5 + l,  Level 17..20 -> actual level = 4 + l " are nonlinear curve 
and "Level 20..99 -> actual level = 14 + (l >> 1)  "  is linear curve?

Yes. In the range 20..99, it's linear. That's very easy to see now that I've plotted it graphically (http://wiki.music-synthesizer-for-android.googlecode.com/git/img/outlevel.html).

- if output level = 99, then it will equal to 99 * 0.75 =   74.2500 dB, ist that correct? it is almost equal to 74.5dB.

Since writing the original version of the page, I've discovered that the output level is also subject to a lookup table with the same shape is the L1..L4 levels. I've updated the page to reflect this. So 74.5dB is not the correct value.
 
- how do calculate the "level 0 is -95.5dB from level 99"?

-95.5 = (0 - 127) * 32 * .0235.
 
- what do you mean by "levels L1...L4 (as opposed to output level) are actually quantized to steps of 1.5dB" ? can you give example? how is it reduced by a step of 1.5 dB? 
This helps the post-lut levels fit in 6 bits, what is "post-lut" and how it can be fit in 6 bit?

By post-lut I mean the value calculated after doing a lookup from the lookup table. Since that lookup table has values in the range 0..127, they fit in 7 bits. The DX7 shifts these values right by one bit, yielding a 6 bit value.
 

2. The rates are in terms of dB/s - so the amount of time that it takes is proportional to the dB level difference between L_i and L_(i+1). The exact formula is in the wiki page, but a passable approximation is 0.2819 * 2^(rate * 0.16) dB/s. So a rate of 0 is 0.2819dB/s, meaning that it takes about 10 minutes to decay from full to minimum level. A rate of 99 is 16165dB/s, meaning that it takes about 6ms. (Note: I need to update the equation in the wiki to 0.2819, the old version said 0.014095 which is off by a factor of 20.)

-  which equation i will use "0.2819 * 2^(rate * 0.16)" or i will use last step 4 & 5 at B section?

It depends on how precisely you need to emulate the DX7. This equation is simpler and very close to the real hardware, but of you look at the second chart in the outlevel.html page, you'll see that there are tiny deviations from linear. If you want to match the DX7 rate _exactly,_ then you can do the qrate calculation as described on the wiki.
 
-  how is the "10 minutes  to decay from full (99) to minimum level (0)" calculated?
-  how is the "6 ms  to decay from full (99) to minimum level (0)" calculated?

Both are 95.5dB / rate. For example, 95.5dB / 16164dB/s (which is the value for rate=99) = .0059s. However, for rate=0, instead of 10 minutes, it should be 5 minutes 41 seconds (this was a math error).
 


3.  Attacks are faster than decays, and have a nonlinear curve (again, explained precisely but tersely on the wiki, and easy to visualize).

can you please give an example?

Sure. I attached an image that was computed from the JS implementation.
 

4.  Plugging in your data, L2 is 14.25dB down from L1, and L3 is 18.75 dB from L1. It will reach L3 (the sustain level) in 495 samples, almost exactly 10ms. Then, after key-up it will take about 43 seconds for your note to go entirely silent (76dB at 1.75dB/s).

i hope after answering all the question, i will understand how you have calculated the above values?


I hope so too. Please let me know if you have more questions.
 

thanks in advance,
Ali

 
2013/5/10 Raph Levien <ra...@google.com>
Actually I'd prefer to answer in email - part of my goal is to create a record of this for the open source community.

Raph



For more options, visit this group at
http://groups.google.com/group/music-synthesizer-for-android?hl=en
Or visit the project homepage at http://code.google.com/p/music-synthesizer-for-android/
 
---
You received this message because you are subscribed to the Google Groups "music-synthesizer-for-android" group.
To unsubscribe from this group and stop receiving emails from it, send an email to music-synthesizer-fo...@googlegroups.com.
env.png

ali.al...@kommunikationstechnik.org

unread,
May 13, 2013, 10:32:34 AM5/13/13
to music-synthesi...@googlegroups.com

Dear Raph,

 

Thanks a lot for your help. It is very helpful. 

I just want to be sure that I have understood everything because I could not get the same result for same of them ( L2 is 14.25dB down from L1, and L3 is 18.75 dB from L1. It will reach L3 (the sustain level) in 495 samples, almost exactly 10ms. Then, after key-up it will take about 43 seconds for your note to go entirely silent (76dB at 1.75dB/s).) . So please could you check my calculation for the following example?

 With my regardss,

Ali

Ex1:

Output level = 99;

Envelope generator levels;

L1= 99, L2=80, L3=74, L4=0;

Envelope Generator Rates:

R1=99, R2=84, R3=74, R4=20;

What is the difference between A and B sections?

 

A.      A Total level

 

Total level                                       = 64*actual level+ 32*output level;

For level ( 0 to 5),      actual level = 2* level;

For level ( 0 to 16),    actual level = 5+ level;

For level ( 17 to 20),  actual level = 4+ level;

For level ( 20 to 99),  actual level = 14 + floor(level/2);

 

I have question: why we need to add 28 to output level (99+28)? Why we not use the output level directly (99)?

Max Total level =  8096

Total level (during the attack)    = 64*(14+(99/2)) + 32*(99+28) =  64*63+4064 =   8096

-          The reduction at dB down from 0 = (8096 – MAX) * 0.0235 = 0;

-          What about the increase at dB, is there any equation?

-          Can I say: increase at dB = (8096 – 0) * 0.0235 =   190.2560; I put zero because it starts with zero. Is this correct?

Total level (during the decay)     = 64*(14+(80/2)) + 32*(99+28) =  64*54+4064 =   7520

-          The reduction at dB down from the attack= (8096 – 7520) * 0.0235 = 13.5360;

Total level (during the sustain)   = 64*(14+(74/2)) + 32*(99+28) =  64*37+4064 =   7328

-          The reduction at dB down from the decay = (7520 – 7328) * 0.0235 =  4.5120;

Total level (during the release)   = 64*(2*0)            + 32*(99+28) =  64*0+4064   =   4064

-          The reduction at dB down from the sustain= (7328– 4960) * 0.0235 =   55.6480;

 

 

I will use the result form section C.

The attack time = 190.2560/ Attack rate. I could not calculate the attack rate, please see section C.

The time from L1 to L2                                               = 13.5360/3.1328e+03 =   0.0043 second

The time from L2 to L3                                                 = 4.5120/1.0335e+03   =  0.0044  second

The time after the key is up until silent                 = 55.6480/2.5905          =  21.4816second

 


B.      B. Envelope  

 

        B.1 Envelop level

 

Why we need to convert the level from ( from 0 to 99) to (from 127 to 0)?

-          Increased at dB from 0 (L4)      to  L1 (during the attack)   = (127 - 0)    * 32*0.0235 = 95.5040

-          Reduction at dB down from L1 to L2 (during the decay)   =  (19 - 0)     * 32*0.0235 = 14.2880

-          Reduction at dB down from L2 to L3 (during the sustain)   =  (25 – 19)  * 32*0.0235 = 4.5120

-          Reduction at dB down from L3 to L4 (during the release)   =  (127 - 25) * 32*0.0235 = 76.7040

 

B.2 Envelop Rates

 

1.       Attack rate = decay rate * factor

Decay rate = 0.2819*(2^(rate*0.16)) = 0.2819*(2^(99*0.16)) =  1.6535e+04

Factor = 2+floor((full scale – current level)/265)

-What is the full scale? Is the current level = L1? Could you please calculate the factor for this case?

So the Attack rate = 1.6535e+04 * factor

And the attack time = 95.5040/ Attack rate.

 

2.       Decay rate for the R2= 0.2819*(2^(84*0.16)) =  3.1328e+03;

The time from L1 to L2 = 14.2880/3.1328e+03 =  0.0046 second

 

3.       sustain rate for the R3= 0.2819*(2^(74*0.16)) =  1.0335e+03

The time from L2 to L3 = 4.5120/1.0335e+03=  0.0044  second

 

4.       release rate for the R4= 0.2819*(2^(20*0.16)) =  2.5905

The time after the key is up until silent  = 76.7040/2.5905=   29.6097 second

 

 

Ex2:

Output level = 65;

Envelope generator levels;

L1= 99, L2=80, L3=74, L4=0;

Envelope Generator Rates:

R1=99, R2=84, R3=74, R4=20;

 

For example 2, the results for section B and C are same as the example 1, is this correct?

Only section A, the result is changed because the output level is changed, is this correct?

Raph Levien

unread,
May 27, 2013, 3:50:08 PM5/27/13
to music-synthesi...@googlegroups.com
Sorry for the delay. I'll do my best to respond, but I think in some cases I'm not fully understanding what you're asking.

In general, to check the results, especially for more complex things like measuring attack time (which is not a simple analytic function) I recommend using the Javascript code linked from the wiki. That will clock out envelope values (in units of 0.0235dB) once per sample (49096Hz). You can plug in any envelope and output level values you like, and it will generate an accurate envelope. The enclosing HTML page generates a graph, but you should be able to adapt it to output data in other useful formats.

Take care,

Raph

On Mon, May 13, 2013 at 7:32 AM, <ali.al...@kommunikationstechnik.org> wrote:

Dear Raph,

 

Thanks a lot for your help. It is very helpful. 

I just want to be sure that I have understood everything because I could not get the same result for same of them ( L2 is 14.25dB down from L1, and L3 is 18.75 dB from L1. It will reach L3 (the sustain level) in 495 samples, almost exactly 10ms. Then, after key-up it will take about 43 seconds for your note to go entirely silent (76dB at 1.75dB/s).) . So please could you check my calculation for the following example?

 With my regardss,

Ali

Ex1:

Output level = 99;

Envelope generator levels;

L1= 99, L2=80, L3=74, L4=0;

Envelope Generator Rates:

R1=99, R2=84, R3=74, R4=20;

What is the difference between A and B sections?

 

A.      A Total level

 

Total level                                       = 64*actual level+ 32*output level;

For level ( 0 to 5),      actual level = 2* level;

For level ( 0 to 16),    actual level = 5+ level;

For level ( 17 to 20),  actual level = 4+ level;

For level ( 20 to 99),  actual level = 14 + floor(level/2);

 

I have question: why we need to add 28 to output level (99+28)? Why we not use the output level directly (99)?

The conversion from output level (as expressed in the DX7 patch) to actual level (in dB) is a nonlinear function, designed to give more range (95.5 dB total) than if you just used units of 0.75dB / count. For output level values above 20, there is no difference, because this is the linear part of the nonlinear function.
 

Max Total level =  8096

Total level (during the attack)    = 64*(14+(99/2)) + 32*(99+28) =  64*63+4064 =   8096

-          The reduction at dB down from 0 = (8096 – MAX) * 0.0235 = 0;

-          What about the increase at dB, is there any equation?

-          Can I say: increase at dB = (8096 – 0) * 0.0235 =   190.2560; I put zero because it starts with zero. Is this correct?


For all my calculations, I'm using relative values, most of which are relative to "full scale" (i.e. output level = 99, L1 = 99). Also, keep in mind that dB is a relative measure. The "zero" of these units is basically arbitrary. I recommend using values relative to full scale because that's much easier to measure accurately than trying to figure out the minimum level from the DX7.
 

Total level (during the decay)     = 64*(14+(80/2)) + 32*(99+28) =  64*54+4064 =   7520

-          The reduction at dB down from the attack= (8096 – 7520) * 0.0235 = 13.5360;

Total level (during the sustain)   = 64*(14+(74/2)) + 32*(99+28) =  64*37+4064 =   7328

-          The reduction at dB down from the decay = (7520 – 7328) * 0.0235 =  4.5120;

Total level (during the release)   = 64*(2*0)            + 32*(99+28) =  64*0+4064   =   4064

-          The reduction at dB down from the sustain= (7328– 4960) * 0.0235 =   55.6480;

These calculations look right to me, but I haven't checked them in detail. 

 

 

I will use the result form section C.

The attack time = 190.2560/ Attack rate. I could not calculate the attack rate, please see section C.

The time from L1 to L2                                               = 13.5360/3.1328e+03 =   0.0043 second

The time from L2 to L3                                                 = 4.5120/1.0335e+03   =  0.0044  second

The time after the key is up until silent                 = 55.6480/2.5905          =  21.4816second

 


B.      B. Envelope  

 

        B.1 Envelop level

 

Why we need to convert the level from ( from 0 to 99) to (from 127 to 0)?

That's simply the way the DX7 works. A lot of it has to do with the choice to make the patch UI in human friendly units of 0..99, while the internal computations use the full dynamic range available in a binary value.
 

ali.al...@kommunikationstechnik.org

unread,
Jun 6, 2013, 6:14:50 AM6/6/13
to music-synthesi...@googlegroups.com
 

Dear Raph,

Thanks a lot for your reply. It was very helpful.

You have recommended me to use the Javascript code linked from the wiki. I am using this program (interactive JavaScript), but can I get the code so I will understand it better because I will see the actuale calculation.

You have missed three questions, could you please answer them? May be these question is simple, I am confusing and I want to be sure that I understand it well.

1.      At the beginning of example 1, I asked: What is the difference between A and B sections? Or what is the relation between section A and B?

Section A is about Total level and Total level time or Total level Rate.

Section B is about Envelope level and Envelope Rate.

What is the difference or the relation between the Total level (A) and Envelope level (B)?

What is the difference or the relation between the Total level time (A) or Total level Rate and Envelope Rate (B)?

 

2.      At example 1, section B.2:

Attack rate = decay rate * factor

Decay rate = 0.2819*(2^(rate*0.16)) = 0.2819*(2^(99*0.16)) =  1.6535e+04

Factor = 2+floor((full scale – current level)/265)

-       What is the full scale? Is the current level = L1 (attack level)? Could you please calculate the factor for this case?

So the Attack rate = 1.6535e+04 * factor

And the attack time = 95.5040/ Attack rate.

 

3.      For example 2:

The results for Envelope level and Rates are same as the example 1 section B, is this correct?

The result for the Total level are different from example 1 section A because the output level for example 2 has been changed, is this correct?

 

ali.al...@kommunikationstechnik.org

unread,
Jun 19, 2013, 4:00:06 AM6/19/13
to music-synthesi...@googlegroups.com

Dear Raph,

 

If I have a cine wave signal and the Peak amplitude is 225 mv and the energy at the dB = -2.9563 dbm.

U = 225e-3 volt ; R = 50 ohm;

Energy at db = 10*log10( ((U/sqrt(2))^2/R) / 1e-3)= -2.9563 dBm.

What will happen when i apply the following  the last example (ex.1):

Output level = 99;

Envelope generator levels;

L1= 99, L2=80, L3=74, L4=0;

Envelope Generator Rates:

R1=99, R2=84, R3=74, R4=20;

 

Thanks in advance,

Ali

 


Am Mittwoch, 8. Mai 2013 20:00:58 UTC+2 schrieb ali.al...@kommunikationstechnik.org:
Reply all
Reply to author
Forward
0 new messages