Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Audio docs improvements #55

Open
stevesims opened this issue Nov 23, 2024 · 0 comments
Open

Audio docs improvements #55

stevesims opened this issue Nov 23, 2024 · 0 comments

Comments

@stevesims
Copy link
Contributor

The audio API documentation could use some clarifications around stopping note playback, and the differing behaviours.

Setting volume to zero is the intended "stop note" API. That needs to be made clear. When doing so, if a volume envelope is set then the "release" phase will start. If a channel is already in the "release" phase, the channel will be instantly silenced.

Setting the duration to zero also generally has the effect of stopping a note on a channel, but that's not the advised way as it has interesting interactions with volume envelopes which should be explained. The situation is complex. When the duration is set to zero for a playing channel that has an envelope, the calculations for the envelope will happen as if the duration was always set to zero. Therefore if the elapsed time is any value beyond the cumulative attack + decay envelope phases you'll be straight into the "decay" phase. If the elapsed time is beyond the cumulative attack + decay + release phases then you're past "release" so the channel will go instantly silent. Basically, changing the duration has the effect of making playback on that channel happen as if the duration was always zero.

This is intended behaviour, and not a bug. 😁

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant