Skip to content
ChartDeck ChartScript docs Account Open the terminal

sound

Short sounds a script can play on the live bar. Built-in sounds only (made in the browser, no file is loaded); the viewer controls volume and mute.

#Functions

#sound.playfunction

Plays a built-in sound (sound.) or one of the viewer's own clips (sound.custom1 to sound.custom3) when the newest bar runs live. Never on history; at most one sound per run; the page limits how often sounds play. Anything that is not a sound. id is ignored.

sound.play(id: string, { volume?: float = 0.6, freq?: const alert_freq = alert.freq_once_per_bar })
ParameterTypeDescription
idstringThe sound: sound.chime, sound.ping, ... or sound.custom1 to sound.custom3.
volumefloatdefault 0.6From 0 (silent) to 1; the viewer's own volume applies on top.
freqconst alert_freqdefault alert.freq_once_per_barHow often it may fire: alert.freq_once_per_bar (default), _once_per_bar_close or _all.

Example

ChartScriptFragmentOpen in editor
if (ta.crossover(close, ta.sma(close, 20))) {
    sound.play(sound.chime)
}

Since ChartScript 1

#Constants

NameTypeDescription
sound.alarmstringThree short beeps.
sound.chimestringTwo soft bell notes.
sound.coinstringTwo bright notes.
sound.custom1stringThe viewer's own clip number 1 (picked in their Settings, kept in their browser); a plain ping when the slot is empty.
sound.custom2stringThe viewer's own clip number 2 (picked in their Settings, kept in their browser); a plain ping when the slot is empty.
sound.custom3stringThe viewer's own clip number 3 (picked in their Settings, kept in their browser); a plain ping when the slot is empty.
sound.fallstringThree notes going down.
sound.knockstringTwo low knocks.
sound.pingstringOne short high note.
sound.popstringA short low pop.
sound.risestringThree notes going up.
sound.thudstringOne deep low note.
sound.tickstringA very short click.

The ChartScript documentation is in English for now; translations will follow.