audiodev.web_audio

Browser Web Audio backend for PyScript (audiodev PCM devices).

class audiodev.web_audio.WebPCMOutput(fmt, *, poll_ms=4)[source]

Bases: PCMOutput

Queued PCM playback via AudioContext + AudioBufferSourceNode.

locked()[source]

True while the browser keeps the context suspended.

AudioOut holds a sample until this turns False, so nothing is queued onto a clock that is not running. A click or key press resumes the context (armed in open()).

class audiodev.web_audio.WebPCMInput(fmt, *, poll_ms=4, queue_ms=500, samples=2048)[source]

Bases: PCMInput

Microphone capture via getUserMedia + ScriptProcessorNode.

audiodev.web_audio.pcm_out(format=None, *, latency=None, poll_ms=4)[source]

Create a Web Audio-backed PCMOutput (PyScript).

latency is accepted for portability and validated, but every profile behaves the same here: playback schedules each buffer onto the AudioContext timeline as it arrives, so there is no queue or coalescing window to shorten. Web Audio is already at the “low” profile.

audiodev.web_audio.pcm_in(format=None, *, latency=None, poll_ms=4, queue_ms=500, samples=None)[source]

Create a Web Audio-backed PCMInput via getUserMedia (PyScript).

samples is the ScriptProcessorNode block size, which the browser rounds to a power of two. The "low" profile asks for a smaller block.