gallegretti / escala

Escala: A web based score editor
https://gallegretti.github.io/escala/
MIT License
16 stars 0 forks source link

Feature Request: add/edit percussion tracks #5

Open leocaseiro opened 1 year ago

leocaseiro commented 1 year ago

Hi there, this editor looks awesome.

I am not able to add a new drumkit instrument. Are you planning to support that? It is supported by alphatab (https://alphatab.net/docs/showcase/special-tracks/), but they hide the tabs, so I believe this is the problem, as your editor relies on the tabs.

Are you planning to support a way to edit notes via music notation, besides tab numbers?

I can see the drums when I open a .gp file that has drums (even though the sound is not playing the drums), but I can't create a new file that has drums on it, or either edit a file with drums. I attached a .gp file with drums, in case you want to test it. Or you can find some files from guitarprotabs.org

Eg: https://guitarprotabs.orghttps://guitarprotabs.org/a/acdc/big_balls_v1_92/

drums.gp.zip

gallegretti commented 1 year ago

Hi @leocaseiro,

Thank you for your interest in my pet project!

You're right, the editor relies on the tab notation to edit the track. I suppose something similar to TuxGuitar would be best. It displays both music and tab notations for percussion, and you can edit the tab:

image

It seems like it would be possible to modify the stave profile selector for percussion on AlphaTab and use the ScoreTab to render both the music and tab notation: https://github.com/CoderLine/alphaTab/blob/b91b28f46bf7ce0424e58944a948417ee975ac31/src/rendering/layout/ScoreLayout.ts#L230-L245 And also changing this function to allow the creation of the renderer for percussion: https://github.com/CoderLine/alphaTab/blob/7dcf2bdb79b1edee015b176f30d775bde2049a5a/src/rendering/BarRendererFactory.ts#L19 But doing that causes some errors in the TabBarRenderer class. I didn't look further than this, but it might not be so simple.

As you suggested, the other approach is to edit the notes directly via music notation, but this is not something that I'm planning to do.

Another problem is adding new tracks. Right now it's not possible to add a new track at all, even for a guitar. I ran into some issues when trying to do that. Modifying the AlphaTab data structures at runtime is not very easy. Definitely at the top of my TODO list, alongside adding support for partial re-rendering.

Also, I did open your drums file and the playback worked fine. Can you check if it works for you on the AlphaTab player?

leocaseiro commented 1 year ago

Hi, thank you so much for your investigation, and POC to solve the issue.

Yeap, tuxguitar solution might be the way to go.

I was planning to create an editor for alphatab myself, my idea was to use alphatext which seemed simpler than guitarpro, so I found your project, and it was very excited.

The player in alphatab works great for drums. Thank you.

gallegretti commented 1 year ago

Alright, I'm leaving this issue open to track the feature of supporting creating/editing percussion tracks, and opening another to track the issue of creating a new track. Thank you for your feedback. Also, you mentioned the idea to use alphaTex. Just be aware that it doesn't seem to support percussion right now

leocaseiro commented 1 year ago

Thank you for letting me know. Yeap, alphaTex don't support drums yet.

Maybe the best approach is using the JSON import, do you know how to use it? Actually, I need to look into your code, I would like to know how you do the editor.

This is the JSONConverter API: https://alphatab.net/docs/guides/lowlevel-apis/#serialize-data-model-fromto-json

gallegretti commented 1 year ago

This editor modifies the AlphaTab model directly and then calls the render and the loadMidiForScore functions. I'm not using this jsonConverter API, but it might work for your use case.

leocaseiro commented 1 year ago

Thank you!