librosa: librosa.load (audioread) breaks on this audio file, not sure why?
Calling librosa.load('101729.wav', sr=None) (download file here) gives the following error:
---------------------------------------------------------------------------
error Traceback (most recent call last)
<ipython-input-172-5d71d5777356> in <module>()
----> 1 audio, sr = librosa.load('101729.wav', sr=None)
/Users/justin/dev/miniconda3/envs/py27/lib/python2.7/site-packages/librosa/core/audio.pyc in load(path, sr, mono, offset, duration, dtype)
121 n = 0
122
--> 123 for frame in input_file:
124 frame = util.buf_to_float(frame, dtype=dtype)
125 n_prev = n
/Users/justin/dev/miniconda3/envs/py27/lib/python2.7/site-packages/audioread/rawread.pyc in read_data(self, block_samples)
110
111 # Make sure we have the desired bitdepth and endianness.
--> 112 data = audioop.lin2lin(data, old_width, TARGET_WIDTH)
113 if self._needs_byteswap and self._file.getcomptype() != 'sowt':
114 # Big-endian data. Swap endianness.
error: Size should be 1, 2 or 4
Must be something about the file’s format that causes the problem, though I’m not sure what. Here’s the file info (as returned by pysox):
{'bitrate': 24,
'channels': 2,
'duration': 84.580021,
'encoding': 'Signed Integer PCM',
'num_samples': 4059841,
'sample_rate': 48000.0,
'silent': False}
About this issue
- Original URL
- State: closed
- Created 8 years ago
- Comments: 21 (5 by maintainers)
@pratistha you mentioned
pyaudio, but my solution was to usepysoundfile(pip install pysoundfile). Then loading the audio is just:Hope this helps!
To quote brmcfee, please refer to this thread https://groups.google.com/d/topic/librosa/Z1-HXBsHLi0/discussion.
DAn.
On Wed, Jul 12, 2017 at 3:53 AM, Khalidhussain1134 <notifications@github.com
I have installed decoding library ffmpeg as mentioned in the group “https://groups.google.com/d/topic/librosa/Z1-HXBsHLi0/discussion”
Now it is working, thank you
This is actually Python2’s audioop.lin2lin issue, which cannot handle 3-byte input. Python3 may handle this.