new Sonification(chart)
The Sonification class. This class represents a chart's sonification capabilities. A chart automatically gets an instance of this class when applicable.
Parameters:
| Name | Type | Description |
|---|---|---|
chart |
Highcharts.Chart | The chart to tie the sonification to |
Requires:
- module:modules/sonification
Try it
Requires
- module:modules/sonification
Methods
-
cancel()
-
Cancel current playing audio and reset the timeline.
-
downloadMIDI()
-
Start download of a MIDI file export of the timeline.
-
getLastPlayedPoint()
-
Get last played point
Returns:
Try it
-
isPlaying()
-
Check if sonification is playing currently
Returns:
boolean .trueif currently playing,falseif not -
playAdjacent(next [, onEnd] [, eventFilter])
-
Play point(s)/event(s) adjacent to current timeline cursor location.
Parameters:
Name Type Argument Description nextnumber Pass
trueto play next point,falsefor previousonEndHighcharts.SonificationChartEventCallback <optional>
Callback to call after play completed
eventFilterHighcharts.SonificationTimelineFilterCallback <optional>
Filter to apply to the events before finding adjacent to play
Try it
-
playAdjacentSeries(next [, prop] [, onEnd])
-
Play next/previous series, picking the point closest to a prop value from last played point. By default picks the point in the adjacent series with the closest x value as the last played point.
Parameters:
Name Type Argument Description nextnumber Pass
trueto play next series,falsefor previouspropstring <optional>
Prop to find closest value of, defaults to
x.onEndHighcharts.SonificationChartEventCallback <optional>
Callback to call after play completed
Returns:
Try it
-
playClosestToProp(prop, targetValue [, targetFilter] [, onEnd])
-
Play point(s)/event(s) closest to a prop relative to a reference value.
Parameters:
Name Type Argument Description propstring Prop to compare.
targetValuenumber Target value to find closest value of.
targetFilterHighcharts.SonificationTimelineFilterCallback <optional>
Filter to apply to the events before finding closest point(s)
onEndHighcharts.SonificationChartEventCallback <optional>
Callback to call after play completed
-
playNote(instrument, options [, delayMs])
-
Play a note with a specific instrument, and optionally a time offset.
Parameters:
Name Type Argument Description instrumentHighcharts.SonificationSynthPreset | Highcharts.SynthPatchOptionsObject The instrument to play. Can be either a string referencing the instrument presets, or an actual SynthPatch configuration.
optionsHighcharts.SonificationInstrumentScheduledEventOptionsObject Configuration for the instrument event to play.
delayMsnumber <optional>
Time offset from now, in milliseconds. Defaults to 0.
Try it
-
playSegment(segment [, onEnd])
-
Divide timeline into 100 parts of equal time, and play one of them. Can be used for scrubbing navigation.
Parameters:
Name Type Argument Description segmentnumber The segment to play, from 0 to 100
onEndHighcharts.SonificationChartEventCallback <optional>
Callback to call after play completed
Try it
-
setAudioDestination(audioDestination)
-
Set the audio destination node to something other than the default output. This allows for inserting custom WebAudio chains after the sonification.
Parameters:
Name Type Description audioDestinationAudioDestinationNode The destination node
-
speak(text [, speakerOptions] [, delayMs])
-
Speak a text string, optionally with a custom speaker configuration
Parameters:
Name Type Argument Description textstring Text to announce
speakerOptionsHighcharts.SonificationSpeakerOptionsObject <optional>
Options for the announcement
delayMsnumber <optional>
Time offset from now, in milliseconds. Defaults to 0.
Try it