Closed mepc36 closed 1 year ago
If I install ffmpeg I get new errors, although with the same first one (about .features_tmp.json` not existing):
>>> boundaries, labels = msaf.process(audio_file)
/usr/local/lib/python3.9/site-packages/msaf/base.py:360: UserWarning: PySoundFile failed. Trying audioread instead.
self._audio, _ = librosa.load(self.file_struct.audio_file,
/usr/local/lib/python3.9/site-packages/librosa/core/audio.py:184: FutureWarning: librosa.core.audio.__audioread_load
Deprecated as of librosa version 0.10.0.
It will be removed in librosa version 1.0.
y, sr_native = __audioread_load(path, offset, duration, dtype)
Traceback (most recent call last):
File "/usr/local/lib/python3.9/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'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/local/lib/python3.9/site-packages/msaf/base.py", line 415, in features
self.read_features()
File "/usr/local/lib/python3.9/site-packages/msaf/base.py", line 281, in read_features
raise NoFeaturesFileError("Could not find features file %s",
msaf.exceptions.NoFeaturesFileError: ('Could not find features file %s', '.features_msaf_tmp.json')
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python3.9/site-packages/msaf/run.py", line 342, in process
est_times, est_labels = run_algorithms(file_struct, boundaries_id,
File "/usr/local/lib/python3.9/site-packages/msaf/run.py", line 199, in run_algorithms
if config["features"].features.shape[0] <= msaf.config.minimum_frames:
File "/usr/local/lib/python3.9/site-packages/msaf/base.py", line 419, in features
self._compute_all_features()
File "/usr/local/lib/python3.9/site-packages/msaf/base.py", line 370, in _compute_all_features
self._compute_framesync_times()
File "/usr/local/lib/python3.9/site-packages/msaf/base.py", line 353, in _compute_framesync_times
self._framesync_times = librosa.core.frames_to_time(
TypeError: frames_to_time() takes 1 positional argument but 3 were given
The .features_msaf_tmp.json
is a temporary file created by MSAF to store the features of the given audio file during single mode. My guess is that you don't have write permissions on that given folder. You can update the path of that file by doing the following:
import msaf
msaf.config.features_tmp_file = "<desired/path>"
boundaries, labels = msaf.process(audio_file)
See more info here: https://pythonhosted.org/msaf/config.html
I also found temp feature file does not exist problem, I tried to configure features_tmp_file but it still can't create temp feature file.
Is there any other suggestion? BTW, I use python 3.7
That's weird, can you double check that your tmp file is properly created? If so, can you actually open it? (Maybe it's corrupt?)
No, the temp file didn't create. No matter what path I set.
Can you verify that MSAF has writing permissions wherever you're trying to create the file?
I think it has writing permission because there's no warning message from my macOS while I run the program. I also tried to run it in Visual Studio Code, Terminal, and Terminal Sudo mode, but none of it worked. And I tried to run it on my Windows desktop, it's the same.
File "/.venv/lib/python3.7/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'
Hi Urinieto, I fixed this issue. The root cause is that when using some functions in librosa, we need to modify our code like below (Maybe it's because I use the newer librosa version.)
from
S = librosa.feature.melspectrogram(self._audio, sr=self.sr, n_fft=self.n_fft, hop_length=self.hop_length, n_mels=self.n_mels)
self._framesync_times = librosa.core.frames_to_time( np.arange(self._framesync_features.shape[0]), self.sr, self.hop_length)
to
S = librosa.feature.melspectrogram(y=self._audio, sr=self.sr, n_fft=self.n_fft, hop_length=self.hop_length, n_mels=self.n_mels)
self._framesync_times = librosa.core.frames_to_time( frames=np.arange(self._framesync_features.shape[0]), sr=self.sr, self.hop_length)
to prevent positional arguments error. The error causes json file didn't write properly because the feature didn't generate.
Oh, good finding! Yeah, MSAF requires librosa 0.6.1, as stated in the requirements.txt. Closing this for now.
MSAF is unable to locate both .wav and .mp3 files.
I'm attempting to call MSAF as a child process of Node.js inside a Docker container.
More specifically, I'm running this command...
...that calls this script:
IPython.display.Audio(filename=audio_file)
evaluates into an Audio object fine, but whenmsaf.process(..)
runs, the following error gets thrown:I'm also running this inside a Docker container. This is that container's Dockerfile:
Yes, this means I have to manually edit vol.py & sivm_search.py to fix the import of factorial in scipy (see #119 for more info).
When I
ls
thetmp
folder where the audio file is supposed to be located, the file is indeed there:And when I call path.is_file() inside Python as well, the file also exists.
Any help? Thank you!