Notch filter with loop

Using Nyquist scripts in Audacity.
Post and download new plug-ins.
Forum rules
If you require help using Audacity, please post on the forum board relevant to your operating system:
Windows
Mac OS X
GNU/Linux and Unix-like
steve
Site Admin
Posts: 49038
Joined: Sat Dec 01, 2007 11:43 am
Operating System: Linux *buntu

Re: Notch filter with loop

Post by steve » Wed May 09, 2018 11:41 pm

OK, I see the problem - you're using the downloadable version, but I uploaded the wrong file. I've now updated the file so here it is again:
http://forum.audacityteam.org/download/ ... p?id=20305

If you want to print a list of frequencies, find the line:

Code: Select all

;(format t "Frequency ~a~%" hz)
and remove the semicolon from the start of the line (and use NotePad++ )

Note also that if there are a lot of harmonics and a lot of gain per harmonic, there may be numerical overflow and the output will be corrupt.
9/10 questions are answered in the FREQUENTLY ASKED QUESTIONS (FAQ)

Michael Kazmierski
Posts: 76
Joined: Wed Aug 17, 2016 1:06 am
Operating System: Windows 10

Re: Notch filter with loop

Post by Michael Kazmierski » Sat Aug 04, 2018 11:45 pm

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.

Thanks


Michael

steve
Site Admin
Posts: 49038
Joined: Sat Dec 01, 2007 11:43 am
Operating System: Linux *buntu

Re: Notch filter with loop

Post by steve » Mon Aug 06, 2018 9:49 pm

Michael Kazmierski wrote:
Sat Aug 04, 2018 11:45 pm
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)
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.
9/10 questions are answered in the FREQUENTLY ASKED QUESTIONS (FAQ)

Michael Kazmierski
Posts: 76
Joined: Wed Aug 17, 2016 1:06 am
Operating System: Windows 10

Re: Notch filter with loop

Post by Michael Kazmierski » Wed Aug 08, 2018 2:23 pm

Well I guess I don't really know how to do that. So let me attach it instead.
Attachments
Groupeq.ny
(1.71 KiB) Downloaded 10 times

steve
Site Admin
Posts: 49038
Joined: Sat Dec 01, 2007 11:43 am
Operating System: Linux *buntu

Re: Notch filter with loop

Post by steve » Wed Aug 08, 2018 3:27 pm

Michael Kazmierski wrote:
Sat Aug 04, 2018 11:45 pm
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.
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.
Michael Kazmierski wrote:
Sat Aug 04, 2018 11:45 pm
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.
You would need to add a loop counter to the "equalize" function, like this:

Code: Select all

(defun equalize (sig)
  (do* ((hz fc (+ hz fc))
        (count 1 (1+ count)))
      ...
and then use it in the final line of the "equalize" function, like this:

Code: Select all

...
(setf sig (eq-band sig hz (/ gain count) width))))
Here's the complete "equalize" function, with the modification:

Code: Select all

(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))))
Michael Kazmierski wrote:
Wed Aug 08, 2018 2:23 pm
Well I guess I don't really know how to do that
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:

[code][/code]

Then paste your code between the two tags like this:

[code]
Code goes here...
[/code]
9/10 questions are answered in the FREQUENTLY ASKED QUESTIONS (FAQ)

Post Reply