USB Whine FIltering (Yeti Curse)

Effects, Recipes, Interfacing with other software, etc.
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
kozikowski
Forum Staff
Posts: 69374
Joined: Thu Aug 02, 2007 5:57 pm
Operating System: macOS 10.13 High Sierra

USB Whine FIltering (Yeti Curse)

Post by kozikowski » Fri May 05, 2017 3:06 am

The Nyquist notch suite "MultiNotch" was designed to pull out the USB data management audio interference that can affect affordable USB microphones and some other simple USB devices. This particular filter suite affects 1000Hz, 2000Hz, 3000Hz, and 4000Hz, the most audible and objectionable of the USB tones.

Code: Select all

(notch2
  (notch2
    (notch2
      (notch2 *track* 4000 50)
      3000 40)
    2000 30)
  1000 20)
It's simple (too simple—no housekeeping) and remarkably effective.

-- Why does the Quality or "Q" of the filters go up with frequency?

--Why would I need anything else, given I may need higher frequencies if the noise is severe? There is posted a much more complex Nyquist method of USB filtering with do loops, setq iter, etc. It's elegant and well laid out, but doesn't work.

Koz

Trebor
Posts: 9954
Joined: Sat Dec 27, 2008 5:22 pm
Operating System: Windows 8 or 8.1

Re: USB Whine FIltering (Yeti Curse)

Post by Trebor » Fri May 05, 2017 4:22 am

Plug-in version of above code attached ...
Attachments
Mosquito-Killer.ny
(253 Bytes) Downloaded 66 times

kozikowski
Forum Staff
Posts: 69374
Joined: Thu Aug 02, 2007 5:57 pm
Operating System: macOS 10.13 High Sierra

Re: USB Whine FIltering (Yeti Curse)

Post by kozikowski » Fri May 05, 2017 4:50 am

I assume the authorship is in alphabetic order since I didn't have anything to do with the code past gaze at it.

"version" was in my list of questions. I know what it means now, I didn't know what the appropriate number was.

Where do you put revision or date?

Is there an acoustic or filter behavior reason the Q goes up with frequency and how is that chosen? I always thought Q was a relationship of the frequencies affected and changed naturally.

Koz

kozikowski
Forum Staff
Posts: 69374
Joined: Thu Aug 02, 2007 5:57 pm
Operating System: macOS 10.13 High Sierra

Re: USB Whine FIltering (Yeti Curse)

Post by kozikowski » Fri May 05, 2017 4:53 am

Where do you put revision or date?
info;
??

Koz

Trebor
Posts: 9954
Joined: Sat Dec 27, 2008 5:22 pm
Operating System: Windows 8 or 8.1

Re: USB Whine FIltering (Yeti Curse)

Post by Trebor » Fri May 05, 2017 5:43 am

kozikowski wrote:Is there an acoustic or filter behavior reason the Q goes up with frequency and how is that chosen?
Q is related to bandwidth. If the Q value was constant, the notch would get wider as the frequency increased.

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

Re: USB Whine FIltering (Yeti Curse)

Post by steve » Fri May 05, 2017 8:23 am

kozikowski wrote:Where do you put revision or date?
You can add any information you like as "comments", provided that you begin each comment line with a semicolon.

Most computer languages support "comments" (some languages call them "remarks"), as a way to annotate the code for the benefit of humans. This is most commonly achieved by adding a special character, or series of characters, to the start of the line before the comment.

General idea: When running the code, the computer disregards comments.
More precisely: The compiler / assembler / interpreter (depending on the computer language) disregards comments.

The Nyquist language uses a semicolon as its special "this is comment" character.

Example:

Code: Select all

; This line is ignored
;so is this
;;;;; and this
      ;   and this

(hzosc 440)    ; the first part of this line is run by Nyquist, but  everything after the semicolon is ignored

; The code at  the end of this line will be ignored because this line is "commented out" (hzosc 1000)

"Special" comments.

Audacity/Nyquist plug-in code has a number of "special" comments. As with all other Nyquist comments, they are ignored entirely by the Nyquist interpreter, but are read and used by Audacity. These are the "header" comments.

Header comments should be placed at the top of the script, and need to comply exactly with the specified form (syntax) described in the documentation. If the syntax is incorrect (but the line does begin with a semicolon), then it is treated as a regular "comment" - it is disregarded.
kozikowski wrote:info;
??
Many years ago there was an info "header".
The syntax was:

Code: Select all

;info "one line of quoted text" 
This header is now obsolete and treated by Audacity and Nyquist as an ordinary comment. That is, the line is disregarded.
In some obsolete versions of Audacity, the "info text" was displayed near the top of the plug-in GUI.
9/10 questions are answered in the FREQUENTLY ASKED QUESTIONS (FAQ)

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

Re: USB Whine FIltering (Yeti Curse)

Post by steve » Fri May 05, 2017 9:13 am

kozikowski wrote:It's elegant and well laid out, but doesn't work.
The effectiveness of notch filtering depends on:
  1. The sounds to be removed have constant frequency
  2. The centre frequency of the notches match the frequencies that we wish to remove
The narrowness (Q factor) is about two things: (a) factoring in a 'fuzz factor', (b) damage limitation.
  1. A true notch filter is virtually "infinitely deep" at its centre frequency. That is, at that frequency the attenuation is total. However, in real life we are unlikely to know the "exact" frequency. If the notch is extremely narrow, then a small error in determining the required frequency, or a small frequency change in the sound that we want to remove, will have a big impact on the effectiveness of the filter. A wide notch spreads the net wider and provides a good amount of attenuation for a broader range of frequencies.
  2. If the notch is wider than required, we will be attenuating parts of the "good" sound in addition to the "bad" sound. On the other hand, the narrower the notch, the more the filter will "ring". Ringing is not a problem for constant unchanging sounds, but can be a problem when the energy within the notch frequency band changes. The narrower the notch, the more it will ring, so the bigger the problem if the amplitude within the filter band changes. So in practice, setting the Q is a compromise: as narrow as possible but not too narrow.
kozikowski wrote:Is there an acoustic or filter behavior reason the Q goes up with frequency
As Trebor wrote, Q is related to bandwidth, where "bandwidth" is defined as a ratio (for example, as "octaves"). One octave either side of 50 Hz are 25 Hz and 100 Hz - a spread of only 75 Hz. One octave either side of 4000 Hz are 2000 Hz and 8000 Hz, a spread of 6000 Hz. If we want to specify a notch as, for example, "frequency +/- 100 Hz", then at low frequencies the notch can be very "broad" (as a ratio), but for high frequencies it would need to be extremely narrow.
9/10 questions are answered in the FREQUENTLY ASKED QUESTIONS (FAQ)

kozikowski
Forum Staff
Posts: 69374
Joined: Thu Aug 02, 2007 5:57 pm
Operating System: macOS 10.13 High Sierra

Re: USB Whine FIltering (Yeti Curse)

Post by kozikowski » Fri May 05, 2017 11:22 am

kozikowski wrote:
It's elegant and well laid out, but doesn't work.


The effectiveness of notch filtering depends on:

The sounds to be removed have constant frequency
The centre frequency of the notches match the frequencies that we wish to remove
I don't mean it doesn't work very well. I mean it returns an error code.
; This line is ignored
;so is this
;;;;; and this
; and this
We are warned in the instructions against using multiple sequential semis in Audacity code. They can't both be right.

Koz

kozikowski
Forum Staff
Posts: 69374
Joined: Thu Aug 02, 2007 5:57 pm
Operating System: macOS 10.13 High Sierra

Re: USB Whine FIltering (Yeti Curse)

Post by kozikowski » Fri May 05, 2017 11:29 am

So in practice, setting the Q is a compromise:
So is an affordable microphone. I'm clear we are choosing graceful sound damage against immediate, objectionable sound damage.

Koz

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

Re: USB Whine FIltering (Yeti Curse)

Post by steve » Fri May 05, 2017 11:34 am

kozikowski wrote:We are warned in the instructions against using multiple sequential semis in Audacity code.
Where?

The "special" Header lines, must comply exactly with the specified form (syntax) described in the documentation.

Ordinary comments may have any text characters after the first semicolon, because what ever comes after the first semicolon is disregarded.

Perhaps you can suggest clearer wording for the green box text and first paragraph here: http://wiki.audacityteam.org/wiki/Nyqui ... -in_Header
9/10 questions are answered in the FREQUENTLY ASKED QUESTIONS (FAQ)

Post Reply