ice6 / opensheetmusicdisplay

Combine `osmd_transpose` and `osmd` together to show transposing function.
https://ice6.github.io/opensheetmusicdisplay/build
BSD 3-Clause "New" or "Revised" License
0 stars 0 forks source link

Request to OSMD #4

Open AlbertHart opened 4 years ago

AlbertHart commented 4 years ago

Even though things are not perfect yet, I think we are about ready to ask OSMD about including this function into OSMD.

Here is the text I propose to add to the OSMD issues page.

NOTE: I will wait until the stems are working better before we send this. But I think they will be ready in the next couple of days.


Transposing Scores in OSMD

ice6 and I have been working on a transpose function for OSMD which we would like to include as part of the OSMD code.

We have created a demonstration of the new feature here:

https://ice6.github.io/opensheetmusicdisplay/build/

You can load or paste a score, select a transpose selection and see it transposed.

The DEMO code calls a single function - transpose_xml() after loading the xml file and before passing it to the OSMD rendering engine.

We propose to add transpose_xml() to the core OSMD code, and also to add the call to it to the demonstration page, so it can be easily tested.

This would be available, of course, to all OSMD participants,

If this seems like a good idea to, we can create a fork, add the code, then let you test it and incorporate it.

We will both be willing to make changes to the code as bugs are found or new features are requested.

image

image

ice6 commented 4 years ago

šŸ‘

AlbertHart commented 4 years ago

OK - I'll work on stems, then send this off

ice6 commented 4 years ago

I have a test after the latest change @fbe8647.

I transpose and back. Then I made a picture, it seems that the accidentals problem was solved.

Only stem problem left.

image

AlbertHart commented 4 years ago

Good. I will try to get stems working today.

AlbertHart commented 4 years ago

I posted this to OSMD issues.

https://github.com/opensheetmusicdisplay/opensheetmusicdisplay/issues/769

We'll see if we get a reaction.

ice6 commented 4 years ago

I posted this to OSMD issues.

opensheetmusicdisplay#769

We'll see if we get a reaction.

cool šŸ‘

MilesMorel commented 4 years ago

@AlbertHart @ice6 amazing work! I really hope it gets merged!

MilesMorel commented 4 years ago

I was working on a solution to the same problem but it wasn't as robust as this so I'd love to use this

AlbertHart commented 4 years ago

I was working on a solution to the same problem but it wasn't as robust as this so I'd love to use this

Miles,

We are also working on other Open Source applications which modify MusicXML files and then either load them into the OSMD Demo, or save them for your own use.

Take a look here for the first one, and if it inspires any other ideas - other things we could help people with by modifying MusicXML files. And let us know what else we could add or improve in this first application.

ISSUE: https://github.com/ice6/opensheetmusicdisplay/issues/13

In the image below, our application has added the two staffs at the bottom to an existing score. All by reading, manipulating and using or re-saving the music xml file

image

AlbertHart commented 4 years ago

I was working on a solution to the same problem but it wasn't as robust as this so I'd love to use this

The code is available now if you want to use it. Basically it is one .js file (not typescript yet) which you include, and one call you make to transpose the XML.

You can get transpose_dom.js from the code tab, and you can see a sample of using it in transpose_dom.htm

You use this code to use it:

<script src="transpose_dom.js?v=2.66"></script>

...
// parameters used:
        // transpose_key e.g. "Bb"
        // transpose_direction - "up" or "down" (use closest if not set)
        // song_name - not currently used
        // show_output - true to show all console.logs
// xml_string is used for file save, display and copy to clipboard.
            xml_string = osmd_transpose.transpose_xml(parameters, xml_string);

We would love to have other people look at it and find bugs, etc. Whether OSMD decides to merge it or not.

Our sample application,

https://ice6.github.io/opensheetmusicdisplay/transpose/transpose_dom.htm

Loads a MusicXML file from disk, transposes it, and then saves it as a new music XML file.