Skip to content

Commit

Permalink
fix: fix bad file path concat
Browse files Browse the repository at this point in the history
  • Loading branch information
Sean1572 committed Oct 22, 2024
1 parent d3fa499 commit e2c08e9
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions PyHa/IsoAutio.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down Expand Up @@ -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")
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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:
Expand Down

0 comments on commit e2c08e9

Please sign in to comment.