Audio

Pyzed has everything to build a synthesizer, a drum machine, a MIDI controller or a music visualizer in Python. It comes in two layers that you can use together or apart:
- The engine (
pyzed.audio) makes the sound. You add modules (oscillators, filters, envelopes, effects, sequencers, drums), join them with cables and it plays them on your sound card with low latency. It needs no window: a script, a test or a server can use it alone. - The interface (
pyzed.ui.audio,pyzed.ui.rack,pyzed.ui.camera) shows and controls it: knobs, faders, pads, a piano, meters, waveforms, spectrum analyzers and a rack where you patch modules with cables you drag, like VCV Rack or Reaktor.
import pyzed as pzfrom pyzed import audio, ui
engine = audio.Engine()osc = engine.add("oscillator", wave="saw", freq=110)lpf = engine.add("filter", cutoff=800, resonance=0.5)engine.chain(osc, lpf, engine.add("audio_out"))
class Synth(pz.App): def on_start(self): engine.start()
def subscriptions(self): return [pz.frames(lambda dt: None)] # redraw every frame: the meters move
def view(self): return pz.row([ ui.audio.Knob(value=engine.get(lpf, "cutoff"), min=20, max=20000, curve="log", unit="Hz", caption="Cutoff", variant="fl", on_change=lambda e: engine.set(lpf, "cutoff", e.value)), ui.audio.Spectrum(magnitudes=engine.spectrum(), width=360, height=120), ui.audio.VuMeter(level=engine.level()), ], spacing=16, align="center")
pz.run(Synth)Where to start
Section titled “Where to start”The engineModules, cables, MIDI and latency: making sound from Python.
ComponentsKnobs, faders, pads, piano, meters, waveforms and analyzers.
The rackA VCV Rack-style rack with modules you patch with cables.
DemosA synthesizer, a visualizer, a MIDI controller, a drum machine and more.
The components
Section titled “The components”Every component is in the designer’s toolbox, in the Audio group (the webcam is under Media), and has its own page with an animation:
| Component | What it is |
|---|---|
Knob |
A rotary control: five looks, logarithmic ranges, stepped selectors. |
Fader |
A slider like a mixing desk’s, with an optional level meter. |
Pad, LedButton |
Velocity pads and buttons with a light. |
StepSequencer |
A grid of steps like FL Studio’s channel rack. |
Piano |
A keyboard you play with the mouse or the computer keys. |
VuMeter |
LED, bar and analog needle meters with peak hold. |
Waveform |
A recording’s shape, with a playhead and a selection. |
Scope |
An oscilloscope with trigger, XY mode and persistence. |
Spectrum |
A spectrum analyzer: bars, blocks, lines, mirror, radial. |
Spectrogram |
The spectrum over time, as a scrolling picture. |
Webcam |
The live picture of a camera. |
Rack |
Modules on rails joined with animated cables. |
Colors and palettes are explained in Colors and palettes.