Plucked or exponential decay

For general discussion related FlowStone
Post Reply
User avatar
jacob
Posts: 9
Joined: Thu May 31, 2012 9:14 am
Location: Germany

Plucked or exponential decay

Post by jacob »

I would like to create a volume decay (envelope) like a plucked string has.

Like this one (hand drawn):

s97sg7f39hc87g9sdf52.jpg
s97sg7f39hc87g9sdf52.jpg (8.59 KiB) Viewed 11442 times

I would like to be able to control with knobs the decay time (duration (0-20 seconds) from volume 1 to 0) and the amount of the exponential effect.

I could not find the way to do it. Does anyone have any idea how this can be done?
User avatar
MyCo
Posts: 718
Joined: Tue Jul 13, 2010 12:33 pm
Location: Germany
Contact:

Re: Plucked or exponential decay

Post by MyCo »

Have a look at this:
http://synthmaker.co.uk/forum/viewtopic ... =30#p61053

When curve turned to the right, the envelope gets the shape you want. For plucked string, you have to turn Sustain & Release down to zero, and only use the decay.
User avatar
jacob
Posts: 9
Joined: Thu May 31, 2012 9:14 am
Location: Germany

Re: Plucked or exponential decay

Post by jacob »

Great, that is exactly what I need. Also the Attack, Sustain and Release could be useful actually.

I guess I have to trim this down, understand it and create my own code to use.
User avatar
jacob
Posts: 9
Joined: Thu May 31, 2012 9:14 am
Location: Germany

Re: Plucked or exponential decay

Post by jacob »

Maybe you could help me with this :)

What does the first part do?

8a97fuiz2i2.PNG
8a97fuiz2i2.PNG (17.28 KiB) Viewed 11423 times


I see a knob value with 0-1 comes trough. But what is sharpness and scale for?

The result of the "exp" box is bewteen 0-10 - the scale float multiplied the 0-1 result up to 0-10.

Actually I can simply delete the "exp" box and it still works. Is that exp-box only for making the knob exponential in it's behavior - like becoming more sensible in higher or lower knob ranges?

And the hop-box does what? Making it hop some samples to not be calculated?

The main variables needed before the code comes are: decaySamplesHoped, decayStepSize and curve( 1 to -1 )?

But I guess the code which calculates the decay is the most important. But it is written with the assembler - I don't understand that :)

Is the assembler more efficient in cpu usage than the code or why do you use it? If yes, how much :)

I need the most important part: the decay calculation. If on every sample the volume becomes calculated through a code block, I need a simple calculation which uses the current time already passed (which gets updated on every cycle within the variable currentSample). And there would be two other knobs to control the curve in it's shape/exponantial and tell the code how long the decay should last.

Let's say I have these current values:
currentSample = 200
decayTime = 44100 samples (would be one second)
curve = not sure what is needed here (maybe the exponent)
maxVolume would be 1 I guess

Can I calculate the currentVolume with only these values on every cycle?
Post Reply