diff --git a/birdnet.conf-defaults b/birdnet.conf-defaults index e9cbbfb..43215e5 100644 --- a/birdnet.conf-defaults +++ b/birdnet.conf-defaults @@ -195,6 +195,11 @@ DATABASE_LANG=en SILENCE_UPDATE_INDICATOR=0 +## RAW_SPECTROGRAM is for removing the axes and labels of the spectrograms +## that are generated by Sox for each detection for a cleaner appearance. + +RAW_SPECTROGRAM=0 + ## HEARTBEAT_URL is a location to ping every time some analysis is done ## no information is sent to the the URL, it is a heart beat to show that the ## analysis is continuing diff --git a/scripts/advanced.php b/scripts/advanced.php index 2e09f06..f91a282 100644 --- a/scripts/advanced.php +++ b/scripts/advanced.php @@ -200,6 +200,17 @@ if(isset($_GET['submit'])) { $contents2 = preg_replace("/SILENCE_UPDATE_INDICATOR=.*/", "SILENCE_UPDATE_INDICATOR=0", $contents2); } + if(isset($_GET["raw_spectrogram"])) { + $raw_spectrogram = 1; + if(strcmp($RAW_SPECTROGRAM,$config['RAW_SPECTROGRAM']) !== 0) { + $contents = preg_replace("/RAW_SPECTROGRAM=.*/", "RAW_SPECTROGRAM=$raw_spectrogram", $contents); + $contents2 = preg_replace("/RAW_SPECTROGRAM=.*/", "RAW_SPECTROGRAM=$raw_spectrogram", $contents2); + } + } else { + $contents = preg_replace("/RAW_SPECTROGRAM=.*/", "RAW_SPECTROGRAM=0", $contents); + $contents2 = preg_replace("/RAW_SPECTROGRAM=.*/", "RAW_SPECTROGRAM=0", $contents2); + } + $fh = fopen('/etc/birdnet/birdnet.conf', "w"); $fh2 = fopen("./scripts/thisrun.txt", "w"); fwrite($fh, $contents); @@ -287,6 +298,9 @@ foreach($formats as $format){ >
+ + >
+

BirdNET-Lite Settings

diff --git a/scripts/extract_new_birdsounds.sh b/scripts/extract_new_birdsounds.sh index 297c48d..60b9bb3 100755 --- a/scripts/extract_new_birdsounds.sh +++ b/scripts/extract_new_birdsounds.sh @@ -118,11 +118,22 @@ for h in "${SCAN_DIRS[@]}";do sox -V1 "${h}/${OLDFILE}" "${NEWSPECIES_BYDATE}/${NEWFILE}" \ trim ="${START}" ="${END}" - # Create spectrogram for extraction - sox -V1 "${NEWSPECIES_BYDATE}/${NEWFILE}" -n remix 1 rate 24k spectrogram \ - -t "${COMMON_NAME}" \ - -c "${NEWSPECIES_BYDATE//$HOME\/}/${NEWFILE}" \ - -o "${NEWSPECIES_BYDATE}/${NEWFILE}.png" + RAW_SPECTROGRAM=${RAW_SPECTROGRAM} + # Check if RAW_SPECTROGRAM is 1 + if [ "$RAW_SPECTROGRAM" == "1" ]; then + # If it is, add "-r" as an argument to the SOX command + sox -V1 "${NEWSPECIES_BYDATE}/${NEWFILE}" -n remix 1 rate 24k spectrogram \ + -t "${COMMON_NAME}" \ + -c "${NEWSPECIES_BYDATE//$HOME\/}/${NEWFILE}" \ + -o "${NEWSPECIES_BYDATE}/${NEWFILE}.png" \ + -r + else + # If it's not, run the SOX command without the "-r" argument + sox -V1 "${NEWSPECIES_BYDATE}/${NEWFILE}" -n remix 1 rate 24k spectrogram \ + -t "${COMMON_NAME}" \ + -c "${NEWSPECIES_BYDATE//$HOME\/}/${NEWFILE}" \ + -o "${NEWSPECIES_BYDATE}/${NEWFILE}.png" + fi done < "${TMPFILE}" diff --git a/scripts/install_config.sh b/scripts/install_config.sh index 162b16d..f5e3698 100755 --- a/scripts/install_config.sh +++ b/scripts/install_config.sh @@ -228,6 +228,11 @@ HEARTBEAT_URL= SILENCE_UPDATE_INDICATOR=0 +## RAW_SPECTROGRAM is for removing the axes and labels of the spectrograms +## that are generated by Sox for each detection for a cleaner appearance. + +RAW_SPECTROGRAM=0 + ## These are just for debugging LAST_RUN= THIS_RUN= diff --git a/scripts/update_birdnet_snippets.sh b/scripts/update_birdnet_snippets.sh index 281e889..65c24f1 100755 --- a/scripts/update_birdnet_snippets.sh +++ b/scripts/update_birdnet_snippets.sh @@ -168,5 +168,9 @@ if ! grep -q 'RuntimeMaxSec=' "$HOME/BirdNET-Pi/templates/birdnet_analysis.servi sudo systemctl daemon-reload && restart_services.sh fi +if ! grep RAW_SPECTROGRAM /etc/birdnet/birdnet.conf &>/dev/null;then + sudo -u$USER echo "RAW_SPECTROGRAM=0" >> /etc/birdnet/birdnet.conf +fi + sudo systemctl daemon-reload restart_services.sh