-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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 fix for repitching & tempo automix errors #593
base: main
Are you sure you want to change the base?
Conversation
…py.ndarray.__format__`
This fixes `AttributeError: module 'scipy.signal' has no attribute 'hann'` that occurs when trying to augment data using `automix.py`. In librosa version 0.10.2.dev0, the `__trim_beats` in beat.py no longer uses scipy for hanning computation & now uses `np.hanning` instead.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
First of all, please open this pull request to adefossez/demucs
And, please don't add this requirement to requirements.txt
. It is only required when training the model.
@CarlGao4 Thanks for the feedback.
This is a bug fix and not a pull request for a new feature, which is why I opened this PR. As for the
This can be confirmed by inspecting the extras_require={
'dev': ALL_REQUIRED,
},
install_requires=REQUIRED, where: REQUIRED = load_requirements('requirements_minimal.txt')
ALL_REQUIRED = load_requirements('requirements.txt') |
Fix README.md instructions for machine learning scientists, so that the training requirements/dependencies actually get installed.
Sorry that's my mistake. But did you add this requirement to |
`-12` should have been `-0.12` but the comment was redundant, so I removed it.
@CarlGao4, No problem... It happens. 😉
No, not yet... Long Answer:
However, I do agree that once version |
Maybe you should upgrade Python and numpy? (Like Python 3.9 and numpy 1.25.2 which is distributed with PyPI, not conda) |
Fix for repitching
TypeError: unsupported format string passed to numpy.ndarray.__format__
error:and fix for
AttributeError: module 'scipy.signal' has no attribute 'hann'
:Explanation of code changes:
Conditional Application:
The check
(dt != 0 or dp != 0)
ensures thatrepitch
is only called if there is a change to be made, saving computational resources if the audio is to remain unaltered.Type and Size Validation for
dt
:It ensures that dt is a scalar by checking its type and size, which is crucial for correct format string usage in the
repitch
function's command construction.Percentage Conversion:
The
tempo_percentage_change
calculation transformsdt
from a decimal representation (e.g.,-0.12
for a tempo slowing to 88% of the original) into the format expected by therepitch
function (e.g.,-12
to represent the same).Application of Changes:
Calls
repitch
with the correct parameters, including checking if the current track is the voice track (assumed to be at index 3).Onset Adjustment:
Adjusts the
onsets
of thespec
to account for the new tempo. The onsets must be scaled by the reciprocal of(1 + dt)
because a negativedt
implies a reduction in speed (and hence longer duration between onsets).