Librosa 0.7.1 load() gives Malformed 'fmt ' chunk (worked in 0.7.0)
See original GitHub issueDescription
In v0.7.0 company_sensitive.wav worked, but with v0.7.1 throws an “Malformed 'fmt ’ chunk.” error. Unfortunately I’m not able to provide said file, but I’ll try to find another one / remove sensitive data later.
Steps/Code to Reproduce
import librosa
aud, sr = librosa.load(Path("/egg/foo.wav"), sr=None, mono=False)
Expected Results
No output, and aud
to contain numpy formatted audio data.
Actual Results
Error opening '/egg/foo.wav': Error in WAV/W64/RF64 file. Malformed 'fmt ' chunk.
Traceback (most recent call last):
File "/opt/conda/lib/python3.7/site-packages/airflow/models/taskinstance.py", line 922, in _run_raw_task
result = task_copy.execute(context=context)
File "/opt/conda/lib/python3.7/site-packages/airflow/operators/python_operator.py", line 113, in execute
return_value = self.execute_callable()
File "/opt/conda/lib/python3.7/site-packages/airflow/operators/python_operator.py", line 118, in execute_callable
return self.python_callable(*self.op_args, **self.op_kwargs)
File "/usr/local/airflow/dags/scripts_processing/*company*/audio_parser.py", line 187, in start
return task_class.audio_parser(kwargs['params']["expected_sr"])
File "/usr/local/airflow/dags/scripts_processing/*company*/audio_parser.py", line 65, in audio_parser
audio_concat, file_metadata = self.combine_audio(audio_folder[0], sr_expected=expected_sr)
File "/usr/local/airflow/dags/scripts_processing/*company*/audio_parser.py", line 109, in combine_audio
aud, sr = librosa.load(audio_file, sr=None, mono=False)
File "/opt/conda/lib/python3.7/site-packages/librosa/core/audio.py", line 149, in load
six.reraise(*sys.exc_info())
File "/opt/conda/lib/python3.7/site-packages/six.py", line 696, in reraise
raise value
File "/opt/conda/lib/python3.7/site-packages/librosa/core/audio.py", line 129, in load
with sf.SoundFile(path) as sf_desc:
File "/opt/conda/lib/python3.7/site-packages/soundfile.py", line 627, in __init__
self._file = self._open(file, mode_int, closefd)
File "/opt/conda/lib/python3.7/site-packages/soundfile.py", line 1182, in _open
"Error opening {0!r}: ".format(self.name))
File "/opt/conda/lib/python3.7/site-packages/soundfile.py", line 1355, in _error_check
raise RuntimeError(prefix + _ffi.string(err_str).decode('utf-8', 'replace'))
RuntimeError: Error opening '/egg/foo.wav': Error in WAV/W64/RF64 file. Malformed 'fmt ' chunk.
Versions
Using Anaconda
Broken v0.7.1
Linux-4.15.0-65-generic-x86_64-with-debian-buster-sid Python 3.7.5 (default, Oct 25 2019, 15:51:11) [GCC 7.3.0] NumPy 1.17.3 SciPy 1.3.2 librosa 0.7.1
Working v0.7.0
Linux-4.15.0-65-generic-x86_64-with-debian-buster-sid Python 3.7.5 (default, Oct 25 2019, 15:51:11) [GCC 7.3.0] NumPy 1.17.3 SciPy 1.3.1 librosa 0.7.0
Issue Analytics
- State:
- Created 4 years ago
- Comments:14 (14 by maintainers)
Top Results From Across the Web
Advanced I/O Use Cases — librosa 0.10.0.dev0 documentation
Advanced I/O Use Cases¶. This section covers advanced use cases for input and output which go beyond the I/O functionality currently provided by...
Read more >April 2018 - devel - Fedora Mailing-Lists
I have the yarrow's iso files on my HD in a RH9 system. Let's say I want to upgrade selected packages using an...
Read more >Issues-librosa/librosa - PythonTechWorld
Librosa 0.7.1 load() gives Malformed 'fmt ' chunk (worked in 0.7.0). 888. Description In v0.7.0 company_sensitive.wav worked, but with v0.7.1 throws an ...
Read more >Not able to install librosa - Stack Overflow
First, update setuptools and wheel python3 -m pip install --upgrade pip setuptools wheel. Second python setup.py bdist_wheel. Try to install the ...
Read more >librosa - PyPI
Hints for the Installation. librosa uses soundfile and audioread to load audio files. Note that soundfile does not currently support MP3 ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
The following steps reproduce the error in
0.7.1
, but not in0.7.0
curl https://file-examples.com/wp-content/uploads/2017/11/file_example_MP3_700KB.mp3 --output sample.mp3
0.7.0
and0.7.1
(2x):librosa_regression.py
with the following code:v0.7.0
: Worksv0.7.1
: Broken@bmcfee It was indeed pathlib!
Since the error is not very helpful to find the source of the problem,
sf.SoundFile(path)
does accept pathlib, and it is better to not push the responsibility to fix it on the user, I added a converter from pathlib object to String (see pull request above). Basically it comes down to: Python 3.6+:path = os.fspath(path)
Python 3.4+:path = str(path)
When Librosa 0.8.x comes around, this temporary fix can be removed, and only this has to change (also mentioned in the pull request):
https://github.com/librosa/librosa/blob/7feb1efdbc9f0c61fbee623fc03fa62410113927/librosa/core/audio.py#L142-L164