Feature · Record

Capture the microphone

record(seconds) shows a button; click it, allow the mic, and the samples come back to Python as a float32 NumPy array.

This page runs a real in-browser Python kernel (thebe + Pyodide) and micropip-installs the actual browseraudio package — so the cells below are the genuine API, not a mock, just like JupyterLite / thebe. The cells are editable; the first Run downloads the runtime (~25 MB), so give it a moment. Reload to reset.

ready
01

Record three seconds

Run the cell, click ● Record, and allow the microphone. An inline player appears so you can hear the take.

python
from browseraudio import record

rec = record(3.0)   # shows a ● Record button — click it
02

Inspect the array

The take is an ordinary NumPy array — float32, shape (n_frames, 1) — that you can slice, plot, or hand to a DSP library.

python
rec.samples.shape, rec.sample_rate

In a notebook, this is two cells. Recording finishes after the cell that calls record() returns, so you read rec.samples in the next cell — why.


Got audio? Head to the Play page to push a buffer back to the speakers.