Answers.Body: <p>There are several generic audio classifier models that could be used to detect wind noise. For example, the AudioSet ontology includes the class <a href="http://research.google.com/audioset/ontology/wind_1.html" rel="nofollow noreferrer">Wind</a>, and also the subclass <a href="http://research.google.com/audioset/ontology/wind_noise_microphone_1.html" rel="nofollow noreferrer">Wind noise (Microphone)</a>. There are several pre-trained models available that do AudioSet classification, with pretty good performance overall and are easy to use. Examples include <a href="https://github.com/qiuqiangkong/audioset_tagging_cnn/tree/master" rel="nofollow noreferrer">PANNs</a> and <a href="https://tfhub.dev/google/yamnet/1" rel="nofollow noreferrer">YAMNet</a>.</p>
  <p>If the performance of those models are not satisfactory out-of-the-box, it is possible to make a model specifically on your data. This would require to annotate a smaller amount of your data with windy/not. Some minutes of data might be enough, though one would have to make sure to cover all the variation that exists in the dataset.</p>
  <p>With such a dataset, one would use the pretrained audio models to extract a vector embedding from the audio, and then train a small/simple classifier on these vectors.
  For that approach, one can also use vector embedding models such as <a href="https://github.com/marl/openl3" rel="nofollow noreferrer">OpenL3</a>.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2023-06-25T15:09:26.733Z
Answers.Text: Thakns Jon, this comment was really useful. I'm now trying the methods that you suggested. Let's see!
Answers.UserDisplayName: fterranova
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2023-06-18T21:47:33.447Z
Answers.LastActivityDate: 2023-06-18T21:47:33.447Z
Answers.UserDisplayName: Jon Nordby
Answers.Body: <p>I propose a much simpler solution for cleaning your dataset. After looking at some of your windy files it is very apparent that there are 2 things that stick out to me compared to the non-windy files.</p>
  <ul>
  <li>The number of times the audio clips per file.</li>
  <li>The power/energy in the frequency bins below 550 Hz.</li>
  </ul>
  <p>My approach for cleaning your dataset would be to do two things:</p>
  <ul>
  <li>Count the number of times the audio file clips.</li>
  <li>Compute the power spectrum for each file and sum up the power in the frequency bins from 1-550 Hz.</li>
  </ul>
  <p>You can easily see that files which have a high number of clips/file and at the same time a lot of power in the lower frequency bands are the ones that are most likely containing a lot of wind (see results below).</p>
  <p>You could implement a small script running through all of your files, computing the above mentioned values in any programming language such as Python, Matlab, R, ...</p>
  <h2>Matlab Code</h2>
  <pre><code>fname = '/path/to/file.wav';
  
  [y,fs] = audioread(fname);
  
  n_clip = length(find(y&gt;0.95));
  
  window_fct = hamming(floor(length(y)/128));
  overlap = 0.9;
  nfft = 2^16;
  
  [pxx,fx] = pwelch(y,window_fct,floor(overlap*length(window_fct)),nfft,fs);
  pxx = 10*log10(pxx);
  
  fx_relevant = find(fx&lt;550);
  
  P_below_550 = sum(pxx(fx_relevant));
  </code></pre>
  <h2>Results</h2>
  <div class="s-table-container">
  <table class="s-table">
  <thead>
  <tr>
  <th>File path</th>
  <th>Audio &gt; 0.95</th>
  <th>Power &lt; 550 Hz</th>
  </tr>
  </thead>
  <tbody>
  <tr>
  <td>&quot;/tmp/biostack/STP03_20230328_1950362_nowind_eds.wav&quot;</td>
  <td>2</td>
  <td>-62843</td>
  </tr>
  <tr>
  <td>&quot;/tmp/biostack/STP03_20230328_1950363_nowind_eds.wav&quot;</td>
  <td>0</td>
  <td>-61881</td>
  </tr>
  <tr>
  <td>&quot;/tmp/biostack/STP03_20230328_1950364_nowind_eds.wav&quot;</td>
  <td>0</td>
  <td>-61739</td>
  </tr>
  <tr>
  <td>&quot;/tmp/biostack/STP03_20230328_195036_nowind_eds.wav&quot;</td>
  <td>0</td>
  <td>-62573</td>
  </tr>
  <tr>
  <td>&quot;/tmp/biostack/STP03_20230329_19300210_nowind_eds.wav&quot;</td>
  <td>82</td>
  <td>-51638</td>
  </tr>
  <tr>
  <td>&quot;/tmp/biostack/STP03_20230329_1930025_nowind_eds.wav&quot;</td>
  <td>601</td>
  <td>-43343</td>
  </tr>
  <tr>
  <td>&quot;/tmp/biostack/STP03_20230329_1930026_nowind_eds.wav&quot;</td>
  <td>316</td>
  <td>-45589</td>
  </tr>
  <tr>
  <td>&quot;/tmp/biostack/STP03_20230329_1930027_nowind_eds.wav&quot;</td>
  <td>0</td>
  <td>-60587</td>
  </tr>
  <tr>
  <td>&quot;/tmp/biostack/STP03_20230329_1930028_nowind_eds.wav&quot;</td>
  <td>0</td>
  <td>-58075</td>
  </tr>
  <tr>
  <td>&quot;/tmp/biostack/STP03_20230329_1930029_nowind_eds.wav&quot;</td>
  <td>0</td>
  <td>-61481</td>
  </tr>
  <tr>
  <td>&quot;/tmp/biostack/STP06_20230225_1930022_windy_noeds.wav&quot;</td>
  <td>1147</td>
  <td>-35458</td>
  </tr>
  <tr>
  <td>&quot;/tmp/biostack/STP06_20230225_1930023_windy_noeds.wav&quot;</td>
  <td>1224</td>
  <td>-34735</td>
  </tr>
  <tr>
  <td>&quot;/tmp/biostack/STP06_20230225_1930024_windy_noeds.wav&quot;</td>
  <td>1137</td>
  <td>-34696</td>
  </tr>
  <tr>
  <td>&quot;/tmp/biostack/STP06_20230225_193002_windy_noeds.wav&quot;</td>
  <td>490</td>
  <td>-36425</td>
  </tr>
  <tr>
  <td>&quot;/tmp/biostack/STP06_20230226_0500024_windy_eds.wav&quot;</td>
  <td>7146</td>
  <td>-30641</td>
  </tr>
  <tr>
  <td>&quot;/tmp/biostack/STP06_20230226_0500025_windy_eds.wav&quot;</td>
  <td>4020</td>
  <td>-31998</td>
  </tr>
  <tr>
  <td>&quot;/tmp/biostack/STP06_20230301_0530026_windy_eds.wav&quot;</td>
  <td>488</td>
  <td>-36449</td>
  </tr>
  <tr>
  <td>&quot;/tmp/biostack/STP06_20230301_0530027_windy_eds.wav&quot;</td>
  <td>483</td>
  <td>-36905</td>
  </tr>
  <tr>
  <td>&quot;/tmp/biostack/STP06_20230301_0530028_windy_eds.wav&quot;</td>
  <td>779</td>
  <td>-35878</td>
  </tr>
  <tr>
  <td>&quot;/tmp/biostack/STP06_20230301_0530029_windy_eds.wav&quot;</td>
  <td>200</td>
  <td>-38538</td>
  </tr>
  <tr>
  <td>&quot;/tmp/biostack/STP06_20230312_053002_windy_noeds.wav&quot;</td>
  <td>879</td>
  <td>-34816</td>
  </tr>
  </tbody>
  </table>
  </div>
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2023-06-28T12:45:50.743Z
Answers.Text: not discussing your approach, but if you say "energy in the lower frequency bands" then please estimate energy and not summing simply dB values.  Also suggest to advice on threshold or better how to use your numbers
Answers.UserDisplayName: WMXZ
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2023-06-28T14:03:23.353Z
Answers.Text: I am not sure I understand the comment correctly. I am estimating the power in each frequency bin by using a Welchs PSD estimator. Then summing up the bins amplitude is the total power in the frequency band from 1-550Hz. Whether I am summing up dB or the linear amplitudes makes no difference. Its a proxy of how strong each frequency bin is represented in the signal.
  
  As for the threshold I would run the analysis on the whole dataset and then generate a histogram. I am pretty sure both categories (wind/no-wind) separate nicely in two distributions. Then from there you can pick a threshold.
Answers.UserDisplayName: fth
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2023-06-28T14:37:23.583Z
Answers.Text: You use the term "energy" that is  estimated (up to a constant) by sum of power squared. Sure you can uum amplitudes or dB values as metric but they are not proxies for energy. Please note that others can read your text and your example and conclude energy is sum of dB values.
Answers.UserDisplayName: WMXZ
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2023-06-28T16:18:27.677Z
Answers.Text: I edited the post to avoid confusion. Hope its fine now.
Answers.UserDisplayName: fth
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2023-06-28T10:06:35.063Z
Answers.LastActivityDate: 2023-06-28T16:08:39.290Z
Answers.LastEditDate: 2023-06-28T16:08:39.290Z
Answers.UserDisplayName: fth
Answers.Body: <p>I would like to thank all the users who helped me with this wind problem. A special thanks to Jon Nordby - your tip about using YAMNet was a game-changer for my data pre-processing. It actually led to the creation of a whole research paper, which you can check out here: <a href="https://www.sciencedirect.com/science/article/pii/S0048969724050174?via%3Dihub" rel="nofollow noreferrer">https://www.sciencedirect.com/science/article/pii/S0048969724050174?via%3Dihub</a>.</p>
  <p>***<strong>For anyone looking for a solution to detect wind in recordings</strong>, please read the article linked above. Additionally, you can find a tutorial on how to preprocess your data and identify wind in your recordings here: <a href="https://github.com/Loreb92/wind-noise-detection/blob/main/README.md" rel="nofollow noreferrer">https://github.com/Loreb92/wind-noise-detection/blob/main/README.md</a> . *****</p>
  <p>I’m really grateful for all your help. It’s amazing how much we can achieve together, and I think this is the best part of the bioacoustic.stackExchange community!</p>
  <p>Thanks again for all your support!</p>
  <p>Best,
  Francesca</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2024-08-08T11:37:40.510Z
Answers.LastActivityDate: 2024-08-08T11:37:40.510Z
Answers.UserDisplayName: fterranova
Body: <p>I have to clean my dataset of recordings concerning an African penguin colony inhabits the South African coast. In particular, since I have recordings with days of strong wind with clipped/noisy sounds, I need to detect and then remove all the files ruined by the wind (like the one attached) to create my final dataset.</p>
  <p>Do you have some suggestions about the procedure? I did not find package or suggested procedure to fix this problem, I tried these methods:</p>
  <ol>
  <li><p>to adapt HardRain package for strong wind but it did not work (<a href="https://www.sciencedirect.com/science/article/pii/S1470160X19307873" rel="nofollow noreferrer">https://www.sciencedirect.com/science/article/pii/S1470160X19307873</a>)</p>
  </li>
  <li><p>I tried also to use <a href="https://github.com/kenders2000/WindNoiseDetection" rel="nofollow noreferrer">WindNoiseDetection</a> but it did not work well</p>
  </li>
  <li><p>now I'm trying to use <a href="https://cran.r-project.org/web/packages/monitoR/index.html" rel="nofollow noreferrer">MonitoR package</a> to detect all the windy event.</p>
  </li>
  </ol>
  <p>However, since this is a big and recurring problem of wild recordings it's strange that there are not automated and functioning packages of detection. Maybe I didn't search in the right way.</p>
  
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2023-06-18T21:40:59.553Z
Comments.Text: I do not see any audio attachments. Could you provide a zip archive of 10 clips with wind noise and 10 without (say 5 seconds to 1 minute long each)? Then it would be able to do a quick test of proposed approaches.
Comments.UserDisplayName: Jon Nordby
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2023-06-19T08:34:11.787Z
Comments.Text: Thank you very much, here (https://drive.google.com/drive/folders/1MuzRLZKaIKldNIVIxjdAor7KmWhXScgJ?usp=sharing) there are 10 clips of 50 s with wind noise and 10 clips of 50 s without wind.
Comments.UserDisplayName: fterranova
Tags: <recording><noise><automated-detection>
Title: Detection and removing of windy events in wild acoustic recordings
ThreadText: # Detection and removing of windy events in wild acoustic recordings
  
  (Asked by: username_0 on 2023-06-14)
  
  I have to clean my dataset of recordings concerning an African penguin colony inhabits the South African coast. In particular, since I have recordings with days of strong wind with clipped/noisy sounds, I need to detect and then remove all the files ruined by the wind (like the one attached) to create my final dataset.
  
  Do you have some suggestions about the procedure? I did not find package or suggested procedure to fix this problem, I tried these methods:
  
  1. to adapt HardRain package for strong wind but it did not work (<https://www.sciencedirect.com/science/article/pii/S1470160X19307873>)
  2. I tried also to use [WindNoiseDetection](https://github.com/kenders2000/WindNoiseDetection) but it did not work well
  3. now I'm trying to use [MonitoR package](https://cran.r-project.org/web/packages/monitoR/index.html) to detect all the windy event.
  
  However, since this is a big and recurring problem of wild recordings it's strange that there are not automated and functioning packages of detection. Maybe I didn't search in the right way.
  
  **Tags:** recording, noise, automated-detection
  
  > **Comments:**
  > **username_1**: I do not see any audio attachments. Could you provide a zip archive of 10 clips with wind noise and 10 without (say 5 seconds to 1 minute long each)? Then it would be able to do a quick test of proposed approaches.  
  > **username_0**: Thank you very much, here (https://drive.google.com/drive/folders/1MuzRLZKaIKldNIVIxjdAor7KmWhXScgJ?usp=sharing) there are 10 clips of 50 s with wind noise and 10 clips of 50 s without wind.  
  
  ---
  
  ## 3 answers
  
  ### Answer by username_1 on 2023-06-18. Score: 3
  
  There are several generic audio classifier models that could be used to detect wind noise. For example, the AudioSet ontology includes the class [Wind](http://research.google.com/audioset/ontology/wind_1.html), and also the subclass [Wind noise (Microphone)](http://research.google.com/audioset/ontology/wind_noise_microphone_1.html). There are several pre-trained models available that do AudioSet classification, with pretty good performance overall and are easy to use. Examples include [PANNs](https://github.com/qiuqiangkong/audioset_tagging_cnn/tree/master) and [YAMNet](https://tfhub.dev/google/yamnet/1).
  
  If the performance of those models are not satisfactory out-of-the-box, it is possible to make a model specifically on your data. This would require to annotate a smaller amount of your data with windy/not. Some minutes of data might be enough, though one would have to make sure to cover all the variation that exists in the dataset.
  
  With such a dataset, one would use the pretrained audio models to extract a vector embedding from the audio, and then train a small/simple classifier on these vectors.
  For that approach, one can also use vector embedding models such as [OpenL3](https://github.com/marl/openl3).
  
  > **Comments:**
  > **username_0**: Thakns Jon, this comment was really useful. I'm now trying the methods that you suggested. Let's see!  
  
  ---
  
  ### Answer by username_2 on 2023-06-28. Score: 2
  
  I propose a much simpler solution for cleaning your dataset. After looking at some of your windy files it is very apparent that there are 2 things that stick out to me compared to the non-windy files.
  
  The number of times the audio clips per file.
  The power/energy in the frequency bins below 550 Hz.
  
  My approach for cleaning your dataset would be to do two things:
  
  Count the number of times the audio file clips.
  Compute the power spectrum for each file and sum up the power in the frequency bins from 1-550 Hz.
  
  You can easily see that files which have a high number of clips/file and at the same time a lot of power in the lower frequency bands are the ones that are most likely containing a lot of wind (see results below).
  You could implement a small script running through all of your files, computing the above mentioned values in any programming language such as Python, Matlab, R, ...
  Matlab Code
  fname = '/path/to/file.wav';
  
  [y,fs] = audioread(fname);
  
  n_clip = length(find(y>0.95));
  
  window_fct = hamming(floor(length(y)/128));
  overlap = 0.9;
  nfft = 2^16;
  
  [pxx,fx] = pwelch(y,window_fct,floor(overlap*length(window_fct)),nfft,fs);
  pxx = 10*log10(pxx);
  
  fx_relevant = find(fx<550);
  
  P_below_550 = sum(pxx(fx_relevant));
  
  Results
  
  
  
  
  File path
  Audio > 0.95
  Power < 550 Hz
  
  
  
  
  "/tmp/biostack/STP03_20230328_1950362_nowind_eds.wav"
  2
  -62843
  
  
  "/tmp/biostack/STP03_20230328_1950363_nowind_eds.wav"
  0
  -61881
  
  
  "/tmp/biostack/STP03_20230328_1950364_nowind_eds.wav"
  0
  -61739
  
  
  "/tmp/biostack/STP03_20230328_195036_nowind_eds.wav"
  0
  -62573
  
  
  "/tmp/biostack/STP03_20230329_19300210_nowind_eds.wav"
  82
  -51638
  
  
  "/tmp/biostack/STP03_20230329_1930025_nowind_eds.wav"
  601
  -43343
  
  
  "/tmp/biostack/STP03_20230329_1930026_nowind_eds.wav"
  316
  -45589
  
  
  "/tmp/biostack/STP03_20230329_1930027_nowind_eds.wav"
  0
  -60587
  
  
  "/tmp/biostack/STP03_20230329_1930028_nowind_eds.wav"
  0
  -58075
  
  
  "/tmp/biostack/STP03_20230329_1930029_nowind_eds.wav"
  0
  -61481
  
  
  "/tmp/biostack/STP06_20230225_1930022_windy_noeds.wav"
  1147
  -35458
  
  
  "/tmp/biostack/STP06_20230225_1930023_windy_noeds.wav"
  1224
  -34735
  
  
  "/tmp/biostack/STP06_20230225_1930024_windy_noeds.wav"
  1137
  -34696
  
  
  "/tmp/biostack/STP06_20230225_193002_windy_noeds.wav"
  490
  -36425
  
  
  "/tmp/biostack/STP06_20230226_0500024_windy_eds.wav"
  7146
  -30641
  
  
  "/tmp/biostack/STP06_20230226_0500025_windy_eds.wav"
  4020
  -31998
  
  
  "/tmp/biostack/STP06_20230301_0530026_windy_eds.wav"
  488
  -36449
  
  
  "/tmp/biostack/STP06_20230301_0530027_windy_eds.wav"
  483
  -36905
  
  
  "/tmp/biostack/STP06_20230301_0530028_windy_eds.wav"
  779
  -35878
  
  
  "/tmp/biostack/STP06_20230301_0530029_windy_eds.wav"
  200
  -38538
  
  
  "/tmp/biostack/STP06_20230312_053002_windy_noeds.wav"
  879
  -34816
  
  > **Comments:**
  > **username_3**: not discussing your approach, but if you say "energy in the lower frequency bands" then please estimate energy and not summing simply dB values.  Also suggest to advice on threshold or better how to use your numbers  
  > **username_2**: I am not sure I understand the comment correctly. I am estimating the power in each frequency bin by using a Welchs PSD estimator. Then summing up the bins amplitude is the total power in the frequency band from 1-550Hz. Whether I am summing up dB or the linear amplitudes makes no difference. Its a proxy of how strong each frequency bin is represented in the signal.  As for the threshold I would run the analysis on the whole dataset and then generate a histogram. I am pretty sure both categories (wind/no-wind) separate nicely in two distributions. Then from there you can pick a threshold.  
  > **username_3**: You use the term "energy" that is  estimated (up to a constant) by sum of power squared. Sure you can uum amplitudes or dB values as metric but they are not proxies for energy. Please note that others can read your text and your example and conclude energy is sum of dB values.  
  > **username_2**: I edited the post to avoid confusion. Hope its fine now.  
  
  ---
  
  ### Answer by username_0 on 2024-08-08. Score: 1
  
  I would like to thank all the users who helped me with this wind problem. A special thanks to username_1 - your tip about using YAMNet was a game-changer for my data pre-processing. It actually led to the creation of a whole research paper, which you can check out here: <https://www.sciencedirect.com/science/article/pii/S0048969724050174?via%3Dihub>.
  
  \*\*\***For anyone looking for a solution to detect wind in recordings**, please read the article linked above. Additionally, you can find a tutorial on how to preprocess your data and identify wind in your recordings here: <https://github.com/Loreb92/wind-noise-detection/blob/main/README.md> . \*\*\*\*\*
  
  I’m really grateful for all your help. It’s amazing how much we can achieve together, and I think this is the best part of the bioacoustic.stackExchange community!
  
  Thanks again for all your support!
  
  Best,
  Francesca
  
  
  ---
  
  