R package for supporting BTO acoustic data analyses.
devtools::install_github('BritishTrustForOrnithology/AcousticTools')
The main functions so far are for:
- renaming audio files in more helpful formats.
- getting the duration of audio files without reading the whole file
- reading and manipulating BTO Acoustic Pipeline results csv files
- reading and manipulating BirdNET outputs
- saving audio chunks for species detections in species folders
- creating empty Audacity label files for each audio files
- downloading and manipulating audio clips from xeno-canto
In several cases these functions assume that audio files are (or will be) in a standard naming format, consisting of:
YYYYMMDD-HHMMSS-LocationName-RecordistName-EquipmentCode-SpeciesCode.wav or YYYYMMDD-HHMM-LocationName-RecordistName-EquipmentCode-SpeciesCode.wav
Using a consistent format makes it easier to write functions that know where to look for dates, times and species information. Also, making files in a common format with location name etc encoded in the filename reduces downstream confusion if similarly named files are divorced from their parent folders.
The following workflow could be used with the Pipeline:
- Use rename_songmeter_files() to convert all audio files to the preferred name format. This will make it easier later if any sampling is required by date/time
- Run the files through the BTO Acoustic Pipeline. Save (or download) the results csv file.
- Run read_pipeline_results() to read and manipulate the outputs into a standard format. This will return a dataframe. Save for next step
- Apply user-selected protocols to shortlist clips for verification. e.g. all of species A and B, but only a 10% sample stratified by site, for species C. Use this method to produce a dataframe where each row is a detection you want to export.
- For each row, make a unique filename for what you want that chunk to be called.
- Now use extract_chunk() applied to each row of the dataframe produced in 5) to produce short audio chunks for manual checking
A full working example of this approach can be found here
- Use rename_songmeter_files() to convert all audio files to the preferred name format. This will make it easier later if any sampling is required by date/time
- Run BirdNET using the BirdNET GUI and select one of R, CSV or Audacity output formats
- Run read_birdnet_results() to read and collate the outputs into a standard format. This will return a dataframe. Save for next step
- Apply user-selected protocols to shortlist clips for verification. e.g. all of species A and B, but only a 10% sample stratified by site, for species C. Use this method to produce a dataframe where each row is a detection you want to export.
- For each row make a unique filename for what you want that chunk to be called.
- Now use extract_chunk() applied to each row of the dataframe produced in 5) to produce short audio chunks for manual checking
A full working eample of this approach can be found here
A more involved work eample using stratified sampling can be found here
Simon Gillings v2 December 2024