|
|
|
03-07-2019, 07:47 AM
|
#1
|
Human being with feelings
Join Date: Dec 2018
Posts: 16
|
I don't code my own JSFX but I just need an automatic HP for a JS effect
I don't code my own JSFX yet but I'll probably end up doing so in the future as I get into it.
I'm hacking and slicing up some JSFX I like to create some plugs for my workflow.
I have a saturation style plugin that needs a high pass @ 20Hz to remove some DC offset. Can somebody recommend the best type of filter to use and the code for it? Also I don't want the highpass to be selectable, I just want it to add a 20Hz high pass automatically for the reason mentioned.
|
|
|
03-07-2019, 08:19 AM
|
#2
|
Human being with feelings
Join Date: Jul 2008
Location: The Netherlands
Posts: 3,645
|
A first order high-pass will probably suffice. However, I think I would set the cutoff a bit lower, so 20 Hz passes through more or less unaltered.
|
|
|
03-07-2019, 08:34 AM
|
#3
|
Human being with feelings
Join Date: Dec 2018
Posts: 16
|
Quote:
Originally Posted by Tale
A first order high-pass will probably suffice. However, I think I would set the cutoff a bit lower, so 20 Hz passes through more or less unaltered.
|
can you link me to any code for that? and again I would like to have it automatic in the ReaJS so its always doing its HP thing, I dont want it to be a controllable parameter
|
|
|
03-07-2019, 08:52 AM
|
#4
|
Human being with feelings
Join Date: Jul 2008
Location: The Netherlands
Posts: 3,645
|
Quote:
Originally Posted by ReubenAlfie
can you link me to any code for that? and again I would like to have it automatic in the ReaJS so its always doing its HP thing, I dont want it to be a controllable parameter
|
http://www.earlevel.com/main/2012/12...e-pole-filter/
Also, I have a high-pass filter implementation in my JSFX pack.
EDIT: Here is an example:
Code:
desc:DC blocking high-pass filter
@init
cutoff = 7.0; // Hz
b1 = exp(-2*$pi * cutoff / srate);
a0 = (b1 + 1) * 0.5;
@sample
hp0 = (spl0 - old_spl0) * a0 + hp0 * b1;
hp1 = (spl1 - old_spl1) * a0 + hp1 * b1;
old_spl0 = spl0;
old_spl1 = spl1;
spl0 = hp0;
spl1 = hp1;
Last edited by Tale; 03-07-2019 at 09:08 AM.
Reason: Added example code
|
|
|
03-07-2019, 02:56 PM
|
#5
|
Human being with feelings
Join Date: Dec 2018
Posts: 16
|
Quote:
Originally Posted by Tale
http://www.earlevel.com/main/2012/12...e-pole-filter/
Also, I have a high-pass filter implementation in my JSFX pack.
EDIT: Here is an example:
Code:
desc:DC blocking high-pass filter
@init
cutoff = 7.0; // Hz
b1 = exp(-2*$pi * cutoff / srate);
a0 = (b1 + 1) * 0.5;
@sample
hp0 = (spl0 - old_spl0) * a0 + hp0 * b1;
hp1 = (spl1 - old_spl1) * a0 + hp1 * b1;
old_spl0 = spl0;
old_spl1 = spl1;
spl0 = hp0;
spl1 = hp1;
|
thankyou so much Tale!
so the high pass is at 7Hz, so how many dB is the slope?
|
|
|
03-07-2019, 07:31 PM
|
#6
|
Human being with feelings
Join Date: Dec 2012
Posts: 7,271
|
Quote:
Originally Posted by ReubenAlfie
thankyou so much Tale!
so the high pass is at 7Hz, so how many dB is the slope?
|
First order = 6db/octave. If you think you need more than that, you put several in series, but you need to rename some of the variables so that they don't overwrite each other's "history". If you really just want to remove DC, one should be sufficient, and any cutoff greater than 0 will do it, but the lower it is, the longer it takes to settle.
|
|
|
03-16-2019, 05:07 AM
|
#7
|
Human being with feelings
Join Date: Dec 2018
Posts: 16
|
Quote:
Originally Posted by ashcat_lt
First order = 6db/octave. If you think you need more than that, you put several in series, but you need to rename some of the variables so that they don't overwrite each other's "history". If you really just want to remove DC, one should be sufficient, and any cutoff greater than 0 will do it, but the lower it is, the longer it takes to settle.
|
I experimented with the cut off, and 8Hz seems to do the job. Js Audio statistics is the balls for this kind of stuff haha
|
|
|
03-16-2019, 10:01 AM
|
#8
|
Human being with feelings
Join Date: Dec 2012
Posts: 7,271
|
You know there is a JS DC removal plugin, but it's not significantly different from what Tale posted. What saturation are you playing with? Is it causing a DC offset? If so, you should actually be able to just figure out how much and add or subtract it out. Would be slightly more efficient.
|
|
|
03-18-2019, 03:21 AM
|
#9
|
Human being with feelings
Join Date: Jul 2008
Location: The Netherlands
Posts: 3,645
|
Quote:
Originally Posted by ashcat_lt
You know there is a JS DC removal plugin, but it's not significantly different from what Tale posted.
|
Well... The stock dc_remove doesn't take the sample rate into account, so at 44.1 kHz it cuts at 7 Hz or so, but at 96 kHz it cuts at 15 Hz, which IMHO it too high.
|
|
|
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 02:03 AM.
|