Please correct the errors below.
Log in Go to Soundslice Soundslice

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-track basis.

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

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

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 track.
ssiframe.postMessage('{"method": "setTrackVisibility", "track": 0, "type": 7, "arg": 0}', 'https://www.soundslice.com');

// Show fingering in the first track.
ssiframe.postMessage('{"method": "setTrackVisibility", "track": 0, "type": 7, "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');