Created
October 3, 2021 13:15
-
-
Save iCorv/e9479826787f932f1e969d5d62dbdc86 to your computer and use it in GitHub Desktop.
Wrapper for using a Pedalboard transformation inside a tf.data map call.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def get_pb_effect( | |
effect_type: str | |
) -> Callable[[tf.Tensor], np.ndarray]: | |
def pb_effect(y: tf.Tensor) -> np.ndarray: | |
y = y.numpy() | |
effect = getattr(pb, effect_type)() | |
y_out = effect(y, sample_rate=SR) | |
return y_out | |
return pb_effect |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment