Audio I/O for Python,
running in the browser
Record the microphone and play audio back from Python inside the browser — Pyodide, JupyterLite, thebe — straight to and from a NumPy array. No native PortAudio, no server.
rec = record(3.0)
recorded 3.00 s
rec.samplesfloat32 · (144000, 1) · 48 kHzFeatures
01Record
Capture mic input to a float32 NumPy array — then play your voice as an instrument.
→
02Play
Push any NumPy buffer to the speakers.
→
03Synth
Design a sound in NumPy — pianos, plucked strings, a drum kit — then play it live with your computer keyboard.
→
04Real-time
A NumPy callback fills each block as the browser plays it — polyphonic synths, FM with live knobs, and a live score you edit while it loops.
→
05sounddevice facade
Drop-in
browseraudio.sounddevice: query_devices, default, single-cell play, a real-time OutputStream, and a rec that guides you to the two-cell flow.
→
06Genie mode
Play the whole piano with 8 buttons — Piano Genie (Donahue, Simon & Dieleman, 2019) picks the notes.
→
Why it exists
Python can't reach the speakers, so it asks the page
In the browser, Python usually runs in a Web Worker with no access to
getUserMedia or the Web Audio API — so the usual
sounddevice → PortAudio stack can't run. browseraudio does the
capture and playback on the page's main thread, through a small
anywidget frontend, and ships the samples
across to the kernel.