From 0b6d98dd3a6899c496963821f21fe79e5cdee999 Mon Sep 17 00:00:00 2001 From: Nodude <75137537+NodudeWasTaken@users.noreply.github.com> Date: Sun, 25 Aug 2024 20:11:51 +0200 Subject: [PATCH] Undo smaller --- dancer/libfun.py | 5 ++++- dancer/ui.py | 17 ++--------------- requirements.txt | 2 +- 3 files changed, 7 insertions(+), 17 deletions(-) diff --git a/dancer/libfun.py b/dancer/libfun.py index 39652a3..45b2ee1 100755 --- a/dancer/libfun.py +++ b/dancer/libfun.py @@ -5,13 +5,16 @@ import matplotlib as mpl from matplotlib.colors import LinearSegmentedColormap from matplotlib.figure import Figure +from audioread import audio_open VERSION="?" HEATMAP = LinearSegmentedColormap.from_list("intensity",["w", "g", "orange", "r"], N=256) #TODO: Fix action lag that happens sometimes, maybe change hop? def load_audio_data(audio_file, hop_length=1024, frame_length=1024, plp=True): - y, sr = librosa.load(audio_file, sr=None, mono=True) + y, sr=None,None + with audio_open(audio_file) as f: + y, sr = librosa.load(f, sr=None, mono=True) # Compute beats onset = None diff --git a/dancer/ui.py b/dancer/ui.py index e2d1695..db39cc4 100644 --- a/dancer/ui.py +++ b/dancer/ui.py @@ -102,22 +102,9 @@ def run(self): self.pre() if (isinstance(self.fileName, Path)): - audioFile = Path(cfg.get("temporary_folder", "tmp"), self.fileName.with_suffix(".wav").name) - audioFile.parent.mkdir(parents=True, exist_ok=True) - - if (len(self.data) <= 0): - try: - ffmpeg_conv(self.fileName, audioFile) - except: - self.progressed(-1, "Failed to convert to wav!") - self.finished() - return - - self.progressed(20, "Transforming audio data...") - try: - self.data = load_audio_data(audioFile, plp=self.plp) - except: + self.data = load_audio_data(self.fileName, plp=self.plp) + except Exception as e: self.progressed(-1, "Failed to transform audio data!") self.finished() return diff --git a/requirements.txt b/requirements.txt index 0f8ffe4..e87fe2c 100755 --- a/requirements.txt +++ b/requirements.txt @@ -1,5 +1,5 @@ numpy<1.24 -librosa @ git+https://github.com/audioseek/librosa@main +librosa==0.10.0.post2 matplotlib<3.8 scipy==1.9.3 pyinstaller