Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

example does not work #7

Closed
xiaokebubu opened this issue Mar 26, 2018 · 2 comments
Closed

example does not work #7

xiaokebubu opened this issue Mar 26, 2018 · 2 comments

Comments

@xiaokebubu
Copy link

I installed cochlea-master on Windows 8 with Anaconda(python2.7 64-bit). It works successfully in jupyter notebook to processing a generated sound as shown in usage website. Then I am trying to run the example by using a sound file but there is something wrong.

C:\Users\Alice\Desktop\cochlea-master\cochlea-master\scripts>python run_zilany2014 --hsr=100 --msr=75 --lsr=25 --cf=1000 --species=human --seed=0 --dbspl=60 tone.wav
Processing tone.wav
Traceback (most recent call last):
File "run_zilany2014", line 162, in
main(args)
File "run_zilany2014", line 155, in main
space
File "run_zilany2014", line 108, in convert_sound_to_mat_unpack
convert_sound_to_mat(**args)
File "run_zilany2014", line 72, in convert_sound_to_mat
sound_raw = wv.resample(sound_raw, int(f.samplerate), int(fs))
File "C:\ProgramData\Anaconda3\envs\py27\lib\site-packages\thorns\waves.py", l
ine 100, in resample
new_signal = dsp.resample(signal, len(signal)*new_fs/fs)
File "C:\ProgramData\Anaconda3\envs\py27\lib\site-packages\scipy\signal\signal
tools.py", line 2203, in resample
Y = zeros(newshape, 'D')
TypeError: 'float' object cannot be interpreted as an index

I tried to transform the datatype into int

waves.py
100: new_signal = dsp.resample(signal, len(signal)*new_fs/fs)
replaced by: new_signal = dsp.resample(signal, int(len(signal)*new_fs/fs))

but then there were some other asserting problems.
(like "assert sound.ndim == 1". I checked my data, in which the sound.ndim=2).

I am new to python and I 'm not sure why this may be. Could you help me with it?

@mrkrd
Copy link
Owner

mrkrd commented Mar 26, 2018 via email

@xiaokebubu
Copy link
Author

Problem solved! Thanks very much for your help : ).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants