Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • 08:40
    rvilarl commented #1105
  • 06:52
    rvilarl synchronize #1094
  • 06:46
    rvilarl synchronize #1094
  • 06:12
    rvilarl synchronize #1105
  • Dec 03 23:20
    sschmidTU commented #1105
  • Dec 03 22:45
    rvilarl commented #1105
  • Dec 03 22:37
    rvilarl synchronize #1105
  • Dec 02 17:50

    sschmidTU on develop

    comment (compare)

  • Dec 02 17:08

    sschmidTU on develop

    fix(GroupBrackets): Don't draw … (compare)

  • Dec 02 13:32
    kenboy2304 commented #1106
  • Dec 02 12:46
    sschmidTU commented #1106
  • Dec 02 12:45
    sschmidTU closed #1106
  • Dec 02 12:45
    sschmidTU commented #1106
  • Dec 02 12:44

    sschmidTU on develop

    feat(ChordSymbols): add Engravi… (compare)

  • Dec 02 12:28
    sschmidTU commented #1062
  • Dec 02 12:13
    sschmidTU commented #1062
  • Dec 02 12:06

    sschmidTU on develop

    fix(Positioning): Fix ghost not… (compare)

  • Dec 02 12:03
    sschmidTU closed #1022
  • Dec 02 12:03
    sschmidTU commented #1022
  • Dec 01 16:47
    kenboy2304 commented #1106
禄碌无为
@rianlu
Yes, I have seen the previous chat, but I want to show only the left or right hand, is there any good way?
phamconganh
@phamconganh
@rianlu you create 2 custom cursor right hand and left hand, and a function moveToSourceStaffEntry(sourceStaffEntry) and condition for move is sourceStaffEntry.ParentStaff.Id == 1 for right hand and sourceStaffEntry.ParentStaff.Id > 1 for left hand
phamconganh
@phamconganh
image.png
禄碌无为
@rianlu
@phamconganh Thank you for your reply. Now I can use osmd.cursor.iterator.CurrentVoiceEntries[0].ParentSourceStaffEntry.parentStaff.id to judge the left and right hands, but it is not clear how to use it, because I am also new to osmd. I want to be able to use code to control the display of the left and right hands of the score, just like controlling the display of the scores of different instruments: osmd.sheet.Instruments[0].Visible = false. My idea is to be able to display only the left hand or the right hand, or Some special treatments are performed on the right hand, such as setting transparency, etc. This way, you can practice the left and right hands separately. I don’t know if this will be difficult to achieve.
image.png
The picture above is what I hope to achieve
Simon
@sschmidTU
you can't only display the right or left hand of a piano score right now, unfortunately, because they are part of the same Instrument.
maybe you can remove the staff from the xml, using osmd.OnXMLRead to give a function that manipulates the xml and returns a new xml before it is loaded by OSMD.
Simon
@sschmidTU

@rianlu regarding checking for rhythm, I just changed SourceMeasure.RhythmPrinted to be of type RhythmInstruction instead of boolean. So you'll be able to check sourceMeasure.RhythmPrinted.Rhythm.Nominator (3) and Denominator (4) for a 3/4 score. this is updated on the develop branch, will be in the next OSMD release.

if you need the information now, with a method that works in the current OSMD release, see MusicSystemBuilder.AddInstructionsAtMeasureBegin in the source code.

Simon
@sschmidTU
so you would check e.g. osmd.sheet.SourceMeasures[0].RhythmPrinted
Simon
@sschmidTU
actually, showing e.g. only the right hand from a piano score by removing the other staff from the xml doesn't seem to work that simply. i tried setting staff-layout number="1" and removing notes with <note><staff>1 in a very simple piano score, but that wasn't enough.
so, we'd like to implement this feature, but it would take some time.
禄碌无为
@rianlu
@sschmidTU Thank you for your answer! I'm going to try next!
禄碌无为
@rianlu
image.png
I got it!
Simon
@sschmidTU
nice! the other method i mentioned will probably be easier once the next osmd version is released, but if you already got it working, no reason to worry about it i guess ;)
禄碌无为
@rianlu
I used osmd.cursor.iterator.CurrentVoiceEntries[0].ParentSourceStaffEntry.parentStaff.id to distinguish the left and right hands, and I have got all the notes for the left and right hands. Is there a way to make the cursor jump to the specified position? In other words, the cursor can only be moved based on the left-hand score or the right-hand score?
For example only based on the left hand
image.png
禄碌无为
@rianlu

I also tried osmd.cursor.iterator.currentVoiceEntries[0].notes[0].printObject = false to hide note,
then use

osmd.cursor.iterator.moveToNextVisibleVoiceEntry()
osmd.cursor.update()

to control and update the cursor, but still the same as before

禄碌无为
@rianlu
I found a solution, take out all the notes, and save the corresponding id (used to distinguish between left and right hands) in the note, and then judge the id when moving the cursor. For example, if I am following the left-handed score, when I move the cursor at a fixed speed, the id will be judged. If it is left-handed, there will be a duration, and then move the cursor; if it is right-handed, move the cursor directly until the next left hand
Hallvord R. M. Steen
@hallvors
@sschmidTU is this the right place to discuss the osmd-extended project and ask questions?
Simon
@sschmidTU
@hallvors better would be on our Discord server: osmd.org/discord
i'll give you the sponsor role so you'll see the sponsor exclusive channels.
or of course in the osmd-extended Issues section on github
Tom Pe
@taat
image.png
Hi guys! How can I change the head color of one specific note under the cursor, without re-rendering the whole sheet? (I need it to be lightning fast). Is there a way to access the actual head element in the SVG?
Simon
@sschmidTU
@taat yes.
osmd.rules.GNote(osmd.cursor.NotesUnderCursor()[0]).getSVGGElement()
it will have one or more subelements vf-notehead whose color you can change.
Tom Pe
@taat
@sschmidTU Than you Simon, that was really helpful.
@sschmidTU Next question: How can I add/remove a note head without re-rendering at the current cursor position? (I want to show currently pressed keyboard note).
Simon
@sschmidTU
@taat for removing, you can remove the svg element of the notehead. adding is not possible out of the box, but you can try copying a notehead element and placing it somewhere else.
Tom Pe
@taat
@sschmidTU That's exactly what I did, thanks. How can I overload the Cursor class and use my CursorExtended class instead? I'm using OSMD with TypeScript/Angular.
Simon
@sschmidTU
just extend the cursor class
then set osmd.cursors = [myCursor] (needs to be an array)
Tom Pe
@taat
@sschmidTU Hmm. That did not work. I tried:
image.png
Simon
@sschmidTU
oh, you need to implement the hide() method in your Cursor class, apparently. It's strange because that should be taken from the OSMD cursor via extends, it's a public method there.
Simon
@sschmidTU
maybe you can do it like this:
public hide() {
  base.hide();
}
Tom Pe
@taat
@sschmidTU This didn't work either. It's not inheriting the methods at all. (I'm using this npm package with latest Angular). I get the following error:
image.png
Tom Pe
@taat
How does OSMD draw the notes? How can I draw a C# whole note (halftone 49) at the current cursor location? (assumming we're dealing with piano sheet)
Simon
@sschmidTU
That's strange. The Cursor class is exported in OSMD. May be an error with how webpack builds the module.
You can't just draw a note somewhere. OSMD is using Vexflow for rendering, which doesn't allow you to just add notes somewhere after the measure has been constructed and rendered. We could add a feature to do this and work around it in Vexflow, but it's not going to be easy to implement. You could try copying the SVGElement for a note and inserting it at a new position.
but that's why we say OSMD is a MusicXML renderer, not a sheet music editor.
Tom Pe
@taat
@sschmidTU I suppose this inheriting issues is related to the npm module itself not to the library. As for drawing - now I'm copying the note heads and moving them around (to show if the correct/wrong key is pressed), but this is not perfect. Some measures don't have note heads at all. I'm aiming at drawing notes also between the beats, when the midi key is pressed, similar to this:
image.png
@praisethemoon Did you have similar problem in Moon Piano? How did you solve highlighting the missed notes?
Simon
@sschmidTU
you could just display all notes and color the ones that were missed. you can get the note's svg element and set the color instantly via svg. also to transparent if you want to hide some temporarily.
Tom Pe
@taat
Yes, that's easy to indicate the correct ones (green on the screenshot), but not that trivial with the missed and off-beat notes (drawn in random places, when the cursor is moving and the user presses random keys). My approach now would be to create a cursor with all possible notes (or just one), invisible, move it along the timestamp and leave a copy of the note at current timestamp. But for now I don't know how to draw all the notes at the correct location on the staff (line or space). BTW, I really appreciate your responses, thank you.
Simon
@sschmidTU
yeah, that's not so easy. maybe you should copy a quarter note SVG from somewhere before you start the play method, and insert it at the cursor location. The distance between a line (let's say E and G in the treble staff) is 1 unit in OSMD, or 10 pixels at 100% zoom.
phamconganh
@phamconganh
@sschmidTU can i render a music system step by step? and get event when a music system is rendered
Simon
@sschmidTU
@phamconganh no, not yet. but you can give an option to draw measures x to y if you want.