Help me w/ maths for decelerating attack curves + predicting durations, i.e. I am noob and what curve is this, how it relates to a basal dBU/s 
Help me w/ maths for decelerating attack curves + predicting durations, i.e. I am noob and what curve is this, how it relates to a basal dBU/s 
Apr 29 2013, 12:42
Post
#1


Group: Super Moderator Posts: 5275 Joined: 23June 06 Member No.: 32180 
Preface: As tends to happen whenever I start writing, this got out of control quite quickly. I’m going to refrain from deleting much lest I make my core thoughts even more difficult to follow, but I’ve emboldened what I think are my key points – if I can be said to have any at all…
I’ve started quantifying parameters of a hardware synthesiser for reference and comparison, and just maybe the future design of an emulator. What is baking my brain is the attack phase of the envelope. Decay was easy to quantify and proceeds by a constant number of dBU/s that scales exponentially with the rate chosen; in other words, decay is linear on a scale of dBU. Attack, on the other hand, is apparently modelled on observations that natural instruments often have exponential attacks. Accordingly, attack is claimed to follow an inverted version of the decay curve but multiplied by a factor that depends upon the instantaneous distance between (current level) and (target level). In other words, on a logarithmic scale, the curve initially rises quite steeply but then progressively becomes shallower as the level approaches its final value. My lack of skill with mathematics probably means I’m confusing things with a lot of vague descriptions and inconsistent/misnamed terminology, but I did manage to mess around enough to obtain something that resembles the curve I’m talking about. It looks like this: CODE y = x * (1 + (1  x)) Which gives this:0 <= x <= 1 0 <= y <= 1 Which looks similar enough, at least for now, to the curve formed by the amplitude of the attacking waveform when the latter is viewed on a logarithmic scale. This is probably some bogstandard type of curve/formula/relationship, but my novice Googlin’ didn’t reveal anything except the logarithmic curve, which seems to decelerate more slowly and asymptotically, rather than finally reaching 1 as this formula does. I presume this formula, or perhaps its more conventional representation if there is one, can easily be adapted for differing scales of the variables on both axes. At the moment, I’m most interested in predicting the mean rate of amplification and hence the duration. This would be more immediately useful for reference and, probably, would also be beneficial for later attempts to model the curve accurately. Perhaps predicting the mean dB/s specifically requires such a model, which is where these questions come in! So, as I confess to not being mathematically minded at all (at least that I’m aware), I need advice from those who are. Given that the curve representing the attack is likely to be a transformation of decay, which is based on some multiplication of the decay rate with deceleration as (current level) approaches (final level), is there a way to calculate a factor by which (mean rate of decelerating attack over a given range of dBU) will = (some mystical factor) × (measured rate of linear decay)? Maybe it’s as simple as substituting in the relevant starting and finishing values on the yaxis and deriving from there, but I’m already out of my depth as it stands, as you can probably tell. Or does deriving the mean change in dBU between any given pair of points (also in dBU) require consideration of the entire curve, e.g. calculus or something baffling like that? My tests so far suggest that, unlike with the decay, the distance in dBU between (starting level) and (final level) factors into the rate of attack. I can’t see any obvious relationship in the numbers between (distance in dB) and (factor by which to multiply the corresponding rate of decay), at least to a mathematical layman such as myself. I guess the bulk of my question is – assuming the rate of a decelerating curve can be converted to a mean value, which is a proposition I can’t possibly evaluate as a novice – how/whether the (hypothetical) mean rate of increase can be derived from the defined distance in dBU, given the basal unit of change in amplitude per second of the decay. Excuse the lack of specifics, but I’m proceeding on the basis, or just hope, that the relationship is based solely upon the shape of the curve (yet to be confirmed) and the basal unit of dB/s (from the decay of the ‘same’ [but, obviously, actually not] rate), so I presumed a tonne of measurements in seconds would not be useful here. Summary: Assuming the attack is vaguely reminiscent of a decelerating curve like the above (the hardware probably approximates it in a peculiar way, if previous findings are anything to go by), is there a way to calculate the factor by which it relates to the underlying linear decay upon which it is apparently based? In other words (I think ), I want to be able to calculate the mean rate of attack that corresponds to a given rate of decay (and hence the duration of said attack phase, etc.). Thanks a lot to anyone who has the mental power and/or masochism to have read this far! Guidance for a hopeless nonmathematician will be greatly appreciated. This post has been edited by db1989: Apr 29 2013, 14:04 


May 1 2013, 13:03
Post
#2


Group: Super Moderator Posts: 5275 Joined: 23June 06 Member No.: 32180 
My lack of skill with mathematics probably means I’m confusing things with a lot of vague descriptions and inconsistent/misnamed terminology, but I did manage to mess around enough to obtain something that resembles the curve I’m talking about. It looks like this: CODE y = x * (1 + (1  x)) 0 <= x <= 1 0 <= y <= 1 Derp. As now seems obvious, after some thought, that’s actually this: CODE y = x * (1 + (1  x)) So, it’s a parabola that intersects the xaxis at y=0 and has its apex at y=1, of which my earlier graph was merely an excerpt for 0 ≤ x,y ≤ 1. Albeit from the same formula expressed in an unnecessarily convoluted way, which maybe gave someone a little chuckle if nothing else.y = x * (2  x) y = 2x  x^2 Anyhow, aside from showing how much I’ve forgotten since school, this doesn’t actually help much. Obviously it does nothing to indicate the elapsed time without substituting in a preexisting rate. Differentiating it may be vaguely informative, but I suspect its relevance is limited in any case. ‘Pure’ mathematics do not seem to be the answer here as the actual implementation in hardware seems to be considerably less sophisticated. It seems to use a fairly coarse method to scale the ‘basal’ rate (i.e. the ‘corresponding’ decay) by a factor that ‘steps’ quite noticeably. That involves a bunch of components whose values are currently completely mysterious to me. Oh well! 


May 1 2013, 15:57
Post
#3


Group: Members Posts: 944 Joined: 15December 01 From: Germany Member No.: 662 
I would love to try to help, but I'm having a very hard time understanding your problem. You are talking about this https://en.wikipedia.org/wiki/Synthesizer#ADSR_envelope, correct?
Your question seems to concern the attack part, but then you mention decay. In what way are those two related? Do you set the decay on the synth and it automatically sets the attack? Are they connected by some ratio? I'm aware of the first statement in bold, but I can't make sense of it, mainly due to relationship to the decay. The rest sort of sounds like you are describing a linear differential equation... the solution to which involves exponential functions. It could be possible that the synth implements the attack using a capacitor. Charging a capacitor would lead to a curve similar to the one you drew (voltage over time). This can be expressed as u(t) = u_max * (1  exp(t/tau)). tau is your time constant. For a simple RC circuit tau = R*C. See https://en.wikipedia.org/wiki/RC_circuit for details. So the synth might use a variable resistor to control the duration of the attack. Is any of this helping you at all? P.S.: note that I have no idea of the actual inner workings of classic analog synthesizers. 


May 1 2013, 16:11
Post
#4


Winamp Developer Group: Developer Posts: 670 Joined: 17July 05 From: Brooklyn, NY Member No.: 23375 
Just take the derivative
Your formula: CODE y = 2x  x^2 rate of change, in terms of voltage CODE dy = (2  2x)dx to convert voltage to dB CODE u = 20*ln(y)/ln(10) u = 20*ln(2x  x^2)/ln(10) to calculate rate of change, in terms of dB CODE du = 20/ln(10) * (22x)dx/(2xx^2) Hope that helps! This post has been edited by benski: May 1 2013, 16:12 


May 1 2013, 21:40
Post
#5


Group: Members Posts: 1402 Joined: 9January 05 From: JJ's office. Member No.: 18957 
is K( 1  e ^ (at)) the function you were looking for?
 
J. D. (jj) Johnston 


May 2 2013, 17:31
Post
#6


Group: Super Moderator Posts: 5275 Joined: 23June 06 Member No.: 32180 
I would love to try to help, but I'm having a very hard time understanding your problem. You are talking about this https://en.wikipedia.org/wiki/Synthesizer#ADSR_envelope, correct? Decay and attack can be set to values in the same range, and there are indications elsewhere (from similar but not equivalent synths) that the rate of attack is a transformation of the rate of decay. I’ve pretty much characterised the rate of decay, which was fairly trivial, although I haven’t worked out the underlying logic (yet?). Anyway, decay is a linear decrease on a logarithmic scale (i.e. always n dBU/s), whereas an attack of the corresponding setting is supposedly based upon the rate for the equivalent decay but starting out more rapidly and then decelerating. So, the rate for the decay is multiplied by some high factor to begin with, then that factor decreases as the level approaches the final level (which isn’t constrained to 0 dBU).Your question seems to concern the attack part, but then you mention decay. In what way are those two related? Do you set the decay on the synth and it automatically sets the attack? Are they connected by some ratio? I'm aware of the first statement in bold, but I can't make sense of it, mainly due to relationship to the decay. QUOTE The rest sort of sounds like you are describing a linear differential equation... the solution to which involves exponential functions. I thought something like that might provide a usable means to estimate the duration, if not the underlying mechanism, but as I mentioned in my last post, it seems to work less smoothly than that.QUOTE Is any of this helping you at all? That’s fine: this one is digital. P.S.: note that I have no idea of the actual inner workings of classic analog synthesizers. Just take the derivative It might work as a basis of estimation, at least. Of course, the overall shape and time of the attack depend upon the nominal rate, the distance between the starting and ending levels, and the particular range of steps by which the rate is scaled over specific portions of the attacking distance.[…] Hope that helps! I think this is a bit beyond me at the moment… I started out just wanting to compile a table of durations in seconds, but that was painstaking and boring (maybe there’s an editor that can somewhat automate things like this; I don’t know), and I would inevitably end up wanting to have a more accurate—and fast!—way of doing things. Plus, an unrealistic part of me wants to start writing an emulator… :S Haha. is K( 1  e ^ (at)) the function you were looking for? I have no idea! What does that do? I can speculate about the curve slightly, but not much without knowing the identities of the variables. Thanks anyway, I guess. Thanks to everyone who replied. I guess I might need to do more boring recording and measuring, heh. 


May 7 2013, 19:25
Post
#7


Group: Members Posts: 1402 Joined: 9January 05 From: JJ's office. Member No.: 18957 
is K( 1  e ^ (at)) the function you were looking for? I have no idea! What does that do? I can speculate about the curve slightly, but not much without knowing the identities of the variables. Thanks anyway, I guess. Thanks to everyone who replied. I guess I might need to do more boring recording and measuring, heh. K is gain constant. A is a positive number. t is time. e is, well, 'e'. I would suggest you plot it. If you're doing this kind of work, you need to be very familiar with that particular function, it is the natural attack envelope function of a resonant system.  
J. D. (jj) Johnston 


LoFi Version  Time is now: 21st September 2014  22:03 