orcasound / orcadata

Development of bioacoustic tools for analyzing Orcasound data -- either post-processing of archived raw FLAC files or real-time analysis of the lossy stream and/or FLAC files.
GNU Affero General Public License v3.0
53 stars 23 forks source link

Spectrogram is hazy and hard to distinguish patterns #27

Open yusufkhanmohammad opened 4 years ago

yusufkhanmohammad commented 4 years ago

spectrogram.ipynb uses soundfile library and makes a spectrogram a bit hazy, tried doing with Librosa amplitude_to_db spectrogram AtoD = librosa.amplitude_to_db(np.abs(librosa.stft(data)), ref=np.max)

https://colab.research.google.com/drive/1LRdUcsKTiBI-ERVJQ0OEImcUo7WqtjrN

veirs commented 4 years ago

Mohammad, I suggest you try to make a spectrogram from just the first file in the flac directory. This first call we term S 1 and is the most common call that the local orca use. It should give you a spectrogram similar to the one below I just made with Audacity from that first file. Val [image: image.png]

On Wed, Mar 18, 2020 at 12:00 PM Mohammad Yusuf Khan < notifications@github.com> wrote:

spectrogram.ipynb uses soundfile library and makes a spectrogram a bit hazy, tried doing with Librosa amplitude_to_db spectrogram AtoD = librosa.amplitude_to_db(np.abs(librosa.stft(data)), ref=np.max)

https://colab.research.google.com/drive/1LRdUcsKTiBI-ERVJQ0OEImcUo7WqtjrN

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/orcasound/orcadata/issues/27, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABFXKXMG5UOTNWUE3ZWE3JDRIEK3LANCNFSM4LOYLI3A .

atreyamaj commented 4 years ago

Hey, a good way to start enhancing the spectrogram would be to remove noise from the audio signal before computing the spectrogram (maybe using a package like open-unmix-pytorch). Some possible ways to enhance the spectrogram are:

  1. band pass filtering
  2. spectral subtraction
  3. using a wiener filter
  4. wavelet packet decomposition

More information can be found in this interesting research paper: http://aircconline.com/sipij/V3N2/3212sipij01.pdf

kunakl07 commented 4 years ago

Interesting paper @atreyamaj Here is the first stage of preprocessing that I performed on S_1 .wav file. I think this notebook will help to get a basic look of preprocessing https://colab.research.google.com/drive/1ckW8EaIO9Vf1n4KZHz289aryWKrclHtF

atreyamaj commented 4 years ago

This notebook is great! Thanks for sharing it @kunakl07 , I'm sure it'll help others looking to preprocess data too!

kunakl07 commented 4 years ago

Welcome @atreyamaj , the actual credits go to Abhishek Singh and Jesse Lopez who performed these preprocessing tasks. I have used it to apply on S_1.wav file which is here.

atreyamaj commented 4 years ago

@yusufkhanmohammad Hey, I just came across a python library that can be used for denoising. The detailed steps for how it does so are given in the documentation. Link: https://pypi.org/project/noisereduce/