Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • May 13 10:37
    geniot commented #670
  • May 13 10:36
    geniot commented #670
  • May 13 09:45
    sschmidTU commented #670
  • May 13 09:41
    sschmidTU commented #670
  • May 13 09:39
    sschmidTU commented #670
  • May 13 09:38
    sschmidTU commented #670
  • May 13 09:18
    geniot commented #670
  • May 13 09:05
    geniot commented #670
  • May 13 09:00
    geniot commented #670
  • May 11 05:38
    rvilarl commented #1139
  • May 10 21:51
    sschmidTU commented #1139
  • May 10 21:50
    sschmidTU commented #1139
  • May 10 20:31
    rvilarl commented #1139
  • May 10 17:40
    sschmidTU commented #1139
  • May 10 17:36
    sschmidTU commented #1139
  • May 10 17:30
    sschmidTU commented #1139
  • May 10 17:30
    sschmidTU commented #1139
  • May 10 17:28
    sschmidTU synchronize #1139
  • May 10 17:27

    sschmidTU on vexflow4

    refactor: remove some `any` usa… Merge branch 'develop' into fea… (compare)

  • May 10 17:23
    sschmidTU synchronize #1139
Simon
@sschmidTU
hmm never seen that before
oh yeah
multi-measures don't have notes, so avoid checking cursor notes there
Hallvord R. M. Steen
@hallvors
I mean the "play through" mode that will move the cursor according to durations and repeats - I have an implementation, but yours will probably be better :)
(I generated SVGs with some meta data to help cursor movement on the server, but I'm most likely moving back to running OSMD on the client because my poor cheap Heroku server didn't have a truckload of memory and kept crashing.. I'm not going to debug memory leaks that could be somewhere in my code or OSMD or Vexflow or JSDOM..well, anywhere. :/ )
But I might end up with a hybrid solution that prefers SVG from server if it is available, otherwise loads MusicXML and OSMD. :)
Hallvord R. M. Steen
@hallvors
I didn't expect getSVGElement() to throw. Seems like a known condition you may want to handle by returning null or something? Don't know what the coding conventions around here are, but I'd expect exceptions only for stuff that's truly unexpected or wrong. If "no notes for a multi-measure rest" is a known thing, returning null and documenting this would make sense to me.
Simon
@sschmidTU
one tipp for memory usage: if you don't await osmd.load(), memory may not be freed up between renders. for some reason.
yeah, true that, we should return undefined for multi measure rests in getSVGElement().
Simon
@sschmidTU
the throwing is patched on develop now.
Hallvord R. M. Steen
@hallvors
Wow, that was fast :)
Hallvord R. M. Steen
@hallvors
I've been looking for a way to get the SVG path-element drawn for a multi-measure rest bar, but measure.multiRestElement has no references that I could find - and it seems VexFlow doesn't make this easy either, the element does not even have an ID..
phamconganh
@phamconganh
@sschmidTU can we have GetNearestVerticalContainerStaffEntry? the method GetNearestStaffEntry can't get exact vertical container staffentry.
Hallvord R. M. Steen
@hallvors
How is the collaboration between OSMD and Vexflow? :) I suppose what I'm trying to do now might get easier if I submitted a PR to Vexflow to give multi-measure rest indicators an ID (no idea how hard it would be to add thought..)
Simon
@sschmidTU
yeah sometimes we submit PRs to Vexflow, though recently we rather add things to our src/VexFlowPatch, because we're using an older version of vexflow anyways (1.2.93, because 3.x has huge formatting issues).
so, in your place i'd definitely rather make a VexFlowPatch addition.
phamconganh
@phamconganh
@sschmidTU can you change private in the OpenSheetMusicDisplay.ts to protected in the next release for classes which extend this can call the private?
Simon
@sschmidTU
which variables do you want to accesss? Usually what's private is not intended to be accessed by other objects.
phamconganh
@phamconganh

@sschmidTU for example some variables

  // protected zoomUpdated: boolean = false;
  // protected needBackendUpdate: boolean = false;
  // protected rules!: EngravingRules;
  // protected sheet?: MusicSheet;
  // protected graphic?: GraphicalMusicSheet;
  // protected drawer!: VexFlowMusicSheetDrawer;
  // protected drawingParameters!: DrawingParameters;

and the private function reset
I create a class which extends the OpenSheetMusicDisplay.ts and need override some function and needs call these variable. It's wonderful if the lib change the private to protected for extend

Simon
@sschmidTU
ok, this is added in the public osmd, will be in osmd-extended in the next merge.
for now at least for the variables you can use e.g. (sheet as any).member to access them.
Simon
@sschmidTU
@phamconganh this is now fixed, these variables and methods are protected now.
phamconganh
@phamconganh
@sschmidTU tks you. And I think can OSMD render Measure rows step by step instead of render all to optimise for render large musicxml? and emit event after draw a measure row for do something?
Simon
@sschmidTU
that's planned, it's not so easy, but it would be nice.
phamconganh
@phamconganh
@sschmidTU Great! And Can you change the private function to protected in OpenSheetMusicDisplay.ts for the same reason extends?
Simon
@sschmidTU
what do you mean? change which function to protected?
there is nothing private anymore in OpenSheetMusicDisplay.ts
phamconganh
@phamconganh
@sschmidTU oh sorry, a little mistake I haven't read all the commit, thank you so much for this enthusiastic support
Simon
@sschmidTU
you're welcome! by the way, it would be fantastic if you considered becoming our sponsor on github :)
https://github.com/sponsors/opensheetmusicdisplay
zhong yi
@zhong_yi_ta_gitlab
Is there any way to set the cursor to whole measure width? the default cursor is for single note only. Or is there any method can highlight a whole measure?
Hallvord R. M. Steen
@hallvors

I think I have seen a method with a promising name, but I ended up doing something like this:

    let graphicalMeasure = osmdInstance.graphic.getGraphicalMeasureFromSourceMeasureAndIndex(
      measure,
      0
    );
    let rect = document.createElementNS(SVGNS, 'rect');
    if (graphicalMeasure && graphicalMeasure.stave) {
      ['x', 'y', 'width', 'height'].forEach(prop => {
        rect.setAttribute(prop, graphicalMeasure.stave[prop]);
}
svg.appendChild(rect);

and styling the rect appropriately.

Simon
@sschmidTU
yeah, there is no method for this in OSMD, but i think others have implemented it.
Hallvord R. M. Steen
@hallvors
(I'm lucky enough to work with one voice at a time, you may need to adapt and call the getGraphicalMeasure... several times instead of just passing 0)
I'm sort of happy with the above solution, only complaint is that the lower border is below the bottom line of the system - sort of makes sense because you get the noteheads below the bottom line inside your frame, but it also looks a bit odd.
(This of course requires using the SVG backend too, I don't know how to do it if you use Canvas)
Hallvord R. M. Steen
@hallvors
By inserting an extra SVG rect inside the SVG itself one can use the coordinates of other SVG elements without any tricky calculation of the corresponding values in pixels for positioning things according to the page..
@sschmidTU I think I saw a "render until measure X" parameter mentioned somewhere. Would that be a step towards rendering parts at a time?
Hallvord R. M. Steen
@hallvors
Did anyone look into whether the main performance issue could be fixed by reading some value out of Vexflow instead of getting it from a canvas element or some such? And is that issue even an issue if you're using the SVG backend?
I mean #937 by the way
Simon
@sschmidTU
we did try to get values out of Vexflow i think. Using SVG data seems to be the best approach.
Hallvord R. M. Steen
@hallvors
Is it only an issue for the Canvas backend? For me the OSMD rendering seems reasonably fast, loading the XML is a bit slow and I should probably look into using compressed MusicXML instead of uncompressed..
Simon
@sschmidTU
it's mostly only an issue for large scores that are bigger than 1 or 2 pages.
Hallvord R. M. Steen
@hallvors
I usually need only one voice at a time, and use a server-side script to parse the MusicXML and remove the un-necessary parts, it did speed up rendering nicely compared to just setting voices to invisible. I have one big score in particular that renders very slowly..
phamconganh
@phamconganh
image.png
@zhong_yi_ta_gitlab do you want this?
zhong yi
@zhong_yi_ta_gitlab
@phamconganh yes , this is the result i am looking for. may i know how you set the blue rect? Thanks.
zhong yi
@zhong_yi_ta_gitlab
@hallvors I am tring your solution. Thanks. I am using osmd on a e-ink pad. It has very limited screen fresh rate which i have to reduce recreen changes. Will get it back if it works for me .Thanks anyway .
phamconganh
@phamconganh
@zhong_yi_ta_gitlab
public moveToGraphicalMeasure(graphicalMeasure?: GraphicalMeasure, forceShow?: boolean): this {
    if (!graphicalMeasure) return this;
    const musicSystem: MusicSystem = graphicalMeasure.ParentMusicSystem;
    if (!musicSystem) return this;
    const nextMusicSystem = musicSystem.NextSystem;
    const bboxMusicSystem = musicSystem.PositionAndShape;
    const bboxMeasure = graphicalMeasure.PositionAndShape;
    const x = bboxMeasure.AbsolutePosition.x + bboxMeasure.BorderMarginLeft;
    const width = bboxMeasure.Size.width;
    const y = bboxMusicSystem.AbsolutePosition.y + bboxMusicSystem.BorderMarginTop;
    let height = 0;
    if (!nextMusicSystem) {
      height = bboxMusicSystem.Size.height;
    } else {
      const bboxNextMusicSystem = nextMusicSystem.PositionAndShape;
      height = bboxNextMusicSystem.AbsolutePosition.y + bboxNextMusicSystem.BorderMarginTop - y;
    }
    const offsetHaftHeight = 0.1;
    const offsetHaftWidth = 0.2;
    const tmpRect = new RectangleF2D(
      x - offsetHaftWidth,
      y - offsetHaftHeight,
      width + offsetHaftWidth * 2,
      height + offsetHaftHeight * 2
    );
    const rect = this.controller.applyScreenTransformationForRect(tmpRect);
    this.currentGraphicalMeasure = graphicalMeasure;
    // console.log(graphicalMeasure)
    // console.log((graphicalMeasure as any).stave, x, y, width, height)
    if (forceShow && this.hidden) {
      return this.updateStyle(rect).show();
    } {
      return this.updateStyle(rect);
    }
  }
basically like this, you get the rect then you add custom cursor svg like @hallvors
phamconganh
@phamconganh
@sschmidTU is the next release coming soon?
Simon
@sschmidTU
@phamconganh yes, it is.