Skip to content

Experiments in rendering and analyzing sound data from field recordings

License

Notifications You must be signed in to change notification settings

conservationtechlab/gnatcatcher

Repository files navigation

gnatcatcher

Repo for experiments in rendering and analyzing sound data from field recordings

Table of Contents

General info

This project contains various python codes used for analyzing and sorting audio data from field recordings. Files inlcude:

  • analyzeaudio.py: picks a random audio file from a given folder and provides: the sampling rate, the spectrogram of the entire audio, the highest audible frequency, the Fast Fourier Transform of Entire Audio, duration of the audio. It also prompts the user to input a time frame within the audio and in turn it provides: a Spectrogram of the Segmented Time, the most prominent frequency, a graph of the Strongest Frequency per bin, and a graph of the Power of Strongest Frequency per Bin.
  • eventchecker.py: uses mircofaune to filter audio with events and sends those files to be analyzed by BirdNET. For every audio file it was sent, BirdNET outputs a text file containing the probability of time segments containing a bird species.
  • eventplotter.py: takes in the text files created by BirdNET and provides the user with a list of the most probable bird species. The user then tells the script which speices they would like to investigate further and a graph is shown that shows how the counts of that bird species changes throughout the day.
  • eventplotter_all.py: works in a similar way to eventplotter.py but outputs a graph for every single probable species above the given threshold and found inside the San Diego Zoo BioDiversity Reserve. The user does not need to tell the script which species they would like to investigate further.
  • eventplotter_functions.py: hosts the functions used by eventplotter.py and eventplotter_all.py
  • pitchshift.py: a script that pitchshifts a given audio file. Can be used if one would like to listen to bat calls, or other vocalizations that are above the range of human hearing.
  • sortaudiomoth.py: Provides a summary of the audio data in a given folder including: the AudioPath, number of Channels, Sample Rate (Hz). Number of Frames, Time (sec), Most Prominent Frequency, Loudness of MPF, Time of Loudest Frequency, Average Loudness, and any Comments.
  • checkBirdNET.py: uses a BirdNET text file to play the portions of a given audio file that contains the most probable bird sounds.
  • playBirdNET_neg.py: uses a BirdNET text file to play the portions of a given audio file that contains the most probable bird sounds in chronological order.
  • playBirdNET_neg.py: uses a BirdNET text file to play the portions of a given audio file that contain no bird sounds whatsoever according to BirdNET.
  • cross_correlation.py:Performs 1D cross correlation on a set of files. Compares it to master set of files to try to determine a match.
  • mp3TOwav: Converts mp3 files to wav files.
  • pitchshift.py: Pitch shifts a given audio file.
  • stereoTOmono_microfaune.py: Converts wav files with stereo channels to wav files that are mono-channeled.
  • testmicrofaune.py: Tests the robustness of microfaune.
  • groundtruthcsv.py Creates a csv file for the ground truth data used to test micorfaune.

Technologies

Project is created with:

Setup

  • analyzeaudio.py:
    1. Provide a configfile that includes the path to the folder containing the audio files. Example of yaml file: path = '/Users/amandabreton/Documents/GitHub/gnatcatcher/sounds'
  • eventchecker.py:
    1. Install microfaune. GitHub and instructions can be found here: https://github.com/microfaune/microfaune
    2. Install BirdNET. GitHub and instructions can be found here: https://github.com/kahst/BirdNET
    3. Provide a configfile that includes:
      • the path to where a csv file will be saved
      • the path containing the audio files you want analyzed
      • the path to where BirdNET's script "analyze.py" is held
      • the path to where BirdNET is hosted
      • the threshold of probability you want to use to filter audio Example of yaml file: csvpath: /Users/amandabreton/Documents/GitHub/gnatcatcher/ path: /Users/amandabreton/Documents/GitHub/gnatcatcher/sounds/ analyzepath: /Users/amandabreton/Documents/GitHub/BirdNET/analyze.py birdnetpath: /Users/amandabreton/Documents/GitHub/BirdNET threshold: 0.70 4. Make sure your "path" (folder containing audio files) only contains .wav files, or else microfaune will encounter an error. 5. Run the script with the yaml file from the terminal. It may longer depending on how many audio files are in the folder.
  • eventplotter.py: 1. Run eventchecker.py (see above) 2. Provide a configfile that includes: - the path containing the audio files that BirdNET analyzed and saved the text files in. - the path to the csv file with the common names of the birds found in the San Diego Zoo Biodiversity Reserve. The csv file is called: reservebirds.csv Example: path: /Users/amandabreton/Documents/GitHub/gnatcatcher/sounds/ biodiversity_reserve_bird_list: /Users/amandabreton/Documents/GitHub/gnatcatcher/reservebirds.csv Note: you can use the same config file you used to run eventchecker.py 3. Run the script with the yaml file from the terminal. 4. The script will prompt you to provide it with the number corresponding to the species you wish to view more in detail.
  • eventplotter_all.py: 1. Run eventchecker.py (see above) 2. Provide a configfile that includes: - the path containing the audio files that BirdNET analyzed and saved the text files in. - the path to the csv file with the common names of the birds found in the San Diego Zoo Biodiversity Reserve. The csv file is called: reservebirds.csv Example: path: /Users/amandabreton/Documents/GitHub/gnatcatcher/sounds/ biodiversity_reserve_bird_list: /Users/amandabreton/Documents/GitHub/gnatcatcher/reservebirds.csv Note: you can use the same config file you used to run eventchecker.py 3. Run the script with the yaml file from the terminal.
  • pitchshift.py: 1. Provide a configfile that includes: -the path to where the audio file you want analyzed is. 2. Run the script with the yaml file from the terminal.
  • sortaudiomoth.py: 1. Install PyExifTool using "pip install PyExifTool" 2. Provide a configfile that includes: - the path to the folder containing the audio files - the path where you want the csv file to be saved Example of yaml file: csvpath = "/Users/amandabreton/Documents/GitHub/gnatcatcher/" path = '/Users/amandabreton/Documents/GitHub/gnatcatcher/sounds' 3. Run the code. It should provide a csv file containing: Path of the audio file, # of channels, sample rate, # of frames, time (sec), most prominent frequency (mpf), loudness of mpf, time of mpf, average loudness, any comments found in audio's metadata
  • checkBirdNET.py: 1.Run BirdNET on the audio file you want to listen to. See BirdNET GitHub for further instructions. 2. Provide a configfile that includes: - the path to the audio file you want to listen to. - the path to the text file created by BirdNET from the audio file. - the threshold of probabilty you want. Example: audio: '/Users/amandabreton/Documents/GitHub/gnatcatcher/sounds/5D31ED38.WAV' datafile: '/Users/amandabreton/Documents/GitHub/gnatcatcher/BirdNet_csv_files/ 5D31ED38.BirdNET.csv' threshold: 0.75 3. Run the script with the yaml file from the terminal.
  • playBirdNET_neg.py: 1. Run checkBirdNET.py 2. Provide a configfile that includes: - the path to the audio file you want to listen to. - the path to the text file created by BirdNET from the audio file. Note: you can use the same config file taht was used in checkBirdNET.py
  • playBirdNET_neg.py: 1. Run checkBirdNET.py 2. Provide a configfile that includes: - the path to the audio file you want to listen to. - the path to the text file created by BirdNET from the audio file. Note: you can use the same config file taht was used in checkBirdNET.py
  • cross_correlation.py: Just need to parse in the: path to the masterlist of files and path to the files you want analyzed.
  • mp3TOwav.py: Just need to parse in the: path to the folder of mp3s you want converted and and path to the folder you want the .wav files to be saved to.
  • pitchshift.py: Just need to parse in the audio file you want to pitch shift.
  • stereoTOmono_microfaune.py: Just need to parse in the: path to the folder of stereo wav file you want converted and and path to the folder you want the mono wav files to be saved to.
  • testmicrofaune.py: Need to parse in the folder where the audio files are and parse in where you want the csv of results saved.
  • groundtruthcsv.py: Need to parse in a folder containing the non-bird sounds and parse in a file containing the bird sounds.

About

Experiments in rendering and analyzing sound data from field recordings

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages