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

Create a custom audio transformation #1338

Open
njellinas opened this issue May 14, 2024 · 1 comment
Open

Create a custom audio transformation #1338

njellinas opened this issue May 14, 2024 · 1 comment

Comments

@njellinas
Copy link

How can I create a custom audio transformation that can be applied to a CutSet?
E.g. I want to apply torchaudio.sox_effects.apply_effects_tensor(y, sr, [["norm", f"{gain:.2f}"]])
How can I apply this transformation to every cut in a CutSet?

@pzelasko
Copy link
Collaborator

You'd define a transform class for that and add the relevant methods to recording/cut. You can see this PR for an end-to-end example: https://github.com/lhotse-speech/lhotse/pull/382/files#diff-add451896faa625c1820580ab6ad64bef75e2886d551efc0f5705100ea62b28a

These transforms are intended mostly for ops that affect the metadata (eg perturb speed). It might be easier to edit your dataset class and apply it there directly on the audio tensor.

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