You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A question came up on a discord server I'm in (Ref), as to whether it's possible to connect a VST instrument as the 'input' of an AudioStream; or if not, some other method of allowing to stream the instrument to an output device.
The example for live audio seems to show using both an input/output device, and applying an effects chain:
And the docs seem to show that input/output device usage, as well as 'synchronous use', where an ogg_buffer is passed in (but it's not super clear where the output of that goes when .run() is called:
with AudioStream(input_device_name, output_device_name) as stream:
# In this block, audio is streaming through `stream`!
# Audio will be coming out of your speakers at this point.
# Add plugins to the live audio stream:
reverb = Reverb()
stream.plugins.append(reverb)
# Change plugin properties as the stream is running:
reverb.wet_level = 1.0
# Delete plugins:
del stream.plugins[0]
:class:`AudioStream` may also be used synchronously::
stream = AudioStream(ogg_buffer)
stream.plugins.append(Reverb(wet_level=1.0))
stream.run() # Run the stream until Ctrl-C is received
.. note::
This class uses C++ under the hood to ensure speed, thread safety,
and avoid any locking concerns with Python's Global Interpreter Lock.
Audio data processed by :class:`AudioStream` is not available to
Python code; the only way to interact with the audio stream is through
the :py:attr:`plugins` attribute.
.. warning::
The :class:`AudioStream` class implements a context manager interface
to ensure that audio streams are never left "dangling" (i.e.: running in
the background without being stopped).
While it is possible to call the :meth:`__enter__` method directly to run an
audio stream in the background, this can have some nasty side effects. If the
:class:`AudioStream` object is no longer reachable (not bound to a variable,
not in scope, etc), the audio stream will continue to play back forever, and
won't stop until the Python interpreter exits.
To run an :class:`AudioStream` in the background, use Python's
:py:mod:`threading` module to call the synchronous :meth:`run` method on a
background thread, allowing for easier cleanup.
*Introduced in v0.7.0. Not supported on Linux.*
"""
def__enter__(self) ->AudioStream:
"""
Use this :class:`AudioStream` as a context manager. Entering the context manager will immediately start the audio stream, sending audio through to the output device.
Start streaming audio from input to output, passing the audio stream through the :py:attr:`plugins` on this AudioStream object. This call will block the current thread until a :py:exc:`KeyboardInterrupt` (``Ctrl-C``) is received.
"""
@property
defplugins(self) ->pedalboard_native.utils.Chain:
"""
The Pedalboard object that this AudioStream will use to process audio.
Asking ChatGPT, it suggested using another external library such as the following, and using that on the output from the instrument, to stream it to the desired output device:
To clarify what's meant by this ... Is the issue that VST3Plugin.process when passed with MIDI notes returns the entire duration worth of audio rather than buffer-sized chunks?
A question came up on a discord server I'm in (Ref), as to whether it's possible to connect a VST instrument as the 'input' of an
AudioStream
; or if not, some other method of allowing to stream the instrument to an output device.The example for live audio seems to show using both an input/output device, and applying an effects chain:
And the docs seem to show that input/output device usage, as well as 'synchronous use', where an
ogg_buffer
is passed in (but it's not super clear where the output of that goes when.run()
is called:Attempting to look at the underlying code didn't help me figure out any better if it was possible:
pedalboard/pedalboard_native/io/__init__.pyi
Lines 219 to 323 in 9ab77d3
pedalboard/pedalboard/python_bindings.cpp
Line 67 in 9ab77d3
Asking ChatGPT, it suggested using another external library such as the following, and using that on the output from the instrument, to stream it to the desired output device:
See Also
The text was updated successfully, but these errors were encountered: