Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • Jan 27 14:40

    sschmidTU on develop

    chore: update osmd.Version to 1… (compare)

  • Jan 27 14:37

    sschmidTU on develop

    docs: jsdoc, comment (compare)

  • Jan 27 14:33
    sschmidTU commented #678
  • Jan 27 14:31
    sschmidTU closed #678
  • Jan 27 14:31
    sschmidTU commented #678
  • Jan 27 14:21

    sschmidTU on 1.4.4

    (compare)

  • Jan 27 14:21

    sschmidTU on master

    chore: bump osmd.Version to 1.4… docs: jsdoc comment fix(Release): Fix types pointin… and 6 more (compare)

  • Jan 27 14:21

    sschmidTU on develop

    chore: bump version to 1.4.4 chore: update changelog for 1.4… feat(Options): Able to set Engr… and 3 more (compare)

  • Jan 27 13:59

    sschmidTU on develop

    fix(Release): Fix types pointin… (compare)

  • Jan 26 22:36
    sschmidTU edited #1134
  • Jan 26 20:37
    sschmidTU synchronize #1134
  • Jan 26 20:37

    sschmidTU on expressions-simultaneous-wedges

    add test sample simultaneous we… (compare)

  • Jan 26 20:37
    sschmidTU commented #1131
  • Jan 26 20:29
    sschmidTU commented #1131
  • Jan 26 20:25
    sschmidTU synchronize #1134
  • Jan 26 20:25

    sschmidTU on expressions-simultaneous-wedges

    add test sample layered/simulta… (compare)

  • Jan 26 20:17
    sschmidTU edited #1134
  • Jan 26 20:16
    sschmidTU edited #1134
  • Jan 26 20:13
    sschmidTU edited #1134
  • Jan 26 20:09
    sschmidTU synchronize #1134
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.
zhong yi
@zhong_yi_ta_gitlab
image.png
while i draw a rect on sheet, the x position seems not correct. What's wrong with my code?
``` 
                   let graphicalMeasure = this.osmd.graphic.getGraphicalMeasureFromSourceMeasureAndIndex(this.getCurrentCursorMeasure(), 1);
        var svgns = "http://www.w3.org/2000/svg";
        var svg = document.getElementById('svg');
        var shape = document.createElementNS(svgns, "rect");
        shape.setAttributeNS(null, "x", graphicalMeasure.stave['x']);
        shape.setAttributeNS(null, "y", graphicalMeasure.stave['y']);
        shape.setAttributeNS(null, "width",  graphicalMeasure.stave['width']);
        shape.setAttributeNS(null, "height",  graphicalMeasure.stave['height']);

        shape.setAttributeNS(null, "fill", "blue");
        svg.appendChild(shape);
``` 
Simon
@sschmidTU
you can also do it via OSMD:
let boundingbox = osmd.graphic.measureList[0][1].PositionAndShape
osmd.drawer.drawBoundingBox(boundingbox, "#34cfeb")
image.png
also with transparency:
#32cfeb66
image.png
Jari Haavisto
@norppa
Hello! I'm trying to create a react site that would show some sheet music. I have a backend that serves the musicxml (mxl) files, but I can't figure out how to make OSMD read the file streams. Would anybody have an example of how this is (supposed) to be achieved?
at the moment I have a version that works for uncompressed xml files, by reading them into a string and passing that to OSMD, but is there a way to do the same with the compressed files without unzipping them
Simon
@sschmidTU

@norppa have you seen our React example project?
https://github.com/opensheetmusicdisplay/react-opensheetmusicdisplay

also, OSMD can read mxl files (which is zipped musicxml) and unzip them, so you should be able to pass in the compressed file to osmd.load().

but if you really want OSMD to handle the filestream directly, i don't know that there's a universal filestream API for javascript/typescript, so you'll probably have to convert the stream to string anyways. (and pass that to OSMD)
Jari Haavisto
@norppa
yes, I'm using that example as the basis
and it processes local mxl files no problem, it's just that if I fetch them from an API it doesn't seem to be able to handle them and I haven't been able to find an example of how to read the compressed file to a string