spotify / pedalboard

🎛 🔊 A Python library for audio.
https://spotify.github.io/pedalboard
GNU General Public License v3.0
5.23k stars 262 forks source link

How is tempo set? [question] #158

Open rhelsing opened 2 years ago

rhelsing commented 2 years ago

I cant find anywhere in the documentation where tempo can be established. I have loaded a vst3 delay plugin and having an input tempo is critical to have the plugin perform appropriately.

psobot commented 2 years ago

You're correct - tempo isn't provided to plugins, as Pedalboard doesn't have a concept of musical tempo (or most other musical concepts that DAWs use, for that matter).

If it's not possible to set a delay length in milliseconds with your plugin, Pedalboard could be modified to allow providing tempo when process() is called; the underlying C++ framework (JUCE) seems to support providing tempo to plugins, and plumbing that value through to Python should be possible.

rhelsing commented 2 years ago

@psobot I'd love to help with a PR on this if you could provide a little more detail on where to start?

psobot commented 2 years ago

Sure! Without having dug too deeply yet, it looks like you’d have to:

There’s a different approach that could also work, but would be a bit harder: we could add a tempo_bpm property to the process method on all plugins, then have the VSTPlugin class receive that data when process is called. That would be more intuitive for users (as all plugins should probably share the same tempo), but may be a more difficult change.