Open AlbertHart opened 4 years ago
Thanks for the effort :)
It seems that the latest change make the function broken.
I test it here.
And I sync the latest code to ice6/opensheetmusicdisplay
https://ice6.github.io/opensheetmusicdisplay/build/ and the transpose function breaks.
Found that the text before and after <fifths></fifths>
missed.
Maybe we can use DOMParser
https://developer.mozilla.org/en-US/docs/Web/API/DOMParser to deal with the xml in transpose_xml
function.
It can help reduce the effort to handle edge case in the raw xml.
I just tried a file here:
https://alberthart.github.io/osmd_transpose/transpose/transpose.htm
And it seems to work OK.
But this URL does not seem to have a place to past the code.
https://ice6.github.io/opensheetmusicdisplay/build/
So I am confused.
But it is time for sleep now in Denver.
Let me know if you get it working.
If something is failing, try to give me a more concrete example. For example, send me the MusicXML file which os failing, the URL you are working from, and a picture of the output xml which is wrong.
On Sun, May 17, 2020 at 9:21 PM ice6 notifications@github.com wrote:
It seems that the latest change make the function broken.
I test it here https://alberthart.github.io/osmd_transpose/transpose/transpose.htm.
Found that the text before and after
missed. Maybe we can use DOMParser https://developer.mozilla.org/en-US/docs/Web/API/DOMParser to deal with the xml in transpose_xml function.
It can help reduce the effort to handle edge case in the raw xml.
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/AlbertHart/osmd_transpose/issues/11#issuecomment-629924285, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACEMZ2DWGZXY6G5SIDEY6KDRSCSUPANCNFSM4NDG4HLQ .
-- Al
Maybe we can use DOMParser https://developer.mozilla.org/en-US/docs/Web/API/DOMParser to deal with the xml in transpose_xml function.
I spent a lot of time trying to use a DOM parser to parse the XML, and decided to stick with reading the ASCII myself.
Especially because i wanted to be able to write the transposed XML back to the disk, or pass it on.
One thing, I was worried that many musicxml files may not be properxml.
I read and write most lines without changes, so that I will not introduce errors into the musicxml file because something was not read properly.
So i only change certain parts -
steps to reproduce the error:
open https://alberthart.github.io/osmd_transpose/transpose/transpose.htm
upload the musicxml file Amazing Grace.txt .(Since Github does not support .musicxml, I changed the file extension to .txt)
do as following:
then I got this:
@AlbertHart it was fixed in this commit
and https://ice6.github.io/opensheetmusicdisplay/build/ works agian.
I grabbed these changes and will repost a new version today with them in it.
I moved "<note-" to just before "<note" to keep them closer together"
// skip <note-size , conflicts with note element
if (sline.indexOf('<note-') > -1) {
str_out += sline;
str_out += "\n";
continue;
}
if (sline.indexOf("<note") >= 0)
{
in_note = true;
Transpose direction is also very important. Especially when you are moving by several half steps.
I added the Transpose direction
to the demo
check it out :)
It is 23:33 at ShangHai, I have to sleep.
Have a good day!
Great, thanks.
But I still cannot figure out how to paste a score to the page and get it to translate.
@AlbertHart I did not handle the paste case. Let me to try to fix this.
how else do you pass it a file - in the URL?
OK. I there a reason your demo does not have the select score stuff?
@AlbertHart
Is it this one?
Yes. I didn't see it.
What would you think about adding "Select from disk" below it.
The way I do that is to load a xml file from disk into a string, and then reload the whole page with the string in localeStorage, and read it from the local storage. (I could not find a good way to load a file into a string without then reloading the page)
Or we could get this done and approved and add load from disk to the OSMD Demo later.
On Mon, May 18, 2020 at 8:14 PM ice6 notifications@github.com wrote:
@AlbertHart https://github.com/AlbertHart
Is it this one?
[image: image] https://user-images.githubusercontent.com/889040/82277008-66bec800-99b9-11ea-95fd-3c22b9dde325.png
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/AlbertHart/osmd_transpose/issues/11#issuecomment-630535991, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACEMZ2D2GWA3OUBONDGE5LTRSHTRNANCNFSM4NDG4HLQ .
-- Al
Yes. I didn't see it.
command + shift + R
to reload the page?
What would you think about adding "Select from disk" below it.
drag and drop file on the page
is equivliant to select from disk
Drag and drop, requires that I load MAC FInder in one window, load the demo in a second window and drag the file to the DEMO page. Load from disk would be done entirely from the Demo page - like I do in my transpose.htm page.
Also, load from disk lets us grab the name of the loaded file and display it on the page somewhere. I know we display the title, but the file name is often important as well. People may have several scores with the same title, but different information in them.
I would like to see if we can work on the Demo page and add more functionality to it. Either as a "Demo", or as a different useful page - perhaps "Sample" - for people who want to display pages, chamge even more paramters, and print them.
There are a lot of things I would like to see - such as the ability to resize the display to match the screen window automatically - not by having to use Zoom in and Out - which does not shrink the pixel width of the output.
Also, if i try to print the page, it tries to print the top of the page and not the contents.
I think a better DEMO could make OSMD looklike a better product for people to use.
I think I put in all my latest changes for accidentals, etc.