Hi Jonatan,
Thanks for the interesting test. Yes, it is close to
single-precision rounding differences, and it does goes away in
double precision:
faust2plot -double test5.dsp && ./test5 -n 400 > test5.m && octave
--persist test5.m
I have pushed your refinement to amp_follower in effect.lib.
Thanks!
Julius
At 01:42 AM 1/21/2015, Jonatan Liljedahl wrote:
Hi Julius,
Ok, here's a test: env2 is the alternative one.
env1(rel) = env with {
p = tau2pole(rel);
env(x) = x * (1.0 - p) : + ~ max(x,_) * p;
};
env2(rel) = env with {
p = tau2pole(rel);
env(x) = x * (1.0 - p) : (+ : max(x,_)) ~ *(p);
};
process = lfnoise(SR/20.0) <: _ * scale, env2(rel) * scale,
env1(rel)-env2(rel) with {
rel = 30.0/SR;
scale = 1e-7;
};
It outputs the input signal, the peak detector output, and the
difference between the two implementations. The first two are scaled
down by 1e-7 so we can see them at the same time when plotting..
Here's how it looks with:
faust2plot test5.dsp && ./test5 -n 400 > test5.m && octave --persist test5.m
I'm not sure what it tells, but there are some very small differences
during rising. Rounding errors?
/Jonatan
On Wed, Jan 21, 2015 at 8:47 AM, Julius Smith <j...@ccrma.stanford.edu> wrote:
> I think amp_follower came out that way because a unit-sample delay was
> needed in the comparison of y[n] to x[n] in the computation of y[n] (at
> least the way I approached it). When x is rising, it is larger than both
> y[n] and y[n-1] and there is no difference. When it is falling, it will
> normally be smaller than both y[n] and y[n-1], and again there's no
> difference. However, it could be falling slower than the release, i.e.,
> y[n] > x[n] > y[n-1] in which case there is a (normally small) difference:
> a*y[n-1]+(1-a)*x[n] versus x[n] which is slightly larger. Since releases
> are relatively slow, I cannot imagine a case where it would be audible.
> That said, I think comparing x[n] to the would-be y[n] makes more sense
> conceptually, and matches the analog case better. I'll think
about it again
> when I have time to test, etc., but feel free to beat me to it. :-)
>
> Also, thanks for the reference, and please feel free to type up
any gems you
> encounter either there or elsewhere for effect.lib.
>
> Cheers,
> Julius
>
>
> At 01:05 PM 1/20/2015, Jonatan Liljedahl wrote:
>
> Hi!
>
> Looking at the peak detector described in
>
http://www.eecs.qmul.ac.uk/~josh/documents/GiannoulisMassbergReiss-dynamicrangecompression-JAES2012.pdf
>
> It has the formula:
>
> y[n] = max(x[n], a * y[n-1] + (1-a) * x[n])
>
> Which looks exactly like in amp_follower in effect.lib, except that
> the above formula takes output and feedback from the max operator,
> while the one in amp_follower does it at the + operator:
>
> y[n] = a * max(x[n], y[n-1]) + (1-a) * x[n] // (if I read the source
> correctly...)
>
> I'm just curious, what difference does this make, if any?
>
> Cheers
> --
> /Jonatan
> http://kymatica.com
--
/Jonatan
http://kymatica.com
Content-Type: image/png; name="Screen Shot 2015-01-21 at 10.35.29 AM.png"
Content-Disposition: attachment;
filename="Screen Shot 2015-01-21 at 10.35.29 AM.png"
X-Attachment-Id: f_i56iqonr0
Julius O. Smith III <j...@ccrma.stanford.edu>
Professor of Music and, by courtesy, Electrical Engineering
CCRMA, Stanford University
http://ccrma.stanford.edu/~jos/
------------------------------------------------------------------------------
New Year. New Location. New Benefits. New Data Center in Ashburn, VA.
GigeNET is offering a free month of service with a new server in Ashburn.
Choose from 2 high performing configs, both with 100TB of bandwidth.
Higher redundancy.Lower latency.Increased capacity.Completely compliant.
http://p.sf.net/sfu/gigenet
_______________________________________________
Faudiostream-devel mailing list
Faudiostream-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/faudiostream-devel