Added option in Spectrogram view to activate a frequency shift in the audio livestream

This commit is contained in:
Louis Croisez
2023-05-16 10:46:43 +02:00
parent 21e10dd0bd
commit 04dae073f6
4 changed files with 87 additions and 3 deletions
+18 -1
View File
@@ -94,6 +94,23 @@ if(isset($_GET['submit'])) {
exec("sudo systemctl restart livestream.service");
}
}
if (isset($_GET["activate_freqshift_in_livestream"])) {
$activate_freqshift_in_livestream = trim($_GET["activate_freqshift_in_livestream"]);
//Setting exists already, see if the value changed
if (strcmp($activate_freqshift_in_livestream, $config['ACTIVATE_FREQSHIFT_IN_LIVESTREAM']) !== 0) {
$contents = preg_replace("/ACTIVATE_FREQSHIFT_IN_LIVESTREAM=.*/", "ACTIVATE_FREQSHIFT_IN_LIVESTREAM=\"$activate_freqshift_in_livestream\"", $contents);
$contents2 = preg_replace("/ACTIVATE_FREQSHIFT_IN_LIVESTREAM=.*/", "ACTIVATE_FREQSHIFT_IN_LIVESTREAM=\"$activate_freqshift_in_livestream\"", $contents2);
$fh = fopen("/etc/birdnet/birdnet.conf", "w");
$fh2 = fopen("./scripts/thisrun.txt", "w");
fwrite($fh, $contents);
fwrite($fh2, $contents2);
sleep(1);
exec("sudo systemctl restart livestream.service");
}
}
if(isset($_GET["overlap"])) {
$overlap = $_GET["overlap"];
@@ -569,7 +586,7 @@ foreach($formats as $format){
<h2>Accessibility Settings</h2>
<p>Birdsongs Frequency shifting configuration:<br>
This can be useful for hearing impaired people. Note: audio files will only be pitch shifted when the "FREQ SHIFT" button is manually clicked for a detection on the "Recordings" page.<br>
This can be useful for hearing impaired people. <br>Note: audio files will only be pitch shifted when the "FREQ SHIFT" button is manually clicked for a detection on the "Recordings" page. <br>The frequency shifting can also be activated for the realtime audio livestream, accessible in the SPECTROGRAM tab of BirdNET-Pi. Once it has been activated, it will be made available for the Live Audio feature as well.<br>Livestream is using ffmpeg for streaming its audio data, so the pitch shifter in that case will use this tool too. If you choose sox as the tool for freq shifting recorded audio files, then you must configure both sox and ffmpeg parameters: sox for recordings, and ffmpeg for livestream.<br>
<p style="margin-left: 40px">