Sound in real time
A notebook to play live. In the browser, sounddevice is a stand-in with the same interface: run the first cell and press ▶ audio. In a local Jupyter, %pip install sounddevice and the real one is used.
import sounddevice as sd
import numpy as np
SR = 48000
N = 512 # frames in a block: 512 / 48000 s, about 10.7 ms