|
|
|
07-15-2012, 06:22 AM
|
#1
|
Human being with feelings
Join Date: May 2006
Location: NA - North Augusta South Carolina
Posts: 4,294
|
Surfer EQ JS equivalent?
|
|
|
07-15-2012, 10:09 AM
|
#2
|
Human being with feelings
Join Date: Jan 2007
Location: mcr:uk
Posts: 3,891
|
Neat idea. I bet someone round here could make a single band pitch tracking eq. Not me though, that stuff's way over my head.
Mich, Stillwell, Justin, anyone?
|
|
|
07-15-2012, 11:46 AM
|
#3
|
Human being with feelings
Join Date: May 2009
Posts: 1,265
|
Quote:
Originally Posted by IXix
Neat idea. ...
Mich, ...
|
Well, proof of concept ... though it needs some fixing:
Code:
/* YIN pitch estimator + RBJ EQ in JS
* Copyright (c) 2012
* All rights reserved.
*
* Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
* OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
* OTHER DEALINGS IN THE SOFTWARE.
*/
/*
* TODO: needs look-ahead to compensate for YIN pitch detection
* delay
*/
desc:YIN EQ
slider1:0,Frequency (Hz)
slider2:10<5,100,1>Window Size (ms)
slider3:0,Lowest Detectable Frequency (Hz)
slider4:10<1,20,1>Threshold (%)
slider5:0<-12,12,1>Gain (dB)
slider6:1<0,2,.1>Width (Oct)
@init
x = 0;
pos = 0;
@slider
W = srate*slider2/1000;
slider3 = srate/W;
thresh = slider4/100;
A = sqrt( 10^(slider5/20) );
w0 = 2*$pi*100/srate;
tmp = log(2)/2 * Q * w0/sin(w0);
alpha = sin(w0) * (exp(tmp)-exp(-tmp))/2;
b0 = 1 + alpha*A;
b1 = -2 * cos(w0);
b2 = 1 - alpha*A;
a0 = 1 + alpha/A;
a1 = -2 * cos(w0);
a2 = 1 - alpha/A;
// normalize a0
b0 /= a0;
b1 /= a0;
b2 /= a0;
a1 /= a0;
a2 /= a0;
Q = max(slider6,0.1);
@sample
/* write sample into chunk's buffer */
x[pos] = (spl0+spl1)/2;
/* is chunk buffer completed yet ? */
(pos+=1) >= W ?
(
/* reset variables */
pos = 0;
d_sum = 0;
d_min = 1; /* running minimum, set to 1 since d'[0] = 1 */
pos_min = 0; /* position of the minimum */
below_thresh = 0;
run = 1; /* used to break out the while loop prematurely */
r=1; // don't evaluate d'[0] because it will always be 1 anyway
while(
/* 1) evaluate d[] and d'[] */
d = 0;
i = 0;
/* 1.1) do "autocorrelation" over W (EQ 1) */
loop(W,
/* for k>W x[k] = 0 */
t = x[i] - ((i+r)<W?x[i+r]:0);
d += t*t;
i+=1;
);
/* 1.2) calculate d'[r] (EQ 2) */
d_sum += d; // this is the sum from i to r over d[r]
d *= r/d_sum; // this is now d'[r]
/* 2.) track the minimum */
d < thresh ? below_thresh = 1 : // 1st time below thresh
below_thresh ? run = 0; /* in case we have been below
the thresh but are now not below the threshold
any more we have found the first minimum so we
break the loop */
d < d_min ? (minimum = r; d_min = d; );
r+=1;
r<W && run;
);
/* 3.) convert to pitch */
/* this is our pitch yay .. simple as that :) */
pitch = srate/minimum;
/* update slider with pitch value */
/* FIXME if we don't detect pitch set EQ to off instead of
this ugly bounding hack */
slider1 = max(min(pitch,srate*0.4),40);
A = sqrt( 10^(slider5/20) );
w0 = 2*$pi*slider1/srate;
tmp = log(2)/2 * Q * w0/sin(w0);
alpha = sin(w0) * (exp(tmp)-exp(-tmp))/2;
b0 = 1 + alpha*A;
b1 = -2 * cos(w0);
b2 = 1 - alpha*A;
a0 = 1 + alpha/A;
a1 = -2 * cos(w0);
a2 = 1 - alpha/A;
// normalize a0
b0 /= a0;
b1 /= a0;
b2 /= a0;
a1 /= a0;
a2 /= a0;
);
/*
TODO FIXME ref dhsg843jtefglkwerthj034t
interpolate biquad coefs, otherwise this breaks horrible
*/
tmp = spl0;
spl0 = b0 * spl0 + b1 * xl1 + b2 * xl2 - a1 * yl1 - a2 * yl2;
xl2 = xl1; xl1 = tmp; yl2 = yl1; yl1 = spl0;
tmp = spl1;
spl1 = b0 * spl1 + b1 * xr1 + b2 * xr2 - a1 * yr1 - a2 * yr2;
xr2 = xr1; xr1 = tmp; yr2 = yr1; yr1 = spl1;
/* FIXME needs clipping because of dhsg843jtefglkwerthj034t */
spl0 = max(min(spl0,1),-1);
spl1 = max(min(spl1,1),-1);
EDIT: Only tested on sine-waves. It's a CPU hog. Pitch tracking is slow. Maybe a robust peak-rate detector would suffice.
__________________
Quote:
Originally Posted by vBulletin Message
Sorry pipelineaudio is a moderator/admin and you are not allowed to ignore him or her.
|
|
|
|
07-16-2012, 12:26 PM
|
#4
|
Human being with feelings
Join Date: May 2006
Location: NA - North Augusta South Carolina
Posts: 4,294
|
It looked like someone had made something similar to it in the French Reaper forum, but I couldn't make sense of it.
Looking for a less-hoggy thing, possibly..
|
|
|
07-16-2012, 01:52 PM
|
#5
|
Human being with feelings
Join Date: Jan 2007
Location: mcr:uk
Posts: 3,891
|
Quote:
Originally Posted by Mich
Well, proof of concept ... though it needs some fixing...
|
Oh I wish I could understand how that works. I wish I understood it well enough to improve it. Damn my foggy brain!
|
|
|
07-16-2012, 11:58 PM
|
#6
|
Human being with feelings
Join Date: May 2009
Posts: 1,265
|
Quote:
Originally Posted by chip mcdonald
It looked like someone had made something similar to it in the French Reaper forum, but I couldn't make sense of it.
|
Hyperlink?
__________________
Quote:
Originally Posted by vBulletin Message
Sorry pipelineaudio is a moderator/admin and you are not allowed to ignore him or her.
|
|
|
|
07-19-2012, 02:41 PM
|
#7
|
Administrator
Join Date: Jan 2005
Location: NYC
Posts: 15,745
|
It's not exactly that, but try the JS autopeakfilter Might take a little bit of tweaking but you can get some goodness out of it.
|
|
|
07-20-2012, 05:52 PM
|
#8
|
Human being with feelings
Join Date: May 2006
Location: NA - North Augusta South Carolina
Posts: 4,294
|
Thanks, I'll investigate...
|
|
|
07-22-2012, 11:23 AM
|
#10
|
Human being with feelings
Join Date: Jan 2007
Location: mcr:uk
Posts: 3,891
|
Quote:
Originally Posted by neilerua
|
That's pretty cool. Not exactly light on CPU though.
Looks to me that it's not much different to a multiband compressor but maybe there's some advantage to doing it this way that I don't understand.
|
|
|
07-23-2012, 08:15 AM
|
#11
|
Human being with feelings
Join Date: Apr 2008
Posts: 510
|
here is something fast (and perhaps obvious), but not very good at the same time. "freq" is the target frequency, which could be automated. no peak filter included - one could use a pre-existing interpolated filter and process with the said variable as a filter parameter.
Code:
/*
pitch_detection.jsfx
lubomir i. ivanov, 2012
concept calculation of fundamental frequency based on
zero-crossing rate within a window. fast, but pretty inaccurate for
polyphonic and noisy signals.
roughly follows the idea of:
http://en.wikipedia.org/wiki/Zero-crossing_rate
usage as a "pitch detector" is slightly misleading due to contradiction
with the theory of:
http://en.wikipedia.org/wiki/Missing_fundamental
code released in the public domain without warranty of any kind.
*/
desc: zero-crossing pitch detection (for mono input)
slider1:5<0,6,1{64,128,256,512,1024,2048,4096,8192}>window size (samples)
slider2:7000<20, 22000, 1>lp filter input (Hz)
slider3:0.1<0.001, 1, 0.0001>frequency update time (ms)
slider4:0<0, 22000>* fundamental frequency (Hz)
@init
s = 0;
last_s = 0;
i = 0;
zero_cr = 0;
freq = 0;
last_freq = 0;
x = y0 = y1 = 0;
SRATE_D_1000 = srate*0.001;
INV_SRATE = 1/srate;
PI_2_INV_SRATE = 2.0*$pi*INV_SRATE;
@slider
a0_in = exp(-slider2*PI_2_INV_SRATE);
b1_in = 1 - a0_in;
a0_f = exp(-1/(slider3*SRATE_D_1000));
b1_f = 1 - a0_f;
WLENGTH = pow(2, slider1 + 6);
TM = WLENGTH * INV_SRATE;
INV_TM = 1/TM;
i = 0;
zero_cr = 0;
s = last_s = 0;
@sample
x = (spl0 + spl1) * 0.5;
y0 = b1_in*x + a0_in*y0;
y1 = b1_in*y0 + a0_in*y1;
s = y1;
(sign(s) != sign(last_s)) ?
zero_cr += 1;
last_s = s;
i += 1;
(i == WLENGTH) ? (
freq_last = (zero_cr * 0.5) * INV_TM;
freq = b1_f * freq_last + a0_f * freq;
freq = (freq + 0.5) | 0;
slider4 = freq;
sliderchange(4);
i = 0;
zero_cr = 0;
);
--
|
|
|
07-23-2012, 08:48 AM
|
#12
|
Human being with feelings
Join Date: May 2006
Location: NA - North Augusta South Carolina
Posts: 4,294
|
Quote:
Originally Posted by IXix
Looks to me that it's not much different to a multiband compressor but maybe there's some advantage to doing it this way that I don't understand.
|
I'm sort of pressed for time at the moment, so I'm not sure about Justin's suggestion yet or the link.
What I want is an eq that is *pitch* dependent on it's parametric settings. More to the point; if you're eqing a guitar sound, and there's a single note that is too honky in the low mids - I would like to be able to have that frequency cut *but only when that note happens*.
Eq is a compromise because of that. There's moments when a guitar speaker's response coincides with the guitar signal, the microphone's response, and you get "yuck", but if you eq the whole time to prevent that you end up losing what you wanted in the first place, or it sounds unnatural because you want to use a narrower Q.
For singers, that happens a lot with room sounds and there's always one note in their range that's a little different spectrally than the rest. You can automate the eq, but.. uhg...
Bass guitar in particular - this would almost be like auto-eq, because you could have someone run a chromatic scale on their setup, and on the note that causes a problem *only eq when that one note happens* instead of making the whole register sound weird. You can frequency-dependent compress it, but I don't think it would be quite the same thing (and it would be easier to setup I think).
Or maybe not, I've been rebuilding my flooded kitchen for the past month and living off of caffeine, this is the longest period in my life I've gone without recording music and I may be in a music-delirium day dreaming about something, while hammering bamboo flooring.
|
|
|
07-23-2012, 12:29 PM
|
#13
|
Human being with feelings
Join Date: Jan 2007
Location: mcr:uk
Posts: 3,891
|
Quote:
Originally Posted by chip mcdonald
if you're eqing a guitar sound, and there's a single note that is too honky in the low mids - I would like to be able to have that frequency cut *but only when that note happens*.
|
I so know what you mean. I think I may be able to set up a chain to do that.
The chain in the French thread appears to be a sort of mastering tool, similar to a multiband compressor but kinda different. Not what you're after but interesting.
/me goes off to experiment with fx chains
Quote:
Originally Posted by liteon
here is something fast (and perhaps obvious), but not very good at the same time. "freq" is the target frequency, which could be automated. no peak filter included - one could use a pre-existing interpolated filter and process with the said variable as a filter parameter.
|
I'll have some fun trying to understand that. Thanks for sharing.
|
|
|
07-23-2012, 01:32 PM
|
#14
|
Human being with feelings
Join Date: Nov 2010
Posts: 2,436
|
Quote:
Originally Posted by chip mcdonald
Eq is a compromise because of that. There's moments when a guitar speaker's response coincides with the guitar signal, the microphone's response, and you get "yuck", but if you eq the whole time to prevent that you end up losing what you wanted in the first place, or it sounds unnatural because you want to use a narrower Q.
|
If I getting it correctly, you are basically requesting a dynamic eq? I'm sure you can do it with ReaEQ and some reaper's magic. Check out this thread: http://forum.cockos.com/showthread.php?t=60311&page=2
|
|
|
07-23-2012, 01:46 PM
|
#15
|
Human being with feelings
Join Date: Nov 2009
Location: Belgium
Posts: 10,474
|
Quote:
Originally Posted by IXix
That's pretty cool. Not exactly light on CPU though.
Looks to me that it's not much different to a multiband compressor but maybe there's some advantage to doing it this way that I don't understand.
|
Ratio are constant in multiband compression
In the chain I made, The gain of EQ is completly signal dependant
We could reach same result by modulating make up gain of multiband comp
That's WHY I posted this FEATURE -> http://forum.cockos.com/project.php?issueid=3938
If cockos make it possible it would be possible to set an awesome signal dependant "multibandleveler"
you're loading REAXCOMP 1 and set it to X band
each band are routed to different channel
now you're loading REAXCOMP 2, set the same bands as reaxcomp 1
each makeup gain is modulated by the corresponding channel audio signal of Reaxcomp (or you can modulated band 9 with band 2 if you want)
I don't understand how the FR could have only 4 votes... with Reaper routing possibilities, a feature like that would make mixing experience to a completly new level...
|
|
|
07-23-2012, 01:49 PM
|
#16
|
Human being with feelings
Join Date: Jan 2007
Location: mcr:uk
Posts: 3,891
|
Try this (attached below).
There's two instances of ReaEq. The first has two linked bandpass filters to detect the frequencies you want to calm, the second instance has a single band with the freq and Q slaved to the detector. The gain of the second ReaEQ is modulated by the output from the first (on channels 3+4), so when the ugly note pops up, the gain ducks down.
It's a first attempt so you might want to experiment with the parameter modulation for the gain reduction. Play around with the input min/max, strength and the control curve to change the response.
@Breeder: I bet I just reinvented the wheel from that thread. Having done the work, I'll now go and read about how I should have done it.
@Reno: Thanks (merci!) for the excellent fx chain. I'm looking forward to seeing what it can do. I just voted for multi-output ReaXComp but it won't happen soon with just five votes .
|
|
|
07-23-2012, 01:55 PM
|
#17
|
Human being with feelings
Join Date: Nov 2009
Location: Belgium
Posts: 10,474
|
the concept is the same as mine chain with only one reaeq
using band pass as detector et send it to different channel for modulation
you can use the gain fader of reaeq for chagin the gain reduction of eq2 (if paramter modulation is set to negative)
For Only one band, you can use REAFIR for detection... a lot more precise
|
|
|
07-23-2012, 02:04 PM
|
#18
|
Human being with feelings
Join Date: Nov 2009
Location: Belgium
Posts: 10,474
|
Quote:
@Reno: Thanks (merci!) for the excellent fx chain. I'm looking forward to seeing what it can do. I just voted for multi-output ReaXComp but it won't happen soon with just five votes .
|
de rien
I think all the reaplugs muight be multi channel output... It complently make sense with reaper routing
Readelay -> each tap to different channels
Reapitch -> same idea
Reaeq -> possibility to route the allpass filter to a different channel (and reaeq will become the best little lab phase adjuster)
ReaXcomp -> I mentionned it earlier
Reaverb -> multi IN and Out per impulse file
|
|
|
07-23-2012, 02:09 PM
|
#19
|
Human being with feelings
Join Date: Jan 2007
Location: mcr:uk
Posts: 3,891
|
Quote:
Originally Posted by Reno.thestraws
the concept is the same as mine chain with only one reaeq
|
Yes, I love parameter modulation. I use it all the time! There's an FR in my sig that could use a few more votes.
Quote:
Originally Posted by Reno.thestraws
you can use the gain fader of reaeq for chagin the gain reduction of eq2 (if paramter modulation is set to negative)
|
Good one! Hadn't thought of that.
Quote:
Originally Posted by Reno.thestraws
For Only one band, you can use REAFIR for detection... a lot more precise
|
Yes, ReaFIR is very powerful plugin. Secret weapon.
|
|
|
07-24-2012, 11:13 AM
|
#21
|
Human being with feelings
Join Date: May 2009
Posts: 1,265
|
Quote:
Originally Posted by liteon
here is something fast (and perhaps obvious), but not very good at the same time.
|
Zero crossing rate is always way off from base frequency on complex signals simply because even slight noise will add multiple additional zero crossings to a base frequency zero crossing.
The better approach (which is similar) is peak rate. You don't look at the zero crossings but rather the peaks of the signal, which are much better related to the base frequency than zero crossings.
Anyway shame I can't find the code right now but I had done (a long time ago) a "multi parallel peak rate detector" which worked similarly to the js:guitar/tuner with Schmitt-Triggering. But instead of using only one trigger on one chunk it used one big chunk which was divided into little sub-chunks then the min-max computation was done on sub-chunk basis, then some weird complex algorithm to pick the right data from each sub-chunk to extract and recreate the peak rate of "virtual" peak rate detectors working with different chunk sizes and offsets ... so you basically had multiple detectors running in parallel - but they all shared a part of their processing pipeline which kept the computational overhead to a minimum.
Was nice ... but unfortunately lost.
__________________
Quote:
Originally Posted by vBulletin Message
Sorry pipelineaudio is a moderator/admin and you are not allowed to ignore him or her.
|
|
|
|
07-24-2012, 04:28 PM
|
#22
|
Human being with feelings
Join Date: Apr 2008
Posts: 510
|
Quote:
Originally Posted by Mich
Zero crossing rate is always way off from base frequency on complex signals simply because even slight noise will add multiple additional zero crossings to a base frequency zero crossing.
The better approach (which is similar) is peak rate. You don't look at the zero crossings but rather the peaks of the signal, which are much better related to the base frequency than zero crossings.
|
yep, the peak method is much better in theory.
for the zero-crossing method, linear interpolation or filtering on the resulted rates seems to help a bit. before posting the above, i've tested mixing noise with a 440Hz sine wave - both near -10dBFS (or the sine slightly higher) and it was still able to pick the 440Hz.
this however reduces the update rate...
Quote:
Anyway shame I can't find the code right now but I had done (a long time ago) a "multi parallel peak rate detector" which worked similarly to the js:guitar/tuner with Schmitt-Triggering. But instead of using only one trigger on one chunk it used one big chunk which was divided into little sub-chunks then the min-max computation was done on sub-chunk basis, then some weird complex algorithm to pick the right data from each sub-chunk to extract and recreate the peak rate of "virtual" peak rate detectors working with different chunk sizes and offsets ... so you basically had multiple detectors running in parallel - but they all shared a part of their processing pipeline which kept the computational overhead to a minimum.
Was nice ... but unfortunately lost.
|
sounds like an interesting algorithm, indeed.
--
|
|
|
07-25-2012, 06:32 AM
|
#23
|
Human being with feelings
Join Date: May 2006
Location: NA - North Augusta South Carolina
Posts: 4,294
|
Quote:
Originally Posted by Breeder
If I getting it correctly, you are basically requesting a dynamic eq? [/url]
|
No, because a dynamic eq does not discriminate what pitch is being eq'ed. You can set up a dynamic eq to almost do the same thing, but it would presume your input dynamic range was static.
|
|
|
07-25-2012, 11:58 AM
|
#24
|
Human being with feelings
Join Date: Jan 2007
Location: mcr:uk
Posts: 3,891
|
Quote:
Originally Posted by chip mcdonald
No, because a dynamic eq does not discriminate what pitch is being eq'ed. You can set up a dynamic eq to almost do the same thing, but it would presume your input dynamic range was static.
|
So my fx chain doesn't do what you want? Maybe I don't know what you're talking about after all.
|
|
|
07-25-2012, 06:45 PM
|
#25
|
Human being with feelings
Join Date: May 2006
Location: NA - North Augusta South Carolina
Posts: 4,294
|
Quote:
Originally Posted by IXix
So my fx chain doesn't do what you want? Maybe I don't know what you're talking about after all.
|
Ack, wait a moment, I've been very busy lately, let me check it out....
Ahhh, interesting.. No, sorry...
What I'm trying to describe is using *pitch* detection in the sidechain of a dynamic eq. So that, effectively for example you could have 12 different eq curves, once for each note, that would only cut/boost when that note is detected. The Surfer eq makes the center frequency "chase" the note, if I am not mistaken.
|
|
|
07-25-2012, 10:35 PM
|
#26
|
Human being with feelings
Join Date: Nov 2009
Location: Belgium
Posts: 10,474
|
|
|
|
07-26-2012, 10:19 AM
|
#27
|
Human being with feelings
Join Date: May 2006
Location: NA - North Augusta South Carolina
Posts: 4,294
|
Quote:
Originally Posted by Reno.thestraws
|
Hmm, it appears to recognize pitch based on bandpass spectral balance?
|
|
|
08-05-2012, 12:29 PM
|
#28
|
Human being with feelings
Join Date: Apr 2009
Posts: 317
|
I build a pitch tracking eq based on the works of others using synthmaker. Theres some ethic in SM forums to not just use the codes that posted others (at least without credits) and in this case i don't know if all involved coders are content to make it publically so I will not post it as vst, but you can have a look at the brilliant (REALLY BRILLIANT) pitch detection algo used by "martinvicanek"
http://synthmaker.co.uk/forum/viewto...st=0&sk=t&sd=a
Works very very smooth.
B.t.w. you can use the free synthmaker version to have a look at the code inside the module, I think.
Is it difficult to translate such things to JS?
|
|
|
08-29-2012, 08:24 PM
|
#29
|
Human being with feelings
Join Date: Jul 2012
Posts: 9
|
I didnt see this thread until now. I tried this a few weeks ago:
Find the the js midi note to cc converter (sorry cant remember the exact name) & link reaeq's band freq position to it.
It works. That is all.
|
|
|
08-30-2012, 02:29 AM
|
#30
|
Human being with feelings
Join Date: Mar 2008
Location: Unwired (probably in the proximity of Amsterdam)
Posts: 4,868
|
Well indeed, if you have already MIDI notes there's no need to track pitch (unless the sound played by the MIDI instrument is not tuned correctly), making it much easier. (I have built quite a lot of those setups myself).
__________________
˙lɐd 'ʎɐʍ ƃuoɹʍ ǝɥʇ ǝɔıʌǝp ʇɐɥʇ ƃuıploɥ ǝɹ,noʎ
|
|
|
08-30-2012, 01:13 PM
|
#31
|
Human being with feelings
Join Date: Jul 2012
Posts: 9
|
Quote:
Originally Posted by Banned
Well indeed, if you have already MIDI notes there's no need to track pitch (unless the sound played by the MIDI instrument is not tuned correctly), making it much easier. (I have built quite a lot of those setups myself).
|
I use it with complex filtering when the waveform frequencies won't behave themselves as cant be bothered to automate eq's by hand.
|
|
|
03-06-2019, 06:56 AM
|
#32
|
Human being with feelings
Join Date: Feb 2009
Location: Reaper HAS send control via midi !!!
Posts: 4,032
|
Quote:
Originally Posted by Reno.thestraws
Parameter modulation is the ultimate weapon!
|
For what?
|
|
|
Thread Tools |
|
Display Modes |
Linear Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
All times are GMT -7. The time now is 04:47 PM.
|