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

Autobeam #275

Closed
acidjunk opened this issue Jun 25, 2018 · 8 comments
Closed

Autobeam #275

acidjunk opened this issue Jun 25, 2018 · 8 comments

Comments

@acidjunk
Copy link

Hi, I'm experimenting a bit with opensheetmusic display. I like it a lot :)

I'm running a platform that uses lilypond format and I'm in the progess of switching to MusicXML. I run into a rendering difference between Muse score and OpensheetMusic (or vexflow?)

First the render as it's done in Musescore when I open the xml:
screen shot 2018-06-25 at 08 56 28

Now the same render but then from opensheetmusicdisplay:
screen shot 2018-06-25 at 08 57 29

The used XML: https://api.improviser.education/test-musicxml

As I do some processing to get a valid MusicXML (Concat lot's of small Lilypond strings to MusicXML), I'm not sure where to start searching. Do I need something in my Music XML to enable autobeam on each quarter note?

@bneumann
Copy link
Collaborator

Hi @acidjunk,

thanks for reporting this. I am not sure, maybe @matt-uib has something up his sleeve that might help with autobeaming. Usually music xml does group notes that share a beam with the <beam> tag inside the note tag, like so:

<note default-x="158">
    <pitch>
        <step>D</step>
        <octave>5</octave>
    </pitch>
    <duration>12</duration>
    <voice>1</voice>
    <type>eighth</type>
    <beam number="1">begin</beam>
</note>
<note default-x="206">
    <pitch>
        <step>E</step>
        <alter>-1</alter>
        <octave>5</octave>
    </pitch>
    <duration>12</duration>
    <voice>1</voice>
    <type>eighth</type>
    <beam number="1">end</beam>
</note>

So you could implement this in your parser and have full control over your beams, or as said maybe there is some hidden gem in the code :)

@acidjunk
Copy link
Author

Ah cool, I like total control :)
I will try to update my parser tomorrow.

I think it would be a nice option if opensheetmusic display could use the VexFlow autobeam function (e.g. with a configuration option or something when stuff is initalised)

@bneumann
Copy link
Collaborator

Wait, vexflow has autobeaming? If so this might be very simple

@bneumann
Copy link
Collaborator

Note to self: 😁

https://github.com/0xfe/vexflow/wiki/Automatic-Beaming

This sounds pretty straight forward. @matt-uib your opinion? Should we implement that? Or maybe have an option for it?

@sebastianhaas
Copy link
Member

I guess it would be nice it it was possible activate it per configuration. :)

@sschmidTU
Copy link
Contributor

sschmidTU commented Oct 18, 2018

I added an autoBeam option to beam notes that don't have beams in XML (09170a2).
It's using Vexflow.Beam.generateBeams, but adds a few beaming strategies like beaming tuplets separately and not beaming over quarter+ notes.
Added OSMD Function Test - AutoBeam:
image

with autoBeamOptions.groups: [[2,4]]: (unfortunately groups always go over rests in Vexflow)
image

With autoBeam disabled:
image

You can also set autoBeamOptions like how many beats to beam together (groups), see the AutoBeamOptions interface.

To enable autoBeam during runtime in the Demo, write osmd.setOptions({autoBeam: true}) in the console.
(If you already have the function test selected, click clear and Re-render)

By the way, here's a regular expression to remove all beams from a MusicXML:
^[ ]*[<]beam.*$

@acidjunk If you still have suggestions, feel free to keep commenting.

@acidjunk
Copy link
Author

That's really cool and it's looks nice on my musician eyes. Will try it on a new part of the https://improviser.education tomorrow. If you need any help in OSMD let me know: i'm quite new to javascript (focussing mainly on ES6 + ReactJS nowadays) but 'll have some time the coming weeks.

@sschmidTU
Copy link
Contributor

It's cool that there are so many people using OSMD for education, looking forward to what you build!
By the way, we just released OSMD 0.6.0.

You are of course welcome to contribute to OSMD, though most of the pressing issues are also not easy to implement. There are issues for an Angular2 or Wordpress Plugin, which would be nice, or you could just browse through the issues page. Maybe once you start using OSMD on your site, you'll find a usecase that's important for you that you'd like to improve in OSMD.

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

No branches or pull requests

4 participants