Scipy wav file format not understood error

See original GitHub issue

<<Please describe the issue in detail here, and for bug reports fill in the fields below.>>

I had 2 wav files , that I had been using since the past , and they work perfectly with scipy wave read function , but when I added a new file , it threw following error

Traceback (most recent call last):
  File "multidata.py", line 83, in <module>
    fs[i], audio[i] = wav.read(audio_filename[i])
  File "/home/saurabh/anaconda3/envs/py27/lib/python2.7/site-packages/scipy/io/wavfile.py", line 236, in read
    file_size, is_big_endian = _read_riff_chunk(fid)
  File "/home/saurabh/anaconda3/envs/py27/lib/python2.7/site-packages/scipy/io/wavfile.py", line 168, in _read_riff_chunk
    "understood.".format(repr(str1)))
ValueError: File format '<htm'... not understood.

I have tried recording with sox , arecord and audacity , also made sure there is no metadata , I have also tried all possible settings like mono , 16 bit , 16000 hertz etc , It doesn’t work , even the settings matching with two wav files which the function is able to read

Reproducing code example:

<<A short code example that reproduces the problem. It should be self-contained, i.e., possible to run as-is via 'python myproblem.py'>>

for i,j in enumerate(wav_files): print (i,j) audio_filename[i] = maybe_download(j + ‘.wav’) print ( audio_filename[i]) #print (audio_filename) target_filename[i] = maybe_download(j + ‘.txt’) fs[i], audio[i] = wav.read(audio_filename[i]) #print (audio[i])

maybe_download is a function that checks if file exists locally , otherwise downloads it

Error message:

<<Full error message, if any (starting from line Traceback: ...)>>

Scipy/Numpy/Python version information:

<<Output from 'import sys, scipy, numpy; print(scipy.__version__, numpy.__version__, sys.version_info)'>>

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:13 (3 by maintainers)

github_iconTop GitHub Comments

4reactions
WarrenWeckessercommented, Jul 29, 2017

From the error message ValueError: File format '<htm'... not understood., I strongly suspect your file is not a WAV file, and is likely an HTML file. Have you looked at the contents of the file? Try viewing it in an editor.

1reaction
endolithcommented, Sep 29, 2022

@Aliktk Seems like a question to ask on Stack Overflow, not here

Read more comments on GitHub >

github_iconTop Results From Across the Web

Python WAV "TypeError: data type not understood" error
I received the error "TypeError: data type not understood". The code worked perfectly for a different .wav file, and I'd like to know...
Read more >
scipy.io.wavfile.read — SciPy v1.9.3 Manual
WAV files can specify arbitrary bit depth, and this function supports reading any integer PCM depth from 1 to 64 bits. Data is...
Read more >
Help understanding scipy warning when reading a wav file.
So I have a project to do for college that involve me reading a wav file and then performing an FFT of the...
Read more >
io/wavfile.py · stream/scipy - Gemfury
Module to read / write wav files using numpy arrays Functions --------- `read`: Return the sample rate (in samples/sec) and data from a...
Read more >
Training Error due to file formatting - Mozilla Discourse
... as “ValueError: File format b'\x1aE\xdf\xa3'… not understood. ... While i understand there is wav file formatting problem for which i ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found