sound
Plays and adjusts the sounds a sprite declares. See Costumes and sounds for loading the files.
sprite Cat { sound "./assets/meow.wav";
events.onClick() { sound.setVolume(50); sound.playUntilDone("meow"); }}The sound "./file.wav"; declaration still works. Only sound. selects the namespace.
Playing
Section titled “Playing”sound.play(name: str) -> void ✅ # keeps going while the sound playssound.playUntilDone(name: str) -> void ✅ # waits for the sound to finishsound.stopAll() -> void ✅Effects
Section titled “Effects”sound.setEffect(effect: SoundEffect, value: num) -> void ✅sound.changeEffect(effect: SoundEffect, change: num) -> void ✅sound.clearEffects() -> void ✅sound.setEffect(sound.SoundEffect.PITCH, 10);sound.setEffect("PITCH", 10); # identicalsound.SoundEffect |
Value |
|---|---|
PITCH |
"PITCH" |
PAN |
"PAN" |
Volume
Section titled “Volume”sound.setVolume(volume: num) -> void ✅sound.changeVolume(change: num) -> void ✅sound.volume() -> num ✅