Comments (2)
Hi @psytron!
Pedalboard has its own AudioStream
class that streams audio from an input device to an output device without passing the audio data through Python itself:
input_device_name = AudioStream.input_device_names[0]
output_device_name = AudioStream.output_device_names[0]
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]
It is technically possible to apply Pedalboard effects to live audio streams from other libraries like PyAudio, but I would strongly recommend against doing so: to pass the audio between any other library and Pedalboard, your code will implicitly take Python's Global Interpreter Lock, which will almost definitely cause dropped audio buffers, stuttering, or other audible errors at some point.
If you want to do so anyways, you'll have to:
- Read the audio from PyAudio in a loop (or callback)
- Convert the audio into 32-bit floating point on the range
[-1, 1]
- Pass that audio into your Pedalboard effect(s) as a
numpy
array, of shape(num_channels, num_samples)
, while also settingreset=False
to ensure the audio stream is unbroken - Convert the resulting array back into whichever format PyAudio requires
- Pass the resulting audio back into PyAudio
(But again; this will almost definitely stutter at some point, just due to how Python works under-the-hood.)
from pedalboard.
Thanks @psobot !!
Is there a way to solve the GIL issue you described by keeping the pedalboard on separate process?
Is there also another way to route the output stream of another process as virtual audio device or another method?
from pedalboard.
Related Issues (20)
- ML Examples with tf.data HOT 1
- plugin.process() takes 50x longer when synth produces no output. Process timeout? HOT 1
- Parameter Values HOT 4
- Using Pitch shift generates empty audio file HOT 3
- External VST3s not affecting live audio HOT 3
- Add Support for VST2 Plugins HOT 2
- Add Support for CLAP Plugins
- Error loading VST in Python 3.11.5 HOT 5
- Input device names truncated, along with stuttery audio HOT 2
- Pedalboard Pluginary: easier access to VST3/AU plugins
- Valhalla Supermassive - Whoosh noise at beginning of output
- Cannot load .fxp file for Serum HOT 2
- Is threading supported for `VST3Plugin` instances? HOT 2
- Need help with parameters for improving TTS generated audio
- Does WriteableAudioFile handles creating a WAV file with the standard header? HOT 2
- Unable to load VST3 when running through CircleCI HOT 1
- Limiter Plugin seems also to normalize? HOT 1
- is there a way to overplay 2 audio together using pedalboard HOT 1
- Actual resampled audio length != expected resampled audio length
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pedalboard.