-
Notifications
You must be signed in to change notification settings - Fork 973
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
Fix time stretch round error #1881
base: main
Are you sure you want to change the base?
Conversation
Thanks for this, but I'm not sure why it's necessary. The line in question: Line 395 in d5aa7e1
Operates on two float values: y.shape[-1] and rate . In what case could either of these be an ndarray?
|
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #1881 +/- ##
=======================================
Coverage 98.73% 98.73%
=======================================
Files 35 35
Lines 4656 4656
=======================================
Hits 4597 4597
Misses 59 59
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚨 Try these New Features:
|
I am getting the bpm's of the songs with |
Ah I see - I hadn't considered plugging tempo estimates into the time_stretch like you're doing. That makes sense. There are other bits of this function that will not be correct if |
Finally circling back on this after a hectic couple of months. I'm actually unable to reproduce the behavior that motivated the change here. Can you fill in the issue template and document your environment, specifically the version of numpy you're using? On 1.26.4, I can do the following without issue: >>> import numpy as np
>>> y = np.random.randn(2, 200)
>>> rate = 1.5
>>> int(round(y.shape[-1] / rate))
133
>>> int(np.round(y.shape[-1] / rate))
133
>>> rate = np.array(1.5) # Force rate to be an array
>>> int(round(y.shape[-1] / rate))
133
>>> int(np.round(y.shape[-1] / rate))
133 Does this not work in numpy 2.x or something? Or, is it the case that your |
This PR fixes a TypeError in the
time_stretch
function whereround()
was applied to an ndarray inappropriately. The fix replacesround()
withnp.round()
to handle the numpy arrays correctly.The error message was:
TypeError: type numpy.ndarray doesn't define __round__ method
.Changes:
time_stretch
function ineffects.py
to usenp.round()
instead ofround()
.AUTHORS.md
to add Orkun Kınay as collaborator.