Pages

Thursday 28 August 2014

PAMGuard Whistle/Moan Detector Tutorial

The following is a basic approach to processing previously collected acoustic data using the free software PAMGuard.

PAMGuard is, by far, one of the most powerful tool available to process acoustic data. It is also, by far, one of the least user friendly tools available to process acoustic data. 

Since I will be using it almost exclusively in my PhD, I've made a handy tutorial for for myself to refer back to. If you are looking for professional advice, contact the (amazing) crew over at SMRU/SMRU marine directly and they should be able to help you. 
_____________________________________________________________________

1. Open PAMGuard
2. Create a new PAMGuard Settings File (*.psf) and name it "Whistle Detector"



3. Click OK to the PAMGuard settings dialog box (You are opening [a] new configureation file...)

You now have a blank PAMGuard application which is similar to a new R session in that, in there is nothing there. Modules are the basic building blocks of the sound analysis procedure and they need to be added individually.

You will now need to set up all the modules that will allow you to import and process your data.

3. You will need to add the following modules (File>>AddModules)




From Sound Processing Menu
  • Sound Acquisition
  • Decimator (if sample rate of the sound is greater than 48kHz)
  • FFT (Spectrogram)
From Detectors Menu
  • Whistle and Moan Detector
From Display Menu
  • User Display
________________________________________________________________________

Now that you have the modules you will need to string them together to do the following:

Read the sound file-> Downsample/decimate (if necessary)->create a spectrogram->run the whistle and moan detector

Read in the sound file

  • Select Settings> Sound Acquisition
Under the Data Source Type select Audio File

Hit the Select File radio button to navigate to your example file



For this example I'm using the Bearded Seal example that comes with the Raven Software demo.  Mostly because they make one of the coolest sounds ever. Eat your heart out star wars fans.
_______________________________________________________________________________

Skip to the next set of steps if using Bearded Seal example  

Downsample/decimate (if necessary)

If the sample rate of your file is greater than 48 kHz, you will want to decimate the data prior to sending it through the system. Unless you are trying to get moan contours for something above 24 kHz. This is mostly for processing time.

If your sample rate is less than 48kHz then remove the decimator if you added it.
  • Select Settings> Decimator
In the drop down menu select Raw input data from Sound Acquisition
Output sample rate 48000 Hz





Then select Filter settings radio button
Filter type dropdown button select IIR Butterworth (IIR stands for Infinite Impulse Response if you were wondering)

Select Low Pass Filter Response

Low Pass frequency 22000 Hz
Filter order 6

_________________________________________________________________________________

Create a Spectrogram

Spectrograms are created by taking the Fourier transform of waveform data and PAMGuard doesn't automatically do this like many other sound processing software packages (hence the need to add the module)

To set up the FFT generator

  • Select Settings> FFT Parameters
If you are using decimated data select Decimator Data from the dropdown button. Otherwise select Raw input data from Sound Acquisition

Your FFT Parameters should be as follows:
  • Select all sound channels Channel 0
  • FFT Length 512
  • FFT Hop 256
  • Window Hamming


If you are running this on dolphin data you will need to remove the echolocation clicks. Not sure what will happen if you run this on data without echolocation clicks, so user beware.

If dolphin data select Click Removal Tab
Check the Suppress clicks  box


Don' mess with anything else.

For the whistle and moan detector to work, you will need to "clean" the data by removing ambient noise.

Select Spectral Noise Removal tab in the FFT Parameters window
Check all boxes (Run Median filter, Run Average Subtraction, Run Gaussian Kernal Smoothing, Run Thresholding)


Almost done, I promise.
_____________________________________________________________________

Run the whistle and moan detector


  • Select Settings> Whistle and Moan Detector
You shouldn't have to mess with too many settings here. If you have a lot of low frequency noise you might want to consider setting the Min Frequency (under Connections) to something above the noise floor (say 2kHz)

Make sure a Channel is selected


Push Ok
________________________________________________________________________

Now you are ready to go (Almost!)

Just need to set up a User Display to check that the whistle and moan detector is working correctly. 
In the main PAMGuard window

Select User Display>>New Spectrogram

This will open a Spectrogram Parameters Window

In the Data Source drop-down box select

Whistle and Moan Detector Noise reduction-Whistle and Moan Detector Noise free FFT data

If your data only has one channel (1 microphone) then change the Number of Panels to 1





Select OK

This will open up a blank spectrogram in the User Display tab on the main PAMGuard window.

Right click in the spectrogram window to select Whistle and Noise Connected Regions

This will show you what PAMGuard is identifying as whistles and moans.

Ready to go!! Yay!!!
_________________________________________________________________________________

Now press the big red button at the top of the PAMGuard window. Colored lines should show up on what the algorithm thinks is a whistle or a moan. You should get something like this

For the moment I won't go into exporting data but stay tuned or drop me a line if anyone would like this sooner rather than later.



Thanks for reading, hope you find this helpful!






No comments:

Post a Comment

Comment forum rules.
1. Be accurate
2. Cite your sources
3. Be nice

Comments failing to meet these criteria will be removed