From e2c08e92dff93852da6e735e16b6e8ff64721044 Mon Sep 17 00:00:00 2001 From: Sean Perry Date: Tue, 22 Oct 2024 09:31:14 -0700 Subject: [PATCH] fix: fix bad file path concat --- PyHa/IsoAutio.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/PyHa/IsoAutio.py b/PyHa/IsoAutio.py index 2c28f72..a612e6b 100644 --- a/PyHa/IsoAutio.py +++ b/PyHa/IsoAutio.py @@ -964,14 +964,14 @@ def generate_automated_labels_microfaune( # generate local scores for every bird file in chosen directory for audio_file in os.listdir(audio_dir): # skip directories - if os.path.isdir(audio_dir + audio_file): + if os.path.isdir(os.path.join(audio_dir, audio_file)): continue # Reading in the audio files using librosa, converting to single channeled data with original sample rate # Reason for the factor for the signal is explained here: https://stackoverflow.com/questions/53462062/pyaudio-bytes-data-to-librosa-floating-point-time-series # Librosa scales down to [-1, 1], but the models require the range [-32768, 32767] try: - SIGNAL, SAMPLE_RATE = librosa.load(audio_dir + audio_file, sr=None, mono=True) + SIGNAL, SAMPLE_RATE = librosa.load(os.path.join(audio_dir, audio_file), sr=None, mono=True) SIGNAL = SIGNAL * 32768 except KeyboardInterrupt: exit("Keyboard interrupt") @@ -1102,14 +1102,14 @@ def generate_automated_labels_tweetynet( # generate local scores for every bird file in chosen directory for audio_file in os.listdir(audio_dir): # skip directories - if os.path.isdir(audio_dir + audio_file): + if os.path.isdir(os.path.join(audio_dir, audio_file)): continue # Reading in the audio files using librosa, converting to single channeled data with original sample rate # Reason for the factor for the signal is explained here: https://stackoverflow.com/questions/53462062/pyaudio-bytes-data-to-librosa-floating-point-time-series # Librosa scales down to [-1, 1], but the models require the range [-32768, 32767], so the multiplication is required try: - SIGNAL, SAMPLE_RATE = librosa.load(audio_dir + audio_file, sr=None, mono=True) + SIGNAL, SAMPLE_RATE = librosa.load(os.path.join(audio_dir, audio_file), sr=None, mono=True) SIGNAL = SIGNAL * 32768 except KeyboardInterrupt: exit("Keyboard interrupt") @@ -1246,7 +1246,7 @@ def generate_automated_labels_FG_BG_separation( # looping through the folder for audio_file in os.listdir(audio_dir): # skip directories - if os.path.isdir(audio_dir + audio_file): + if os.path.isdir(os.path.join(audio_dir, audio_file)): continue # loading in the audio clip try: @@ -1364,7 +1364,7 @@ def generate_automated_labels_template_matching( # looping through the clips to process for audio_file in os.listdir(audio_dir): # skip directories - if os.path.isdir(audio_dir + audio_file): + if os.path.isdir(os.path.join(audio_dir, audio_file)): continue # loading in the audio clip try: