Open rilshok opened 1 year ago
Quick note on play_record
: you can do record.to_cut().play_audio()
.
The problem here is that you are adding a transform to the Recording
which changes its duration and num_samples at the time of loading, but you have not made these changes in the manifest. If you look at the implementation of perturb_speed
here, you can see that we also update the samples and duration when using the Speed
transform.
It seems that a good solution would be to redesign the augmentation base class so that the job of recalculating num_samples is taken over by the AudioTransform heir class.
I don't think that's a good solution. The augmentation classes only work on the audio, not the associated metadata, and they should not modify the Recording object itself. That modification should be done from a member function of the Recording class.
I am encountering an issue when applying length change augmentation in
Recording
class. Specifically, I'm facing difficulties with theSpeed
augmentation, which is expected to modify the number of samples in the audio.Steps to Reproduce
Import Lhotse and necessary modules.
Define an audio source and create a recording with specific attributes:
Apply the `ReverbWithImpulseResponse`` augmentation to the Record object. No problems occurred, the augmentation works as expected:
Apply the
Speed
transformation and catch an exception when trying to apply augmentation:Expected Behavior
I expect the audio transformation to be applied successfully, altering the length of the recording as specified by the transformation parameters, and that I can play the transformed audio without errors.
Actual Behavior
I encounter the ValueError mentioned above when attempting to apply the "Speed" transformation or a custom transformation that alters the audio length.
Additional information
Volume
.AudioTransform
class.Am I trying to apply augmentation to the Recording object correctly? I would like to be able to inherit my own lazy augmentation by inheriting from the
AudioTransform
class.