abcjs icon indicating copy to clipboard operation
abcjs copied to clipboard

Additional functionality: Playing fermatas

Open nbruley opened this issue 5 years ago • 1 comments

We would like to see functionality for playing a fermata and/or invisible fermata. The way we have implemented with a different ABC player is a) make notes with a fermata symbol (H, !fermata!, !invertedfermata!) 2x the length of the given note b) add "h" before a note to add an invisible fermata (resulting in the same 2x length). This way, you can affect the playback of notes in different voices without having to display the fermata. With SATB, you don't necessarily want to display all 4 fermatas. I realize this is going outside of the ABC standard, but it is helpful for playback.

nbruley avatar Jun 10 '20 00:06 nbruley

Here is my workaround code for playing fermatas: javascript regex (may only work for SATB, and may need some bugs worked out):

TuneABCplayback = TuneABC.replace(/(?:H|h|!invertedfermata!|!fermata!)((_|=|^){0,1}\w(,|'){0,2}[1-9]{0,1})/g,"\$1-\$1"); //change fermata without brackets into duplicated tied notes (?: means don't remember it)
TuneABCplayback = TuneABCplayback.replace(/(?:H|h|!invertedfermata!|!fermata!)(\[((_|=|^){0,1}\w(,|'){0,2}[1-9]{0,1}){1,4}\])/g,"\$1-\$1"); //change brackets after fermata into duplicated tied notes

Then create two instances of the synthControl and visualObj. In the first instance, place the player in a hidden element (based on class that is hidden) and the notation in a visible element. In the second instance, place the player in a visible element and the notation in a hidden element.

nbruley avatar Jun 15 '20 02:06 nbruley