M MY Multiplayer: Wiki
Side
Kind

setSoundProperties

Client

Changes a sound's sample rate, tempo and pitch, and whether it plays backwards.

bool setSoundProperties(sound sound, float sampleRate, float tempo, float pitch [, bool reversed = false])

Parameters

NameTypeDescription
soundsoundThe sound element, or a dui element for the browser's sound.
sampleRatefloatSample rate in Hz, between 0.05 and 50 times the file's own.
tempofloatTempo change in percent, from -95 to 5000. 0 keeps the tempo.
pitchfloatPitch change in semitones, from -60 to 60.
reversedboolPlay the sound backwards.default false

Returns

true if the sound was found, false otherwise.

Example

local music = playSound("sounds/track.mp3")
local rate = getSoundProperties(music)
setSoundProperties(music, rate, 10, -2)
NoteA value outside its range is silently ignored and the previous one stays.

See also