-
Notifications
You must be signed in to change notification settings - Fork 204
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
playNote() and playBeat() issues #758
Comments
Can you provide a concrete minimal reproducible example? |
Yes sir, there you go: https://codepen.io/stereokai/pen/WNXzmMo I added the line |
@Danielku15 I have an interesting update. First of all, concerning problem no. 2, a simple throttle code will solve the problem. function throttle(callback, limit) {
let waiting = false;
return function () {
if (!waiting) {
callback.apply(this, arguments);
waiting = true;
setTimeout(function () {
waiting = false;
}, limit);
}
};
} Concerning problem no. 1, I was able to somewhat solve it with the following 2 lines: function onNoteClick(note) {
note.beat.playbackStart = -Math.abs(note.beat.playbackStart)
setTimeout(() => api.playNote(note), 100)
}
See the updated fix here: https://codepen.io/stereokai/pen/WNXzmMo |
@Danielku15 can you please explain the purpose or function of |
When playing a brush stroke on the guitar, each note played on a beat, is slightly delayed. The brushOffset is the value how much later a single note within a beat is played. |
I see. Then I'm a bit lost. Have you had a chance to look at the information I investigated? |
Not at this point. I am lately quite busy and don't find much time working very focused and actively on the project. I can confirm that there are some strange behaviors regarding this feature in the example which I wouldn't expect to happen. But it behaves generally a bit strange. I will need to invest some more time to investigate on what's happening there and how a sustainable fix for the weird behavior look like. The only (rather random) suggestion would be to give it also a try with the 1.2 stable version. There is a small chance that some things got broken during the refactorings for the Android support. It is unlikely but still. 😉 Also the whole cursor behavior is kind-a weird. My assumption currently is that there is an issue with the fact that you're initiating a The playNote/playBeat support is currently quite minimalistic. The approach internally works that a separate midi file is generated containing only the individual elements and send it for a special playback. Internally the synth switches quickly modes from the main playback to a "one time playback" to reuse the synth components. I will have to think on how to stabilize this feature in general to be more flexible in regards of firing off the playback of a separate note/beat. The current solution is a fragile setup with rather a complex state handling. |
Hi, I'm sorry for not having replied earlier! Very awesome of you taking the time so quickly to fix it. Thank you very much for it! Any idea when it'll reach a release? No pressure, just asking :) |
@Danielku15 hi, and thanks again for fixing this :) |
Is there an existing issue for this?
Current Behavior
1. Short notes are not being synthesized to their full length using
playNote()
playNote
on any note on the first beat works fine. However:When calling
playnote()
for any any quarter note or shorter, on any beat after the first beat, Alphatab tries to play the note (playback is logged), but either no sound is heard, or the note is truncated. The result depends on the value (duration) of the first beat. When the notes are truncated, this is logged:It's important to note, this doesn't happen at all with
playBeat
.2. Calling
playNote()
orplayBeat()
before the playback has ended breaks the synthesizerWhen calling
playNote()
orplayBeat()
again (one time is enough) before the playback has ended, it causes the synthesizer to play some combined note or harmonic indefinitely. Alphatab logs thousands of this kind of message:Expected Behavior
playNote()
to their full duration irregardless of their position in the tab.playNote()
orplayBeat()
based on the respective beat duration.Link to jsFiddle, CodePen, Project
No response
Found in Version
1.3-alpha
Platform
Web
Environment
Anything else?
No response
The text was updated successfully, but these errors were encountered: