Skip to content

Commit

Permalink
fix: fix bad file path concat (#221)
Browse files Browse the repository at this point in the history
* fix: fix bad file path concat

* fix: update version
  • Loading branch information
Sean1572 authored Oct 22, 2024
1 parent d3fa499 commit c067bb1
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 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
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "PyHa"
version = "1.0.0"
version = "1.0.1"
description = "PyHa"
authors = [
"UCSD Engineers for Exploration <[email protected]>",
Expand Down

0 comments on commit c067bb1

Please sign in to comment.