Recording¶
The managed capture API collects audio in memory while your application does
other work. Native capture buffers are drained on a background thread, so the
common API returns one PCM value instead of exposing chunks:
from pyalsoft import start_recording, stop_recording
recording = start_recording()
input("Speak now, then press Enter to stop... ")
captured = stop_recording(recording)
start_recording() uses the default input device
and records 48 kHz, mono, 16-bit PCM unless told otherwise. Use
list_capture_devices() to select a specific
input. For a known duration, record() is the blocking
equivalent.
Captured and generated PCM values can be passed directly to
play():
See the runnable
record_and_play.py
example for the complete flow.