sprague252 / SVSound

GNU General Public License v3.0
0 stars 0 forks source link

icListen not working #2

Closed lanas1234 closed 1 year ago

lanas1234 commented 3 years ago

I've tried 2 different icListen wav files and none is working, this is the test code:

from __future__ import division
import numpy as np
import matplotlib.pyplot as plt
from SVSound import wavefile
info, data = wavefile.read('audio.wav',0,-1,'icListen')
info['chan']

When using audio.wav I got the error:

File "/opt/local/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/svsound-0.0.4-py3.6.egg/SVSound/recorders/icListen.py", line 76, in get_info
    icmt = info['ICMT'].split()
KeyError: 'ICMT'

When using testTone.wav I got the error:

  File "/opt/local/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/svsound-0.0.4-py3.6.egg/SVSound/recorders/icListen.py", line 62, in get_info
    raise ValueError('Chunk ID not LIST: ', data)
ValueError: ('Chunk ID not LIST: ', b'fmt ')

Any clue of what is happening?

sprague252 commented 3 years ago

You are telling the wavefile.read command that your file audio.wav was written by in icListen device, but it was not. It is generating an error when it does not find a chunk in the file that is written by icListen recorders. Try changing the read command to this, and it should work.

info, data = wavefile.read('audio.wav',0,-1)

Please let me know if this fixes it.

lanas1234 commented 3 years ago

Thanks for the answer

Yes, this fixes the error but the problem is that this audio actually came from an icListen device.. I've renamed the file and maybe copied from one folder to another, do you think this could change the header structure? When I click cmd+i to see the file info I still can see all the icListen headers: [image: Captura de pantalla 2021-03-02 a las 20.10.25.png]

All the best

El mar, 2 mar 2021 a las 20:06, Mark Sprague (notifications@github.com) escribió:

You are telling the wavefile.read command that your file audio.wav was written by in icListen device, but it was not. It is generating an error when it doest not find a chunk in the file that is written by icListen recorders. Try changing the read command to this, and it should work.

info, data = wavefile.read('audio.wav',0,-1)

Please let me know if this fixes it.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/sprague252/SVSound/issues/2#issuecomment-789142019, or unsubscribe https://github.com/notifications/unsubscribe-auth/AMMLP7UJIKFOY5JMOUAF663TBUZLPANCNFSM4YPNYPUA .

--

atlanTTic

research center for Telecommunication Technologies PhD/Researcher | David Santos Domínguez *Universidade de Vigo*dsantos@gts.uvigo.es dsantos@gts.uvigo.es | Tel. +34 669 391 921 | WEB http://atlanttic.uvigo.es/ · Profile http://gtm.uvigo.es/david-santos-dom%C3%ADnguez

sprague252 commented 3 years ago

Interesting ... I wrote the icListen part to open files written by my icListen recorder (model HF hydrophone). Yours may write files with a different format, perhaps due to newer firmware or because it is a different model.

The icListen header structure is internal to the WAV file and would not be changed by renaming or moving the file. If you send me a short WAV file recorded by your icListen device, I would be happy to take a look at it.

sprague252 commented 1 year ago

This icListen problems are fixed in version 0.1.0. The code was not correctly determining the address of the end of the file. Now it does.