Skip to content

Instantly share code, notes, and snippets.

@iCorv
Created October 3, 2021 13:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save iCorv/e9479826787f932f1e969d5d62dbdc86 to your computer and use it in GitHub Desktop.
Save iCorv/e9479826787f932f1e969d5d62dbdc86 to your computer and use it in GitHub Desktop.
Wrapper for using a Pedalboard transformation inside a tf.data map call.
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