r/BirdNET_Analyzer • • Apr 27 '22

Software Gathering and analyzing with two bash scripts.

1 Upvotes

Both scripts are run by the crontab.

The first script, called beforeDawn.sh, is run at 4:00am...

#!/bin/bash
export YEAR=`date '+%Y'`
export MONTH=`date '+%m'`
export DAY=`date '+%d'`
mkdir -p /home/tweet/samples/${YEAR}/${MONTH}/${DAY}/
arecord -D sysdefault:CARD=2 --quiet --max-file-time 60 -f S16_LE -r 48000 -t wav --use-strftime /home/tweet/samples/%Y/%m/%d/%H-%M-%S.wav &
echo "$!" > recording.pid

The second script, called afterDark.sh, is run at 8:30pm...

#!/bin/bash
TIMEFORMAT='Elapsed Time: %0R seconds.' 
time {
export YEAR=`date '+%Y'`
export MONTH=`date '+%m'`
export DAY=`date '+%d'`
export WEEK=`date '+%U'`
kill `cat /home/tweet/recording.pid`
for f in `ls /home/tweet/samples/${YEAR}/${MONTH}/${DAY}/*.wav`
do
    python3 /home/tweet/BirdNET-Analyzer/analyze.py --i ${f} --o ${f%.wav}.csv --rtype csv --min_conf 0.6 --threads 3 --lat 23.8 --lon -81.0 --week ${WEEK} --slist /home/tweet/samples/species_list.txt >> /home/tweet/${YEAR}-${MONTH}-${DAY}.out 2>> /home/tweet/${YEAR}-${MONTH}-${DAY}.err
    t=$(basename ${f})
    # add the file name (a timestamp) to the end of each file row
    sed -i 's/$/,'"${t%.wav}"'/' ${f%.wav}.csv
done
cat /home/tweet/header.csv > ${YEAR}-${MONTH}-${DAY}.csv
# strip the headers
cat /home/tweet/samples/${YEAR}/${MONTH}/${DAY}/*.csv | grep -v Confidence >> /home/tweet/t1.csv
# sort by common name and confidence
sort -t "," -k3,3 -k5,5nr /home/tweet/t1.csv > /home/tweet/t2.csv
# remove the first few columns
cut -d ',' -f 4,5- t2.csv >> /home/tweet/${YEAR}-${MONTH}-${DAY}.csv
# clean up
rm /home/tweet/t*.csv
gzip /home/tweet/${YEAR}-${MONTH}-${DAY}.err
gzip /home/tweet/${YEAR}-${MONTH}-${DAY}.out
gzip /home/tweet/samples/${YEAR}/${MONTH}/${DAY}/*
}

r/BirdNET_Analyzer • • Apr 27 '22

Software Data Viewer Idea

2 Upvotes

Given the analyzer CSV output, I could easily load the data into a SQLite database. I've embedded SQLite in a Java servlet in the past and put a query interface to be displayed in a web browser. I'm thinking three parameters for the interface: confidence, time range, and time increment.

So for instance you may choose confidence over .8, the month of April 2022, and by day. There will probably have to be some relationship between range and increment so you could not choose all year by the minute to avoid impractical results.

This would render a bar chart, grouped by the increment, across the range on the x axis and quantity of birds detected on the y axis with legend of bar color to bird species. The bar chart will likely be SVG to accommodate vector scaling.


r/BirdNET_Analyzer • • Apr 26 '22

Results First day's results include birds I've never seen.

1 Upvotes

I'm getting a lot of high confidence hits for an osprey. While supposedly they are in my area, I've never seen one and I don't live near a body of water.

  • Could this be false positives from the House Finches that I see a lot of?
  • Could it be improved with a better microphone?