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

Bug in sweep generator #69

Closed
asceenl opened this issue Feb 14, 2018 · 1 comment
Closed

Bug in sweep generator #69

asceenl opened this issue Feb 14, 2018 · 1 comment

Comments

@asceenl
Copy link
Contributor

asceenl commented Feb 14, 2018

When changing the sweep period, we get the following error:

Traceback (most recent call last):
File "/usr/lib/python3.6/site-packages/sounddevice.py", line 733, in callback_ptr
return _wrap_callback(callback, data, frames, time, status)
File "/usr/lib/python3.6/site-packages/sounddevice.py", line 2508, in _wrap_callback
callback(*args)
File "./friture/generator.py", line 251, in audio_callback
floatdata = generator.signal(t)
File "./friture/generators/sweep.py", line 108, in signal
result[firstmaxpos:] = np.cos(self.K * (np.exp((t[firstmaxpos:] - self.timeoffset) % self.T / self.L) - 1.))
TypeError: only integer scalar arrays can be converted to a scalar index

It turns out that the firstmaxpos from np.argwhere needs to be indexed one more to find the right value:
Line 101 of sweep.py:
firstmaxpos = np.argwhere(maxdetection != 0.)[0][0] + 1
instead of
firstmaxpos = np.argwhere(maxdetection != 0.)[0] + 1

@tlecomte
Copy link
Owner

tlecomte commented Mar 19, 2018

This has now been released as part of Friture 0.34:
https://github.com/tlecomte/friture/releases/tag/v0.34.1

Thank you very much for this contribution! I'm now closing the issue.

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