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

Add a parameter augment_copy to the augment_score function #221

Merged
merged 2 commits into from
Feb 14, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion src/miditok/data_augmentation/data_augmentation.py
Original file line number Diff line number Diff line change
Expand Up @@ -257,6 +257,7 @@ def augment_score(
velocity_range: tuple[int, int] = (1, 127),
duration_in_ticks: bool = False,
min_duration: int | float = 0.03125,
augment_copy: bool = True,
) -> Score:
r"""
Augment a Score object by shifting its pitch, velocity and/or duration values.
Expand Down Expand Up @@ -284,9 +285,12 @@ def augment_score(
:param min_duration: minimum duration limit to apply if ``duration_offset`` is
negative. If ``duration_in_ticks`` is ``True``, it must be given in ticks,
otherwise in beats as a float or integer. (default: ``0.03125``)
:param augment_copy: if given True, a copy of the input ``symusic.Score`` object is
augmented and returned. If False, the input ``symusic.Score`` object is modified
in-place. (default: ``True``)
:return: the augmented ``symusic.Score`` object.
"""
score_aug = score.copy()
score_aug = score.copy() if augment_copy else score
# score_aug = score.copy(deep=True)

if pitch_offset != 0:
Expand Down
Loading