Play a sound with the given volume and pitch.
The sound name corresponds to a resource name in sound.json file. For instance minecraft:entity.player.levelup is the sound one hears when leveling up.
Like .playNote, the volume may be any value between 0 and 3 defaulting to 1.
The pitch argument is slightly different. Instead this may be any value between 0 and 2, with a larger value representing a higher pitch. One may convert from .playNote to .playSound pitches with the following equation: 2 ^ ((pitch - 12) / 12).
This will return true if the sound could be played or false if too many sounds were played in a single tick.
|Play a sound.|
local speaker = peripheral.find("speaker") speaker.playSound("minecraft:entity.player.levelup")