Please correct the errors below.

JavaScript API methods for altering notation

Here are the Soundslice JavaScript API methods for altering notation.

Zooming notation

Here, you specify the zoom level, as an integer, in order to increase or decrease the size of notation. Default zoom is 0, and allowed values are integers between -25 and 25. The bigger the number, the bigger the notation.

var ssiframe = document.getElementById('ssembed').contentWindow;

// Set zoom level to 25
ssiframe.postMessage('{"method": "setZoom", "arg": 25}', 'https://www.soundslice.com');

Toggling notation visibility

For slices with videos, you can toggle the notation on/off. If you toggle the notation off, then the video will take up the entire width of the player. See also the ssNotationVisibility event.

var ssiframe = document.getElementById('ssembed').contentWindow;

// Turn off notation
ssiframe.postMessage('{"method": "setNotationVisibility", "arg": false}', 'https://www.soundslice.com');

// Turn on notation
ssiframe.postMessage('{"method": "setNotationVisibility", "arg": true}', 'https://www.soundslice.com');

Toggling visibility of aspects of notation

Use the setTrackVisibility method to control which aspects of notation are visible, on a per-instrument basis.

This method takes three required arguments: track, type and arg.

track is a zero-based instrument index. Note that, in case of grand staff parts, the two staves are treated as separate instruments.

type is the aspect of notation you want to change:

  • 1 — Staff notation
  • 2 — Tablature
  • 3 — Tablature stems
  • 4 — Chord names
  • 5 — Chord diagrams
  • 6 — Lyrics
  • 7 — Fingering

arg is either 0 (to hide) or 1 (to show).

var ssiframe = document.getElementById('ssembed').contentWindow;

// Hide fingering in the first instrument.
ssiframe.postMessage('{"method": "setTrackVisibility", "track": 0, "type": 7, "arg": 0}', 'https://www.soundslice.com');

// Show fingering in the first instrument.
ssiframe.postMessage('{"method": "setTrackVisibility", "track": 0, "type": 7, "arg": 1}', 'https://www.soundslice.com');

Transposing notation

Use the transpose method to transpose the slice’s notation.

This method takes one required argument: arg, an integer specifying the number of half steps from the slice’s default notation. Valid values are from -12 to 12 inclusive. To reset, use 0.

var ssiframe = document.getElementById('ssembed').contentWindow;

// Transpose notation up a half step
ssiframe.postMessage('{"method": "transpose", "arg": 1}', 'https://www.soundslice.com');

Toggling automatic note pitch names

Use the setAutoPitchNames method to toggle automatic pitch names.

This method takes one required argument: arg, a boolean specifying whether the automatic pitch names should be visible.

Note that this will work regardless of whether your slice has automatic pitch names enabled in its slice settings.

var ssiframe = document.getElementById('ssembed').contentWindow;

// Show auto pitch names
ssiframe.postMessage('{"method": "setAutoPitchNames", "arg": true}', 'https://www.soundslice.com');

Printing notation

Use the print method to initiate printing for the slice’s notation. This is equivalent to the user clicking the “Print” button manually in our player.

Note that the slice must have printing enabled via its advanced settings. If printing is not enabled for the slice, this API method will do nothing.

Also note that opening printing via this API method might trigger browsers’ pop-up blockers. If you use this API method, we highly recommend attaching it to a click handler, as that will be less likely to trigger pop-up blockers.

var ssiframe = document.getElementById('ssembed').contentWindow;

// Print notation 
ssiframe.postMessage('{"method": "print"}', 'https://www.soundslice.com');