» Dezrann corpus/developer documentation

Encoding positions in a image source

Dezrann displayed sychronized images. The synchronisation is done through a position file that allows Dezrann to associate musical time with a position in the image. A synchronized image is described as a source:

  // Any image (scan, score, piano roll, diagram...), with positions
  {
    "images": [
        "http://bli/scan-07-page1.jpg", 
        "http://bli/scan-07-page2.jpg" 
    ],
    "positions": "http://bli/positions-07.json"
  }

A position file is a JSON tree structure that can either be stored in a file (here http://bli/positions-07.json) or computed on-the-fly by some view when loading the source. In both cases, its format follows the positions.schema.json schema, as for example: :

{
  "$schema": "https://doc.dezrann.net/schemas/positions.schema.json",
  "pages": [
    {
      "image": "http://bli/scan-07-page1.jpg",
      "rows": [
        {
          // y positions
          "y": 96,
          "height": 214,
          "staves": [
            {
              "top": 96,
              "bottom": 258
            },
            {
              "top": 270,
              "bottom": 310
            }
          ],

          // x positions
          "start-x": 35,
          "end-x": 1465,
          "onset-x": [
            {
              "onset": 0,
              "x": 115.91
            },
            {
              "onset": 1.5,
              "x": 157.51
            },
            ...
          ]
        },
       ... // possibly other rows
      ]
    },
    ... // possibly other pages
  ]
}

Structure.

For many applications, one single page with one single row is enough, yielding to a “linear” source (as a piano roll or a “linear score”). (Historically, there were different formats for linear sources and so-called ‘3D’ sources. Today, the ‘3D’ format is the format to use in all cases.)

The y positions are given with y and height, here between 96 and 310=96+214. In this vertical space, there may be one or several staves, here two. The staves have to be included in that space. For an image without any specific staff, there could be just one staff taking the full height, or even no staff.

The x positions are given by:

Examples

There is here 1 page, composed of 4 rows, each composed of 3 staves:

A page with 4 rows