Skip to content

duration parameter to AudioBufferSourceNode.start is handled incorrectly #1660

@brianchirls

Description

@brianchirls

Per the spec:

The duration parameter describes the duration of the sound (in seconds) to be played. If this parameter is passed, this method has exactly the same effect as the invocation of start(when, offset) followed by stop(when + duration).

None of the major browsers implement it this way. If the playbackRate is set to anything other than 1, actual duration of the sound emitted is the value of the argument divided by playbackRate. The duration applies to the length of the source sample before it is adjusted by the playbackRate. This is not the same as using start without a duration followed by stop, as described. The latter will play the sped up or slowed down clip for the correct duration.

Here is a link to a simplified test case:
https://codepen.io/brianchirls/pen/zaKgva?editors=1111

The above applies to recent versions of Firefox, Chrome, Safari and Edge. I don't really mind whether the spec gets changed or the browsers change behavior as long as it's consistent. I figured I'd file here first for discussion rather than try to chase down four browser vendors.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions