Class: PixelMap

music21.streamInteraction. PixelMap

new PixelMap(mapper, offset)

A PixelMap maps one offset to one x location.

The offset does NOT have to be the offset of an element. Offsets are generally
measured from the start of the flat stream.

Parameters:
Name Type Description
mapper music21.streamInteraction.PixelMapper

should eventually be a weakref...

offset number

the offset that is being mapped.

Properties:
Name Type Description
elements Array.<music21.base.Music21Object>
  • elements being mapped to.
offset number

the offset inputted

x number

x value in pixels for this offset

systemIndex Int

the systemIndex at which this offset appears.

Source:
Example
// not a particularly realistic example, since it requires so much setup...
var s = new music21.tinyNotation.TinyNotation('3/4 c4 d8 e f4 g4 a4 b4');
var can = s.appendNewCanvas();
var pmapper = new music21.streamInteraction.PixelMapper(s);
var pmapA = new music21.streamInteraction.PixelMap(pmapper, 2.0);
pmapA.elements = [s.flat.get(3)];
pmapA.offset;
// 2
pmapA.x;
// 149.32...
pmapA.systemIndex
// 0
Music21j, Copyright © 2013-2016 Michael Scott Cuthbert and cuthbertLab.
Documentation generated by JSDoc 3.4.3 on Wed Jul 26th 2017 using the DocStrap template.