|
| 1 | +Frequently Asked Questions |
| 2 | +-------------------------- |
| 3 | + |
| 4 | +Can Pedalboard be used with live (real-time) audio? |
| 5 | +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ |
| 6 | + |
| 7 | +As of version 0.7.0, yes! See the :class:`pedalboard.io.AudioStream` class for more details. |
| 8 | + |
| 9 | + |
| 10 | +Does Pedalboard support changing a plugin's parameters over time? |
| 11 | +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ |
| 12 | + |
| 13 | +Yes! While there's no built-in function for this, it is possible to |
| 14 | +vary the parameters of a plugin over time manually: |
| 15 | + |
| 16 | +.. code-block:: python |
| 17 | +
|
| 18 | + from pedalboard.io import AudioFile |
| 19 | + from pedalboard import Pedalboard, Compressor, Reverb |
| 20 | + from tqdm import tqdm |
| 21 | +
|
| 22 | + board = Pedalboard([Compressor(), Reverb()]) |
| 23 | + reverb = board[1] |
| 24 | +
|
| 25 | + # Smaller step sizes would give a smoother transition, |
| 26 | + # at the expense of processing speed |
| 27 | + step_size_in_samples = 100 |
| 28 | +
|
| 29 | + # Manually step through the audio _n_ samples at a time, reading in chunks: |
| 30 | + with AudioFile("sample.wav") as af: |
| 31 | +
|
| 32 | + # Open the output audio file so that we can directly write audio as we process, saving memory: |
| 33 | + with AudioFile( |
| 34 | + "sample-processed-output.wav", "w", af.samplerate, num_channels=af.num_channels |
| 35 | + ) as o: |
| 36 | +
|
| 37 | + # Create a progress bar to show processing speed in real-time: |
| 38 | + with tqdm(total=af.frames, unit=' samples') as pbar: |
| 39 | + for i in range(0, af.frames, step_size_in_samples): |
| 40 | + chunk = af.read(step_size_in_samples) |
| 41 | +
|
| 42 | + # Set the reverb's "wet" parameter to be equal to the |
| 43 | + # percentage through the track (i.e.: make a ramp from 0% to 100%) |
| 44 | + percentage_through_track = i / af.frames |
| 45 | + reverb.wet_level = percentage_through_track |
| 46 | +
|
| 47 | + # Update our progress bar with the number of samples received: |
| 48 | + pbar.update(chunk.shape[1]) |
| 49 | +
|
| 50 | + # Process this chunk of audio, setting `reset` to `False` |
| 51 | + # to ensure that reverb tails aren't cut off |
| 52 | + output = board.process(chunk, af.samplerate, reset=False) |
| 53 | + o.write(output) |
| 54 | +
|
| 55 | +With this technique, it's possible to automate any parameter. Usually, using a step size of somewhere between 100 and 1,000 (2ms to 22ms at a 44.1kHz sample rate) is small enough to avoid hearing any audio artifacts, but big enough to avoid slowing down the code dramatically. |
| 56 | + |
| 57 | +Can Pedalboard be used with VST instruments, instead of effects? |
| 58 | +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ |
| 59 | + |
| 60 | +As of version 0.7.4, yes! See the :class:`pedalboard.VST3Plugin` and :class:`pedalboard.AudioUnitPlugin` classed for more details. |
| 61 | + |
| 62 | +Can Pedalboard plugins accept MIDI? |
| 63 | +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ |
| 64 | + |
| 65 | +As of version 0.7.4, both :class:`pedalboard.VST3Plugin` and :class:`pedalboard.AudioUnitPlugin` support passing MIDI |
| 66 | +messages to instrument plugins for audio rendering. However, effect plugins cannot yet be passed MIDI data. |
0 commit comments