[sdiy] Soft ADSR ways?
David Moylan
dave at westphila.net
Mon Feb 14 00:30:00 CET 2011
Isn't it possible to use a difference equation? For instance you figure
out the difference between the current envelope value and the asymptote
value, the divide (preferable by a power of 2, so you can just bit
shift) then add that back to the envelope val?
I guess the problem is you only have as many possible values for the
stage time as there are bits, so for an 8 bit calculation 256 possible
rates. You could do a 16-bit calculation, but still maybe the range of
most interest doesn't fall where we'd like. Not sure.
Anyone have insight on the algorithms used in some of the classic
software envelope polysynths? There obviously wasn't a lot of CPU power
to go around. I've been reading the datasheet for the CEM3394 lately
and it seems the final VCA is made to give roughly exponential release
for linear release envelope. I guess that's one way around it. I'm
curious what that does to a linear attack envelope. Seems like you'd
have an exponential shaped attack for a linear attack portion. Anyone
have a SixTrack/MultiTrak/Max and an oscilloscope? Maybe the work
around it in software?
Dave
Tom Wiltshire wrote:
> You always finish up with a LUT because anyone who tries to do maths on a $2 processor is having a laugh. Doing all the maths beforehand and storing the results in a LUT is the only sensible way to avoid hard sums. There are one or two situations where doing actual, real sums is unavoidable. I had such a case with the Tap Tempo LFO. The user provides a time period given as a pair of taps, and that needs to be converted to a frequency increment value. I spent a good while thinking about how to turn that into a lookup, but in the end had to bite the bullet and do a 24-bit by 16-bit division or whatever it was. There were simply too many possible inputs to use a lookup table, and interpolation between fewer table entries wouldn't have given me enough accuracy in that case.
>
> Hi Karl,
>
> I tried various approaches along the lines of calculating simple RC charging/discharging curves when I was designing my VCADSR. This is essentially an impulse and a IIR filter, I guess. I found that the output wasn't bad, but that getting sufficient control resolution was very difficult. I wanted a 1:10000 range (1ms to 10secs) and I found I needed ridiculous levels of accuracy for my control variables. Ridiculous for an 8-bit PIC, anyway.
>
> The advantages of the counter+LUT approach I finished up with were that it provided a simple way to "stretch" the envelope curve in time, the counter accuracy wasn't too extreme, and you get arbitrary envelope curves for free.
>
> Also, you don't have to think about the whole envelope. Each stage is basically identical, with start and and end levels, a curve table to use, and a time taken. If you can do one, you can do any number. The only part that's different is "sustain", but that is easily implemented as a pause at the level which represents the end of the decay stage and the start of the release stage, assuming you want ADSR-type behaviour.
>
> Good luck,
> Tom
>
>
> On 13 Feb 2011, at 10:06, karl dalen wrote:
>
>> How many ways could one do an ADSR in? Which one are
>> fastest and which one are fast and code efficient??
>>
>> 1.Impulse + low pass something, tight code? conceptually tricky?
>>
>> 2.Divide 1.0 with (time*samplerate), add/subtract value
>> from envelope level for the appropriate number of samples
>> does that need a LUT, no?
>>
>> 3.As 2 but use change state based on the envelope level +LUT?
>>
>> 4.Counter + level state machine + large/medium LUT?
>>
>> 5.Same as 4 but interpolate small LUT?
>>
>> 6.cube muls something?
>>
>> 7.......more ways?
>>
>> Why do i constantly end up with a LUT?!!?
>> I still need to interpolate i.....hmmm..
>>
>> Reg
>> KD (dont talk math with me im crap at it)
>>
>>
>>
>> _______________________________________________
>> Synth-diy mailing list
>> Synth-diy at dropmix.xs4all.nl
>> http://dropmix.xs4all.nl/mailman/listinfo/synth-diy
>
> _______________________________________________
> Synth-diy mailing list
> Synth-diy at dropmix.xs4all.nl
> http://dropmix.xs4all.nl/mailman/listinfo/synth-diy
>
More information about the Synth-diy
mailing list