Treatment encodeMonoWav
audio/encode::encodeMonoWav
Parameters
↳ var sample_rate: u32
Inputs
⇥ signal: Stream<f32>
Outputs
↦ data: Stream<byte>
↦ errors: Stream<string>
↦ failed: Block<void>
Encode a normalised mono f32 signal into a WAV byte stream.
Samples arrive through signal as f32 values in the range [-1.0, 1.0]. They are
encoded as 32-bit IEEE float PCM and emitted through data as a continuous stream of
raw WAV bytes, suitable for writing directly to a file or sending over a network.
sample_rate must match the rate at which the samples in signal were produced.
errors emits a message if encoding fails. failed triggers on any fatal error.
graph LR
T("encodeMonoWav()")
S["−0.3 … 0.7"] -->|signal| T
T -->|data| D["🟦 … 🟥"]
T -->|errors| E["…"]
T -->|failed| F["⬛"]
style S fill:#ffff,stroke:#ffff
style D fill:#ffff,stroke:#ffff
style E fill:#ffff,stroke:#ffff
style F fill:#ffff,stroke:#ffff