-
Notifications
You must be signed in to change notification settings - Fork 202
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
How do you play the song at a specific time? #372
Comments
The master branch you are using is rather outdated and I'd recommend to update to develop for any further development. The latest version can be consumed via NPM. Currently there is no built-in way to synchronize alphaTab with any external audio/video source but the direkt answer to your question is: Yes there is a way to tell alphaTab to start/stop playing on demand. The related API calls related to playback state and time are:
But of course it strongly depends on how you are building the YT synchronization if these API calls match your needs. alphaTab has an own player system. So unless the music notation matches 100% the YT video, the cursor display might easily get out of sync if you just trigger play based on some known YT start position. Until alphaTab supports synchronizing the cursor with an external media source it might be the more realistic approach to to build your own cursor display which positions a cursor based on the media position and disable the alphaTab player. Best might be to define an array of "timestamp/bar-index combiations" which define when each bar/measure of the music sheet starts. Then take the media position and interpolate at which position in the song the cursor should be displayed and animate it accordingly. The cursor related setup code starts here: alphaTab/src/AlphaTabApiBase.ts Line 645 in 0b9f46c
You might take this as a reference how the cursor positioning is done using the internal midi synthesizer: We listen to the time change events, use some midi lookup cache to find out at which bar/beat the current playback is, and position the cursor accordingly. |
Wow thank you so much for the thorough answer! I am a high school guitar teacher and a self-taught programmer. Those are great ideas. I will see what I can come up with... |
I know that Soundslice (a "competitor" product) is following a similar approach that's why I suggested this marker approach 😉 . They have an editor where you just let the song play and press some keys at the right time when the measures start. Based on this they will align the cursor during playback. I plan to provide a similar approach in the future. |
Wow, Soundslice is a really cool app. Yeah that's pretty much exactly what I'd like to do on my own website. BTW, I noticed a small typo on the page https://www.alphatab.net/docs/tutorial-web/player Under the "Loading Indicator" section, new JavaScript has this line:
but later in the Final File, that line is corrected:
|
Thanks for reporting. I corrected the part in the docs a few mins ago. |
I will close this issue as the open questions seem to be clarified. Official built-in support for linking alphaTab to external audio/video sources is planned as potential feature in 1.5 https://github.com/orgs/CoderLine/projects Feel free to open new issues for other dedicated questions. |
Question
I'd like to "sync" a youtube video to my alphaTab score. But the song in the video (my video) doesn't start right away. I'd like to call an alphaTab api method to start playing (and stop). Am I able to do that?
Your environment (if applicable)
The text was updated successfully, but these errors were encountered: