Wave type

Describes a waveform for use by audio signal generator. Constructed from simple sine waves, silence and sequences, loops, combinations of those. May be finite or infinite in duration, it may often make sense to follow a timed signal with silence.

See mkDtmf() to construct DTMF tones.

Signature:

export type Wave = {
    type: "sine";
    freq: number;
    db?: number;
} | {
    type: "silence";
} | {
    type: "compound";
    components: Wave[];
} | {
    type: "sequence";
    components: Wave[];
} | {
    type: "loop";
    component: Wave;
} | {
    type: "timed";
    component: Wave;
    durationMs: number;
};

References: Wave