-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Description
Wtf is happening
When clicking "choose audio file"
this error is returned:
Exception in Tkinter callback
Traceback (most recent call last):
File "/usr/lib64/python3.13/tkinter/__init__.py", line 2068, in __call__
return self.func(*args)
~~~~~~~~~^^^^^^^
File "/home/qwefg/Git/CompSciIA/musicsorterproject/bpmdetector.py", line 133, in open_file_dialog
y, sr = librosa.load(file_path)
~~~~~~~~~~~~^^^^^^^^^^^
File "/home/qwefg/.local/lib/python3.13/site-packages/librosa/core/audio.py", line 170, in load
if isinstance(path, tuple(audioread.available_backends())):
~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
File "/home/qwefg/.local/lib/python3.13/site-packages/audioread/__init__.py", line 80, in available_backends
from . import rawread
File "/home/qwefg/.local/lib/python3.13/site-packages/audioread/rawread.py", line 16, in <module>
import aifc
ModuleNotFoundError: No module named 'aifc'
Breakdown:
- Error occurs when choosing though the open_file_dialog command that runs when clicking the button
- Then file_path is set to the chosen file and the directory that it was chosen in is saved in the config file
- Finally process_audio_file(file_path) is called
def process_audio_file(file_path, duration=30, sample_rate=22050):
try:
display_metadata(file_path)
y, sr = librosa.load(file_path)
tempo, beat_frames = librosa.beat.beat_track(y=y, sr=sr)
result_label.config(text=f"Tempo: {tempo:} BPM")
detect_key(file_path)
-
the issue seems to be that bla calls blabla that calls bla that uses the aifc module which is deprecated in python3.13
-
Not related, y, sr = librosa.load(file_path) is called twice, once in process_audio_file which is called in open_file_dialogue and in open_file_dialog itself to sort it in the bpm ranges
- this is a separate issue. I noticed that this process was slow before and couldn't figure out why, it may be because the file is being analyzed twice when I can use the bpm from when its detected to sort it. This is a separate issue though -
It seems as though the issue can be explained like this
- When I call librosa it looks for the available backends, the main one being audioread
- In
/home/$USER/.local/lib/python3.13/site-packages/audioread/__init__.pythe module rawread is called which itself calls aifc in line 16 - So the point of error seems to be rawread
aifcmodule is deprecated (and removed in Python 3.13) beetbox/audioread#144
Fixing:
- Fixing the issue requires the user to download "standard-[afic,sunau]" through pip (Im not sure if the python-xyz package is avaliable in distributions like debian and arch but for Fedora and windows it works)
- Even though I think only aifc is required for my use case both need to be installed for the program to work
- Ill need to investigate further and see if there's a different or/and better way to fix this
Metadata
Metadata
Assignees
Labels
No labels