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

When playing for the second time to the end, it cannot be stopped and emits a harsh noise. #1298

Closed
1 task done
goodgame365 opened this issue Nov 21, 2023 · 3 comments · Fixed by #1330
Closed
1 task done
Assignees
Labels
area-player Related to the audio playback engine. platform-javascript Related to the JavaScript version of alphaTab state-accepted This is a valid topic to work on. type-bug 🕷️

Comments

@goodgame365
Copy link

goodgame365 commented Nov 21, 2023

Is there an existing issue for this?

  • I have searched the existing issues

Current Behavior

I found a serious bug. When playing from the beginning to the end for the first time, and then playing from the beginning to the end again, there is a continuous noise that cannot be stopped. I don't know what the problem is.

20231121_141115.mp4

Expected Behavior

I believe this is a bug and it can be reproduced. I hope it can be resolved!

Steps To Reproduce

t2.zip

Link to jsFiddle, CodePen, Project

No response

Found in Version

1.3-alpha

Platform

Web javascript

Environment

anywhere

Anything else?

No response

@goodgame365 goodgame365 added the state-needs-triage Bug not triaged yet. label Nov 21, 2023
@Danielku15 Danielku15 added type-bug 🕷️ state-accepted This is a valid topic to work on. area-player Related to the audio playback engine. platform-javascript Related to the JavaScript version of alphaTab and removed state-needs-triage Bug not triaged yet. labels Dec 9, 2023
@Danielku15
Copy link
Member

The problem is caused only when alphaTab uses the "ScriptProcessorNode" instead of the "AudioWorklets". AudioWorklets are not available if:

  1. AlphaTab is bundled with WebPack (webpack has only very limited audio worklet support, not compatible with alphaTab)
  2. AlphaTab is used in a non-secure context
  3. The browser really doesn't support AudioWorklets

On alphaTab.net rule 1. applies.

And the root cause seem to be an inconsistency in the time calculation. For this file (only on the second round) the "tick position" indicates that the player has not yet finished, but the "time position" marks the file as finished.

There must be somewhere an inconsistency in the reporting of played samples. Maybe some samples from the previous playback are still in the buffer and played additionally leading to a wrong calculation on the positions.

@Danielku15
Copy link
Member

Update: I could now reproduce it also on the AudioWorklets.

@goodgame365
Copy link
Author

Update: I could now reproduce it also on the AudioWorklets.

I found a temporary solution, which is to add a stop() method when he plays to the end and there is no set to replay, forcing it to return to its initial state.

\playground\control.js

at.playerPositionChanged.on(function (args) {
... ....

    //Add new code here.
    if (!at.isLooping && args.currentTime === 0 && args.endTime > 0) {

        at.stop();
    }
});

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-player Related to the audio playback engine. platform-javascript Related to the JavaScript version of alphaTab state-accepted This is a valid topic to work on. type-bug 🕷️
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

2 participants