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

Add brushes and arpeggio to alphaTex #799

Merged
merged 4 commits into from
Oct 2, 2022

Conversation

jonaro00
Copy link
Contributor

@jonaro00 jonaro00 commented Mar 17, 2022

Issues

Implements #505

Proposed changes

Added the brush parsing to alphaTex.

The current approach for default values is to ensure that brushes don't play too slow, and letting arpeggios play evenly across the duration. It for sure feels like not all of the timings below are "correct" and need tweaking.
Here is some tex i used for testing:

.
\tempo 90
(1.1 2.2 3.3 4.4).4{bd 60} (1.1 2.2 3.3 4.4).8{bu 60} (1.1 2.2 3.3 4.4).2{ad 60} (1.1 2.2 3.3 4.4).16{au 60} r |
(1.1 2.2 3.3 4.4).4{bd 120} (1.1 2.2 3.3 4.4).8{bu 120} (1.1 2.2 3.3 4.4).2{ad 120} (1.1 2.2 3.3 4.4).16{au 120} r |
(1.1 2.2 3.3 4.4).4{bd 240} (1.1 2.2 3.3 4.4).8{bu 240} (1.1 2.2 3.3 4.4).2{ad 240} (1.1 2.2 3.3 4.4).16{au 240} r |
(1.1 2.2 3.3 4.4).4{bd} (1.1 2.2 3.3 4.4).8{bu} (1.1 2.2 3.3 4.4).2{ad} (1.1 2.2 3.3 4.4).16{au} r |
(1.1 2.2 3.3 4.4).4{bd} (1.1 2.2 3.3 4.4).8{bu} (1.1 2.2 3.3 4.4).2{ad} (1.1 2.2 3.3 4.4).16{au} r |
\tempo 120
(0.1 0.2 0.3 2.4 2.5 0.6).2*2{bd} | (0.1 0.2 0.3 2.4 2.5 0.6).4*4{bd} | (0.1 0.2 0.3 2.4 2.5 0.6).8*8{bd} |
(3.1 0.2 0.3 0.4).2*2{bd} | (3.1 0.2 0.3 0.4).4*4{bd} | (3.1 0.2 0.3 0.4).8*8{bd} |
(2.2 3.3 4.4).2*2{bd} | (2.2 3.3 4.4).4*4{bd} | (2.2 3.3 4.4).8*8{bd} |
(3.3 4.4).2*2{bd} | (3.3 4.4).4*4{bd} | (3.3 4.4).8*8{bd} |
(0.1 0.2 0.3 2.4 2.5 0.6).2*2{ad} | (0.1 0.2 0.3 2.4 2.5 0.6).4*4{ad} | (0.1 0.2 0.3 2.4 2.5 0.6).8*8{ad} |
(3.1 0.2 0.3 0.4).2*2{ad} | (3.1 0.2 0.3 0.4).4*4{ad} | (3.1 0.2 0.3 0.4).8*8{ad} |
(2.2 3.3 4.4).2*2{ad} | (2.2 3.3 4.4).4*4{ad} | (2.2 3.3 4.4).8*8{ad} |
(3.3 4.4).2*2{ad} | (3.3 4.4).4*4{ad} | (3.3 4.4).8*8{ad} |
\tempo 80
(5.2 5.3 7.4).4{ad} (5.2 5.3 7.4).4{au} (5.1 5.2 5.3).4{ad} (5.1 5.2 5.3).4{au} |
(8.1 10.2 9.3).4{ad} (8.1 10.2 9.3).4{au} (12.1 13.2 14.3).4{ad} 12.1.4 |

Checklist

  • I consent that this change becomes part of alphaTab under it's current or any future open source license
  • Changes are implemented
  • Existing builds tests pass
  • New tests were added

Further details

  • This is a breaking change
  • This change will require update of the documentation/website
    • I can write a section for them once they are implemented.

@goodgame365
Copy link

goodgame365 commented Mar 22, 2022

very good!

Thank!

@Danielku15 Danielku15 linked an issue May 25, 2022 that may be closed by this pull request
@Danielku15
Copy link
Member

@jonaro00 Any plans to complete this PR. Looks like only tests might be missing?

@jonaro00
Copy link
Contributor Author

@Danielku15 Yes, however: The implementation as of now is mostly me just guessing. Since I'm not a guitarist, I'm not really sure what timings in the default behavior is reasonable. I would appreciate feedback on if that part is good enough or needs improvement.

@Danielku15
Copy link
Member

@jonaro00 Best would be to check the default settings of Guitar Pro what they apply as durations.

@jonaro00
Copy link
Contributor Author

jonaro00 commented Jun 12, 2022

@Danielku15 I looked in the gp7 test data files, they only include cases with quarter notes in tempo 120, with a resulting brushDuration of 60, which equals playbackDuration / 16 in that specific case, but I can't be sure of the formula without more examples.

@Danielku15
Copy link
Member

Danielku15 commented Aug 27, 2022

@jonaro00 From what I've seen in GP7 the brush duration is typically depending on the duration of the beat it is on and how many notes you have in this beat. The goal is that all notes in this beat can be still played within the beat duration, even if it is stroked.

Unfortunately GP7 does simply remember your last selection in the UI and does not really give some recommendation. It provides you a range slider where you choose how long the stroke should take in total and then it spreads the the notes on this beat accordingly.

e.g. if you have 4 whole notes (3840) in a beat, and you choose a half note for your stroke (1920) you will have in the data model a duration of 1920/4=480 making it 8th note between the individual notes on the stroke.

I would say a good duration for an overall stroke is around 1/4 of the overall beat duration. Hence the formula could be:

beat.brushDuration = beat.playbackDuration / 4 / beat.notes.length

Maybe the 4 needs to be tweaked, maybe it is better an 8. I would recommend to fiddle a bit on how it sounds.

@jonaro00
Copy link
Contributor Author

jonaro00 commented Oct 2, 2022

@Danielku15 There wasn't much difference between dividing with 4 or 8. I took 4 based on preference. Wrote tests, should be ready for review now.

@jonaro00 jonaro00 marked this pull request as ready for review October 2, 2022 13:17
@Danielku15 Danielku15 merged commit 46837b9 into CoderLine:develop Oct 2, 2022
@Danielku15
Copy link
Member

Thanks for the contribution 🎉

ChiHoc pushed a commit to ChiHoc/alphaTab that referenced this pull request Nov 7, 2022
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

Successfully merging this pull request may close these issues.

Add brushes to alphaTex
3 participants