Thanks Giuseppe,
I checked it out, but somehow it still does not give me the desired
result...
I did some more research and found this, which indicates that it can be
done with arctan more easily.
> The way this is done on phase (correlation) meters in audio equipment
> is rather simple:
>
> Phase = arctan(L/R)
>
> With phase of 45 or 225 = 1, and phase of 135 and 315 (-45) is -1.
>
> Essentially, the Y Axis is the L, and the X axis is the R. The phase
> is simply the polar angle of the vector between the two.
>
> This type of meters will show 1 if the signal is mono, and -1 if the
> left and right are perfectly phase inverted.
>
> Notice however, that phase meters of this type also account for the
> magnitude in the polar coordinates. So:
>
> Magnitude = (L^2 + R^2)^1/2
>
> Thus the actual meter display is a normalised version of:
>
> Correlation = Phase * Magnitude
>
> I'm not sure that satisfies your requirements, but this answers the
> question in the subject.
>
So I transfered this to faust, but it still behaves weired...
import("stdfaust.lib");
phase(l,r)= (l/r):aa.arctan;
magnitude(l,r)= (l^2+ r^2)^1/2;
correlate(l,r)= phase(l,r)* magnitude(l,r);
correlate_meter(x,y)=
x,y<:x,attach(y,(correlate:hbargraph("corr",-1,1))):_,_;
process= _,_:correlate_meter:_,_;
Any ideas?
Klaus
On 03.08.21 14:48, Giuseppe Silvi wrote:
> Hi Klaus,
> The filters are necessary to obtain a -1 +1 range, I think.
>
> import("stdfaust.lib");
>
> correlate(l,r) = l*l ,r*r , l*r : par(i,3, si.smooth(0.9)) : sqrt, sqrt, _ :
> *,_ : /;
> correlate_meter(x,y) = x,y <: x , attach(y, (correlate :
> hbargraph("corr”,-1,1)));
>
> process = correlate_meter;
>
> Try playing with the si.smooth coefficient.
>
> best,
> giuseppe
>
>> On 3 Aug 2021, at 14:09, Klaus Scheuermann <[email protected]> wrote:
>>
>> Could it be something like this?
>>
>> (according to the 'correct' algorithm in
>> https://www.beis.de/Elektronik/Correlation/CorrelationCorrectAndWrong.html )
>> import("stdfaust.lib");
>>
>> correlate(l,r) = l*l ,r*r , l*r : sqrt, sqrt, _ : *,_ : / :_;
>> correlate_meter(x,y) = x,y <: x , attach(y, (correlate :
>> hbargraph("corr",-1,1))) : _,_;
>>
>> process = _,_ : correlate_meter: _,_;
>>
>> I am not sure about the lowpass filters though. Maybe not needed in the
>> digital domain?
>>
>> Also, my code only returns -1 or 1 while it should be returning a range of
>> -1 and 1, right?
>>> The correlation is either expressed in % from -100% to +100% or as the
>>> correlation factor, which ranges from -1 to +1. Note that due to the
>>> correlation algorithm the level of both signals does not matter, i.e., it
>>> does not influence the measured result.
>>>
>>> When a mono source is used for a stereo signal both stereo channels will be
>>> +100% correlated. When e.g. in a stereo signal both channels contain
>>> completely different signals, e.g. left (and only left) is the trumpet and
>>> right (and only right) is the guitar these stereo channels will be 0%
>>> correlated. With a third instrument appearing in both channels, the
>>> correlation will be somewhere between 0 and +100%.
>>>
>> Ideas?
>> Danke :)
>> Klaus
>>
>>
>>
>>
>> On 03.08.21 12:48, Klaus Scheuermann wrote:
>>> Hello List,
>>>
>>> I just wondered, if anyone has implemented a stereo audio correlation
>>> meter/analyser in faust?
>>>
>>> If yes - great!
>>> If no - I have another project :)
>>>
>>> Here is what I found about the algorithm(s):
>>>
>>> https://www.beis.de/Elektronik/Correlation/CorrelationCorrectAndWrong.html
>>>
>>>
>>> I never learned analog electronic schematics, but it seems it should not
>>> be extremely hard to transfer to faust.
>>>
>>> Cheers, Klaus
>>>
>>>
>>>
>>> _______________________________________________
>>> Faudiostream-users mailing list
>>>
>>> [email protected]
>>> https://lists.sourceforge.net/lists/listinfo/faudiostream-users
>> _______________________________________________
>> Faudiostream-users mailing list
>> [email protected]
>> https://lists.sourceforge.net/lists/listinfo/faudiostream-users
_______________________________________________
Faudiostream-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/faudiostream-users