Hi there,
Well, I finally got the “Group EQ” plugin to work. Now I’m facing only one problem here.
So, in the code, it says:
(do* ((hz fc (+ hz fc)))
((>= hz (/ sound-srate 2)) sig)
;(format t “Frequency ~a~%” hz)
(setf sig (eq-band sig hz gain width))))
(if (= normalize 0)
(normalize (equalize S) level)
Problem is, whenever I apply this plugin, whenever the gain is set to a negative number the higher frequencies get totally muffled, and when set to positive values the higher frequencies are pretty much all that can be heard. So what I’d like to do is, change the plugin so that the gain values are 1/x for each loop. For instance, on the first time it applies an EQ, the base frequency and the base gain you typed in the edit boxes - but on the second time around, instead of using the same gain, I’d like to have it so that it’s only 1/2 the first gain. Third time being 1/3 the original gain, and so on and so on.
So what part of the code should I modify so it does this? Again, if I simply paste the code typed directly on a reply, the plugin somehow won’t work, so maybe if you just tell me what and where to change / add to the code that would be appreciated.
Please post the full code that you are having trouble with, and use the code tags ( the “</>” button) so that the code formatting is displayed correctly.
To make the effect less strong, you could use less gain (closer to 0) and/or make the bandwidth narrower (closer to zero), and/or set the centre frequency higher.
You would need to add a loop counter to the “equalize” function, like this:
and then use it in the final line of the “equalize” function, like this:
...
(setf sig (eq-band sig hz (/ gain count) width))))
Here’s the complete “equalize” function, with the modification:
(defun equalize (sig)
(do* ((hz fc (+ hz fc))
(count 1 (1+ count)))
((>= hz (/ *sound-srate* 2)) sig)
(format t "Frequency: ~a Gain: ~a~%" hz (/ gain count))
(setf sig (eq-band sig hz (/ gain count) width))))
Simple, just click the button above the message compose box that has this symbol on it: “</>”
That’s the “code” button, and it adds tags at the cursor position in the message, that look like this:
[c_o_de][/c_o_de]
Then paste your code between the two tags like this:
Hello,
Well, it’s been quite a while since I’ve posted about this plugin but as it is right now, I’m pretty happy with it.
I do have another question here though. So, what I’d like to do now is to make the plugin such that it only adjusts the odd harmonics of a frequency you’re trying to adjust. For example, instead of:
You type 100 and it adjusts 100, 200, 300, 400, etc right up to the sample rate,
I wonder if it’s possible to adjust in this case: 100, 300, 500, 700, etc, skipping the even order harmonics. How would you change the “Do” loop to do this? All it says is:
(do* ((hz fc (+ hz fc)))
((>= hz (/ sound-srate 2)) sig)
;(format t “Frequency ~a~%” hz)
There is no indication of counting or any such “1+” something. I try putting a “2” somewhere in the code but it only still counts by 1 * the frequency, like the harmonics of a sawtooth wave. Basically, a way to adjust the square wave of whatever frequency. I reckon it’s just something in the “do” loop line’s code? Please help me if I’m wrong.
Thanks.
So that is adding 100 on each loop, where “fc = 100”.
(do* ((hz fc (+ hz fc))
and that is adding 200 on each loop, where “fc = 100”.
(do* ((hz fc (+ hz (* 2 fc)))
or to make it a bit more efficient, we could calculate 2 x fc before entering the loop, rather than calculating 2 x fc each time we go around the loop:
Hi,
So I’ve been satisfied with the Group Notch plugin, but I want to modify it so that it notches out the odd harmonics and only the odd harmonics.
I spent the whole day yesterday just trying to figure it out and I’ve gotten absolutely NOWHERE!!! HELP PLEASE!!!
Yes, I know about that one, but that has the number of harmonics that you enter. This one goes right up to half the sample rate without you having to guess how many notches to do it, and I prefer that kind where it goes right up to half the sample rate.
The one I use now does all the even order harmonics, I’m just trying to think what I should modify the code in order for it to just notch out only the odd harmonics using this same plugin code. I’ve spent all day trying to figure it out, and I could never get it to work! I thought it might have something to do with the “1+ i”, but changing that also didn’t make it work. I typed “+ freq freq” instead of just “freq” (after the *), and still nothing. Any suggestions?
I see what you’re saying, but I honestly do NOT like having to control how many iterations! I don’t know if you saw the code for the plugin I’m talking about so I’ll paste it here. I only want to modify this one if it can be possible.
;nyquist plug-in
;version 1
;type process
;name “Group notch”
;action “Removing harmonics, ( this may take some time ) …”
;control freq “Frequency” real “” 60 0.1 24000
;control tightness “Width” real " higher is more" 10 1 1000
(setq iter (truncate (/ sound-srate 2 freq)))
(defun notch (s freq tightness iter)
(dotimes (i iter s)
(setf s (notch2 s (* freq (1+ i)) (* tightness (1+ i))))))
(if (arrayp s)
(vector (notch (aref s 0) freq tightness iter)
(notch (aref s 1) freq tightness iter))
(notch s freq tightness iter))
I can predict that this code won’t be correct at all, so I’d love to have corrections. Keep in mind I absolutely suck at Nyquist and haven’t had any training on it yet. I also think it would be nice to add a Q feature, and with this Q feature as the harmonics go up the Q number goes up.
Essentially, if it’s possible to notch out just the odd harmonics with the plugin I attached, that’s fine for me. I tried modifying this Hum remover to automatically loop it until the end of the sample rate.
Why isn’t it simpler than having to re-edit the Hum remover?
;nyquist plug-in
;version 3
;type process
;categories "http://lv2plug.in/ns/lv2core/#FilterPlugin"
;name "Note Remover"
;action "Filtering...."
;info "By Steve Daulton. http://audacity.easyspacepro.com\nReleased under GPL v2 Dec. 2009\n\nFor Audacity 1.3.8 or later.\n\n"
;control basef "Base frequency" real "" 50 10 100
;control odd "Number of odd Harmonics" int "" 20 0 200
;control even "Number of even Harmonics" int "" 1 0 20
(setq floor 0.00002)
(setq thresh (/ (sanitise thresh 0 100) 100.0))
(setq attack 0.25)
(setq look attack)
(defun dehum (s-in itr itr2)
(dotimes (var itr s-in)
(setq s-in
(notch2 s-in (> (* basef (1+ (* even 2.0))) (/ *sound-srate* 2.0))
(dotimes (var itr2 s-in)
(setq s-in
(notch2 s-in (> (* basef (1+ (* odd 2.0))) (/ *sound-srate* 2.0))
; left/right tracks linked for gate-follow to prevent left/right wobble
(defun gate-follow (s-in)
(setq s-in (hp s-in 20)) ; hp filter to remove DC off-set
(if (arrayp s-in) ; if stereo track
(s-max (s-abs(aref s-in 0))(s-abs(aref s-in 1)))
(s-abs s-in)))
(setq gatefollow (gate-follow s)) ; audio for gate to follow
; gate envelope tracks gate-follow
(setq g-env
(clip (gate gatefollow look attack attack floor thresh) 1.0))
(defun noisegate (s-in env)
(mult s-in env))
(defun residual (s-in env)
(mult s-in (sum 1.0 (mult -1 env))))
(sim
(multichan-expand #' noisegate s g-env)
(dehum (multichan-expand #' residual s g-env) odd even)))
The above code can be run in the Nyquist prompt.
To turn this into an installable plug-in, you just need to add the other required headers (see: Missing features - Audacity Support)
Here is a commented version of the above, which explains how the code works:
;version 4
;type process
(setf base-hz 50) ;Initial notch frequency
(setf base-q 2.0) ;Initial notch Q
(setf max-hz (/ *sound-srate* 2)) ;Nyquist frequency
(do* ((j 1 (+ 2 j)) ;increase hz by (base-hz x 2) each time for odd harmonics
(hz base-hz (* base-hz j))
(q base-q (+ 1 q))) ;increase Q by +1 each time.
((>= hz max-hz) *track*) ;stop when hz is too high, and return *track*
(format t "hz: ~s q: ~s~%" hz q) ;to see values in debug window
(setf *track* (notch2 *track* hz q))) ;apply the filter (again)
I get this stupid f**ng ERROR!!! HELP PLEASE!!!
The Debug window says:
Nyquist
Nyquist Output:
error: illegal character - -62
1> error: illegal character - -96
I’m trying to get this code to work in Audacity 2.0.6, because if I run 2.1.3, some plugins are actually missing. All the plugins appear in 2.0.6.
This is the code I tried modifying but ended up with this uncurable bug.
;control freq “Frequency” real “” 60 0.1 24000
;control tightness “Width” real " higher is more" 10 1 1000
(setq iter (truncate (/ sound-srate 2 freq)))
(defun notch (s freq tightness iter)
(do* ((j 1 (+ 2 j)) ;increase hz by (freq x 2) each time for odd harmonics
(freq (* freq j))
(tightness (+ 1 tightness))) ;increase Q by +1 each time.
(if (arrayp s)
(vector (notch (aref s 0) freq tightness iter)
(notch (aref s 1) freq tightness iter))
(notch s freq tightness iter))