urinieto / msaf

Music Structure Analysis Framework
MIT License
501 stars 79 forks source link

MSAF error: Computation of the features is needed for current parameters but no audio file was found. #145

Closed StevenJBorik closed 1 year ago

StevenJBorik commented 1 year ago

Hi, I've been using this for a couple months within a Python API but as of recently when I try to analyze a new audio file I get the following error:

MSAF error: Computation of the features is needed for current parameters but no audio file was found.Please, change your parameters or add the audio file in /location/file.mp3.

The file is indeed in the location, playable, and not corrupted. The behavior I'm noticing is that my features_msaf_tmp.json only has 1 set of features for a song in it, and when I upload that song, it processes it correctly, but when I add a new song I receive the title error, and the json file still has the data for the previous song. If I try to remove the json file in hopes of the library generating a new one for the new song, I expectedly get:

Traceback (most recent call last): File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/msaf/base.py", line 220, in read_features with open(self.file_struct.features_file) as f: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ FileNotFoundError: [Errno 2] No such file or directory: '.features_msaf_tmp.json'

Next, I attempted to reproduce from scratch the using the starter code below, but still get the same error as no features_msaf_temp.json is generated.

It's not immediately clear to me how I should approach debugging this from the documentation. Any help would be immensely appreciated. Below is the starter example I reference earlier.

from future import print_function import msaf

audio_file = "Very Ape.mp3"

boundaries, labels = msaf.process(audio_file) print('Estimated boundaries:', boundaries)

out_file = 'segments.txt' print('Saving output to %s' % out_file) msaf.io.write_mirex(boundaries, labels, out_file)

try: evals = msaf.eval.process(audio_file) print(evals) except msaf.exceptions.NoReferencesError: file_struct = msaf.input_output.FileStruct(audio_file) print("No references found in {}. No evaluation performed.".format( file_struct.ref_file))

urinieto commented 1 year ago

Can you check if this fixes your problem? https://github.com/urinieto/msaf/issues/120#issuecomment-1469284644

StevenJBorik commented 1 year ago

Thanks for the quick response Urinieto! I'll try this later tonight and let you know.

StevenJBorik commented 1 year ago

Hey Urinieto, I'm going to go through the rest of my other requirements versions tomorrow, but after going from librosa 0.10.1 to 0.6.1:

pip3 show librosa Name: librosa Version: 0.6.1

I get a this error that I need to investigate more, both in this test script and the same in my API using this.

python3 msafTest.py Traceback (most recent call last): File "/Users/stev/Dev/msafTest.py", line 3, in import msaf File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/msaf/init.py", line 20, in from . import features File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/msaf/features.py", line 19, in import librosa File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/librosa/init.py", line 12, in from . import core File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/librosa/core/init.py", line 104, in from .time_frequency import # pylint: disable=wildcard-import ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/librosa/core/time_frequency.py", line 10, in from ..util.exceptions import ParameterError File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/librosa/util/init.py", line 67, in from .utils import # pylint: disable=wildcard-import ^^^^^^^^^^^^^^^^^^^^ File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/librosa/util/utils.py", line 110, in @cache(level=20) ^^^^^^^^^^^^^^^ File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/librosa/cache.py", line 49, in wrapper if self.cachedir is not None and self.level >= level: ^^^^^^^^^^^^^ AttributeError: 'CacheManager' object has no attribute 'cachedir'

urinieto commented 1 year ago

Please, consider downgrading to Python 3.9. Python 3.11 has been giving me some problems of compatibility with some scientific packages.

StevenJBorik commented 1 year ago

Gotcha, I will try this as well and keep this thread posted. Thanks again!

StevenJBorik commented 1 year ago

Hey Urinieto, downgrading to python 3.9 and keeping librosa at 0.10 seems to be the trick for me. Moving librosa down to 0.6.1 still gives me the same error but with .10 and 3.9 I'm not getting any errors after multiple tests, I'm going to close the ticket. Thanks so much for your help, this library is awesome. Working on an exciting project and this is essential.

urinieto commented 1 year ago

So happy to hear! Thanks for reporting :)