beetlebug▾
/

ztcl::audio render

Renders the sound of the device offline.

ztcl::audio render MS ?-format s16|f32?

Description

With the device offline, mixes MS milliseconds of the voices, moves the clock, and gives the bytes: interleaved stereo, little-endian, 16-bit integers by default or 32-bit floats with -format f32. Each run of the same script gives the same bytes, on each platform. The ends of the voices queue their -command for the event loop. render spends one compute unit for each block of 64 frames of each voice. MS is at most 600,000.

Returns

A byte array.

Examples

% ztcl::audio configure -device offline; string length [ztcl::audio render 10]
1920

Errors

% ztcl::audio configure -device none; ztcl::audio render 10
no audio device: use ztcl::audio configure -device
-errorcode ZTCL AUDIO DEVICE

% ztcl::audio configure -device offline; ztcl::audio render 10 -format mp3
bad format "mp3": must be f32 or s16
-errorcode NONE

Facts

Capability
audio. A new interpreter does not have it until the host turns it on.
Tcl release
Tcl 9.1 and 8.6.
Since
ztcl 1.0.0-beta.6

See also