Page 4 of 5

Re: tula's DSP modules

PostPosted: Wed Jan 17, 2018 10:33 am
by adamszabo
By the way in martins exponential envelope posted by Spogg, there is an error in the assembly code on line 52 the last part its: addps xmm1,xmm41; the last should be "xmm4" and not "xmm41". I dont know if its there in the original code or it was added there later by accident.

Re: tula's DSP modules

PostPosted: Wed Jan 17, 2018 1:20 pm
by Spogg
adamszabo wrote:By the way in martins exponential envelope posted by Spogg, there is an error in the assembly code on line 52 the last part its: addps xmm1,xmm41; the last should be "xmm4" and not "xmm41". I dont know if its there in the original code or it was added there later by accident.

OMG :o

I've made extensive use of this in pretty much all of my projects!
What are the consequences?

Cheers

Spogg

Re: tula's DSP modules

PostPosted: Wed Jan 17, 2018 7:15 pm
by martinvicanek
adamszabo wrote:in martins exponential envelope posted by Spogg, there is an error

Thanks for spotting that, Adam!
@Spogg, the fact that it has remained unnoticed suggests that the impact is less than devastating. Indeed, the bug affects fast release - a feature that is not vital. What happens is that xmm41 is treated as an (undeclared!) variable not a 128 bit register. Often the value of xmm41 will be zero, however it is unpredictable and may in the worst case lead to freezing or crashing the plugin. So please synchronize paint all ADSR modules in each of your plugins and replace xmm41 by xmm4 in the ASM code.
REALLY SORRY! :oops:

Re: tula's DSP modules

PostPosted: Wed Jan 17, 2018 7:43 pm
by martinvicanek
Spogg wrote:
martinvicanek wrote:Have fun!


I can't because I don't understand what you did there :?

Sorry about the cryptic post. What I did there was what Adam and KG had described: add and subtract some number to reduce bit depth. My modest contribution was to specify that magic number in terms of bit depth, which, btw, works for both positive and negative input. The staircase diagram was to show the quantization effect.

Here is a hopefully less confusing schematic.

Re: tula's DSP modules

PostPosted: Wed Jan 17, 2018 10:13 pm
by tulamide
Hey Martin,

I'm aware that this is not on topic, but since we are already at it, would you please be so kind to give a hint about the relationship of the input numbers to sample rate and actual number of samples? I tried to find out on my own, but A and D (and R), although fed with the same number, are different in resulting times. D and R are probably 5+ times longer than A on max input (176k). Which rule applies?

(I'm talking of the ADSR :oops: )

Exponential Decay

PostPosted: Thu Jan 18, 2018 4:39 am
by martinvicanek
Unlike linear decay, exponential decay is never really "done". So how can we assign a characteristic "decay time" in that case?

Consider the expression

a(t) = a0*exp(-t/T)

There is this time constant T which is a measure of how fast things change. If the decay continued at the initial rate, then it would be complete by the time t = T (dashed line in the image). Since the decay is exponential, however, at t = T the amplitude is still at roughly 37% of its initial value.
expoDecay.png
expoDecay.png (6.51 KiB) Viewed 21714 times

There are other possibilities to characterize exponential decay times. Some common examples are:
1. Half-life T_1/2 in radioactive decay. Obviously that time is shorter than T. The relation is T_1/2 ≈ 0.69*T
2. Decay to ten percent is after T_10% ≈ 2.3*T
3. In reverbs, it is common to state the time forthe reverb tail to drop to -60dB. Assuming an exponential law, that duration is T_60 ≈ 6,9*T

So you see, there is no unique definition.

My expo module has four inputs:
A: Attack, linear rise time in samples (rounded to a multiple of 16).
D: Decay, exponetial decay time T in samples (rounded to a multiple of 16). Note that decay is not to zero but to the sustainn level.
S: Sustain level, a number between 0 and 1.
R: Release, exponetial release time T in samples (rounded to a multiple of 16).

If yo prefer to supply seconds instead of samples, you can convert seconds to samples by multiplying the time in seconds by the sample rate.

Re: tula's DSP modules

PostPosted: Thu Jan 18, 2018 6:54 am
by RJHollins
Thank-you Martin. 8-)

Re: tula's DSP modules

PostPosted: Thu Jan 18, 2018 9:01 am
by Spogg
Back to Bit crushers :lol:

Here is the one I made for emulating vintage digital synths, taken right out of my ASS.
I’ve added a 4 bit mode for the demo.

Based on what I’ve seen here it ain’t too clever but it gets the job done.

Cheers

Spogg

Re: tula's DSP modules

PostPosted: Thu Jan 18, 2018 11:21 am
by rocknrollkat
Spogg wrote:Back to Bit crushers :lol:

Here is the one I made for emulating vintage digital synths, taken right out of my ASS.
I’ve added a 4 bit mode for the demo.

Based on what I’ve seen here it ain’t too clever but it gets the job done.

Cheers

Spogg


Getting the job done is what counts, dubious origins notwithstanding.

ROXY :D

Re: Exponential Decay

PostPosted: Fri Jan 19, 2018 2:32 pm
by tulamide
martinvicanek wrote:Unlike linear decay, exponential decay is never really "done". So how can we assign a characteristic "decay time" in that case?

Consider the expression

a(t) = a0*exp(-t/T)

There is this time constant T which is a measure of how fast things change. If the decay continued at the initial rate, then it would be complete by the time t = T (dashed line in the image). Since the decay is exponential, however, at t = T the amplitude is still at roughly 37% of its initial value.
expoDecay.png

There are other possibilities to characterize exponential decay times. Some common examples are:
1. Half-life T_1/2 in radioactive decay. Obviously that time is shorter than T. The relation is T_1/2 ≈ 0.69*T
2. Decay to ten percent is after T_10% ≈ 2.3*T
3. In reverbs, it is common to state the time forthe reverb tail to drop to -60dB. Assuming an exponential law, that duration is T_60 ≈ 6,9*T

So you see, there is no unique definition.

My expo module has four inputs:
A: Attack, linear rise time in samples (rounded to a multiple of 16).
D: Decay, exponetial decay time T in samples (rounded to a multiple of 16). Note that decay is not to zero but to the sustainn level.
S: Sustain level, a number between 0 and 1.
R: Release, exponetial release time T in samples (rounded to a multiple of 16).

If yo prefer to supply seconds instead of samples, you can convert seconds to samples by multiplying the time in seconds by the sample rate.

Thank you Martin. I understand the problematic. With attack being linear, my first question has been answered instantly. The time advice is very important for me. Just to make sure, I'm not making a mistake:
If I would want an exponential decay towards sustain of 20 seconds (at 44.1 kHz), I'd pass 882000? Likewise, exponential release time 35 seconds, I'd pass 1543500?

Spogg
I had a look at your solution, and it is pretty much the same method I initially used. I just wonder why you have a maximum of 16 bits (32768), when Flowstone works with 32-bit floats? That means you alter the incoming signal even if no bit-reduction is chosen. But maybe that was never planned?