﻿# AudioWorklet parameters: an a-rate parameter array can still have one value

AudioWorklet parameters: an a-rate parameter array can still have one value. A focused voice-infrastructure guide with the documented mechanism, a reproducible validation scenario, evidence and operational limits.

Author: Retrivium team
Updated: 2026-11-06
Canonical URL: https://retrivium.ai/journal/voice-audioworklet-parameter-array-length/
Language: en

An a-rate AudioWorklet parameter does not guarantee a distinct array element for every output sample in every block. A constant parameter can be represented by a single value. A gain adapter that blindly indexes the parameter array by sample position may therefore introduce invalid values or silence even though its automation-rate declaration is correct.

## The audio contract

The Web Audio processing contract permits the parameter array to have length 1 when the value is constant during the render quantum. Otherwise a-rate automation supplies values across the block. The array's shape is therefore part of each invocation's input, not something fixed forever by the descriptor. The number of output samples should also be taken from the supplied channel array rather than an unrelated application batch size. Parameter broadcasting and audio sample indexing need separate, explicit rules.

## Implementation details

For each process invocation, inspect the parameter array length. Broadcast its sole value across the channel when it is scalar, and use the corresponding per-sample values when the documented vector form is present. Keep this decision local to the block because automation can change representation between calls. Apply the same intended parameter to each selected channel without confusing parameter length and channel count. Validate finite output in the integration test so out-of-bounds parameter access cannot quietly propagate through later tensor preparation or playback conversion.

## A constructed validation case

Feed a known waveform first with constant gain and then with scheduled within-block automation. Compare output against independently calculated scalar and vector expectations. Switch between those modes across consecutive calls and include more than one channel. A deliberately always-vector implementation should fail the scalar case. Acceptance requires valid output samples and the intended gain trajectory in both representations, without changing audio length. Preserve the automation schedule and browser revision so a later discrepancy can be reproduced rather than attributed vaguely to real-time scheduling.

## Operational limits

Correct parameter broadcasting does not validate a chosen loudness policy or improve a speech model automatically. It ensures that the configured control reaches the waveform as intended. Keep that low-level contract separate from perceptual quality and model-input normalization when evaluating the complete voice path.

## Primary references

[Webaudio Spec](https://www.w3.org/TR/webaudio-1.1/); [Mdn Worklet](https://developer.mozilla.org/en-US/docs/Web/API/AudioWorkletProcessor/process).

This is a proposed voice-system validation, not an executed Retrivium benchmark. Preserve the implementation version and unresolved outcomes; interface documentation does not establish the quality or timing of a deployed voice service.

## Related reading

[RNNoise floating-point input: PCM amplitude scale is part of the interface](/journal/fg2-rnnoise-float-pcm-amplitude-format/); [Audio resampling for datasets: keep timestamps aligned when sample counts change](/journal/data-guide-audio-resample-time-labels/).
