mrkrd/cochlea

Cannot run demo, getting float>integer issue

Opened this issue · 0 comments

I'm having an issue running the demos. I'm running the demo in a Jupyter Notebook, but when I get to generating a tone, I get this error, which seems to be coming from numpy's ramped_tone() function. Any chance you know how to get around this?

`
TypeError Traceback (most recent call last)
in
1 fs = 100e3
2 cf = 1000
----> 3 tone = wv.ramped_tone(
4 fs=fs,
5 freq=1000,

/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/thorns/waves.py in ramped_tone(fs, freq, duration, pad, pre, ramp, dbspl, phase)
169
170 if ramp != 0:
--> 171 ramp_signal = np.linspace(0, 1, np.ceil(ramp * fs))
172 s[0:len(ramp_signal)] = s[0:len(ramp_signal)] * ramp_signal
173 s[-len(ramp_signal):] = s[-len(ramp_signal):] * ramp_signal[::-1]

/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/numpy/core/overrides.py in linspace(*args, **kwargs)

/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/numpy/core/function_base.py in linspace(start, stop, num, endpoint, retstep, dtype, axis)
118
119 """
--> 120 num = operator.index(num)
121 if num < 0:
122 raise ValueError("Number of samples, %s, must be non-negative." % num)

TypeError: 'numpy.float64' object cannot be interpreted as an integer
`