Modifying Sound Finder to find high frequencies?

Also, wow, the Equalization filter is a wonderfully useful tool. It’s even a great demo of “here’s what happens when you work in frequency space…”

It turns out that TAB-bing through labels is incredibly fast. It’s so fast that false positives from Sound Finder aren’t too much of an issue. And the current Notch (50,0.7) → Notch (100,0.7) → Notch (150,1.4) → Normalize (remove dc, -1db, stereo indep) → Equalization → Normalize (remove dc, -1db, stereo indep) stack is quite effective.

So labels being at the moment the only real issue, I had another look at Sound Finder and changed the minimum value of sil-dur to 0.0001. That seems to have pretty much solved it. Cutting it down very low seems to produce the desired effect of adjusting the length of Sound Finder’s dropped flags.

So, thoughts on automating the filter stack?

Edit:
Since I’m dropping the lowest part of the spectrum to ~nothing anyway using Equalize, all I really have to do is Equalize->Normalize.

But it’s looking like I still do need to find a way to set a maximum length on Sound Finder’s labels. (Looking at the file at a high zoom level, a label that continues offscreen means I miss part of the ‘found’ sound when I tab to the next label.)

Edit2:
Tried the combined filter/analysis stack against a “real” file. Total processing time is almost 20 minutes, ouch. (in fact it’s still processing…)

Edit3:
Signal Finder generated some 23,000 labels. Hmm, may have to work on the false positive thing a little bit.

If you’re in the UK, you can probably go narrower on the notch filter because the UK mains frequency is very stable.
For a notch Q of (say) 2.0 you can combine those easily:

(notch2
  (notch2
    (notch2 s 50 2)
    100 2)
  150 2)

or for a few more notches getting progressively narrower:

(dotimes (i 8)
  (let ((Hz (* (1+ i) 50))
        (Q (* (1+ i) 2)))
    (setf s (notch2 s Hz Q))))
s

Are you working in 32-bit float format?
If not, could you?

For single labels, use “Silence Finder”.
It is not really very well named - what it actually does is to detect sounds, then place the label before the sound.

If speed of processing is not important we can make it sample accurate so that it will mark the exact start of a sound.

When playing with loops and stepping through sounds, make sure that you know how to crash Audacity in case it gets stuck in a loop. In Windows you can use the Task Manager to force quit Audacity. What operating system are you using?

Fair, I was just going off the ‘Plot Spectrum’ display and guessing.
That Nyquist code is neat, good idea… something to remember. I spent a while hunting for an inverse comb filter with no luck…

32 bits:
Sure, I can work in 32 bit sample mode. The original files are mostly 24/96 anyway. (o for a 24/192 recorder…)

Silence finder:
Huh, I didn’t realize that about Silence Finder. Neat!
Audacity is a remarkably powerful suite of tools.

Loops:
I’m running it on Linux and (for plugin “development” and minor testing) Mac OS X. In both cases from the command line so I get error messages output to a terminal window, which came in very handy to see what my unfinished FFT based high frequency finder was seeing FFT-wise.

I know nothing about Macs, but I’m on Linux, so good to know that if I refer to the command line you’ll know what I’m talking about :wink:

If your sound card is reasonably good (accurate) you should be able to go pretty tight with the notch filter, which may help to clean up your low frequency display (without eliminating the low frequency signals that you want to keep).

This will allow you to easily test out different Q settings (ask if you need some code comments):

(setq initial-q 2.0)
(setq q-change-factor 1.0)

(dotimes (i 8)
  (let ((Hz (* (1+ i) 50))
        (Q (* (1+ (* q-change-factor i))
              initial-q)))
    (setf s (notch2 s Hz Q))))
s

You’re lucky. When I was working on an “advanced sound finder” effect I accidentally generated about 10 times that number :smiley:
Is there a predictable minimum gap between “sounds” or a minimum duration of “sounds” ?


How is the Equalization coming along? Do you have effective EQ settings? We can probably build that into the Nyquist plug-in when you know the parameters.

Do you just need the onset of the sounds?

There’s no minimum gap that I can tell, but there is a minimum duration of relevant sounds. Sadly I already closed out everything so I can’t get an exact answer, but it’s on the order of a few hundred samples.


How is the Equalization coming along? Do you have effective EQ settings? We can probably build that into the Nyquist plug-in when you know the parameters.

Do you just need the onset of the sounds?

Right now I do have some semi-effective EQ settings: just a high-shelf filter :slight_smile:
The parameters will probably change as I play around more with the interaction of that and Normalize + Sound Finder.

I don’t particularly care whether just the onset or the entire sound is marked, as long as the entire sound appears on screen when I hit “tab.”

(Reducing the time it takes to review a particular sound is a high-priority goal: while a particular file might max out at on the order of hundreds of “real sounds” that I’m interested in, the minimum number of sounds I’ve been able to isolate so far is about an order of magnitude higher due to what appears to be unavoidable interference from other signal sources.)

That’s easy in Nyquist, just use a high-pass filter.
For a fairly steep filter (8th order, 48 dB per octave)

(highpass8 )

for example, to high-pass the selected audio above 2 kHz

(highpass8 s 2000)

For a steeper filter you can “nest” the filters:

(highpass8 (highpass8 s 2000) 2000)

or for a less steep filter, use a lower order filter.
Available options are:

(hp s 2000)           ;6db per octave
(highpass2 s 2000)    ; 12 dB per octave
(highpass4 s 2000)    ; 24 dB per octave
(highpass6 s 2000)    ; 36 dB per octave
(highpass8 s 2000)    ; 48 dB per octave

If you don’t mind the filter ringing a bit, you could deliberately cause the filter to have a peaky response at the filter frequency as HIGHPASS2 can take an optional Q parameter. When Q is greater than about 0.7, the filter becomes steeper and the adds gain at the filter frequency, for example, try this on a few seconds of low amplitude white noise, then check the result with “Plot Spectrum”:

(highpass2 s 2000 100)

This can also be nested inside a higher order high pass filter:

(highpass8 (highpass2 s 2000 100) 2000)

Okay, I went through and generated spectra for common examples of signal, interference, and hum. Signal is blue, interference is red, and the one with just background hum should be obvious. (it’s red too)

Files in a zip:
spectra.zip (343 KB)
Web gallery that may disappear in a few months:
http://imgur.com/a/BN6U3

Edit:
Looking at the spectra, it looks like approximately (5000Hz, -70dB) and (2500Hz, -60dB) might be good distinguishing points. All the signals are above -70dB at 5000Hz, whereas /most/ examples of interference are below -70dB at 5000Hz. Same for (2500Hz,-60dB).

Now to figure out how to do this with filtering…