Automated updating of API pages at this location, to reflect patch changes, has ceased from 10.1.7 onwards. |
Plays the specified sound by SoundKitID.
willPlay, soundHandle = PlaySound(soundKitID [, channel, forceNoDuplicates, runFinishCallback])
Arguments[]
- soundKitID
- number - Sound Kit ID in SoundKitEntry.db2. Sounds used in FrameXML are defined in the SOUNDKIT table.
- channel
- string?
= SFX
- The sound channel.
Channel | Toggle CVar | Volume CVar[1] |
---|---|---|
Master |
Sound_EnableAllSound | Sound_MasterVolume |
Music |
Sound_EnableMusic | Sound_MusicVolume |
SFX (Effects) |
Sound_EnableSFX | Sound_SFXVolume |
Ambience |
Sound_EnableAmbience | Sound_AmbienceVolume |
Dialog |
Sound_EnableDialog | Sound_DialogVolume |
Talking Head [2] |
- forceNoDuplicates
- boolean?
= true
- Allows duplicate sounds if false. - runFinishCallback
- boolean?
= false
- Fires SOUNDKIT_FINISHED when the sound has finished playing, arg1 will besoundHandle
.
Returns[]
- willPlay
- boolean - true if the sound will be played, nil otherwise (prevented by a muted sound channel, for instance).
- soundHandle
- number - identifier for the queued playback.
Example[]
Plays the ready check sound file (sound/interface/levelup2.ogg)
PlaySound(SOUNDKIT.READY_CHECK) -- by SOUNDKIT key
PlaySound(8960) -- by SoundKitID
PlaySoundFile(567478) -- by FileDataID
Details[]
- Sound Kit IDs are used to play a set of random sounds. For example the human female NPC greeting sound kit refers to 5 different sounds.
/run PlaySound(5980)
-- will play one of these sounds
/run PlaySoundFile(552133) -- sound/creature/humanfemalestandardnpc/humanfemalestandardnpcgreeting01.ogg
/run PlaySoundFile(552141) -- sound/creature/humanfemalestandardnpc/humanfemalestandardnpcgreeting02.ogg
/run PlaySoundFile(552137) -- sound/creature/humanfemalestandardnpc/humanfemalestandardnpcgreeting03.ogg
/run PlaySoundFile(552142) -- sound/creature/humanfemalestandardnpc/humanfemalestandardnpcgreeting04.ogg
/run PlaySoundFile(552144) -- sound/creature/humanfemalestandardnpc/humanfemalestandardnpcgreeting05.ogg
Finding Sound IDs[]
File Data IDs
- By file name/path, e.g. Spells/LevelUp,type:ogg in wow.tools
- By SoundKitID, e.g. skit:888 in wow.tools
- By sound kit name with https://wow.tools/files/sounds.php
Sound Kit Names/IDs
- From the sounds tab for an NPC, for example https://www.wowhead.com/npc=154304/waveblade-shaman#sounds
- By sound kit name with https://www.wowhead.com/sounds and SoundKitName.db2
- IDs used by the FrameXML are defined in the SOUNDKIT table
- The full list of IDs can be found in SoundKitEntry.db2
Patch changes[]
Patch 7.3.0 (2017-08-29): Changed. String-based input is not allowed. SoundKitID should be given while calling PlaySound(). This change is more like a replacement for PlaySoundKitID.
Patch 7.0.3 (2016-07-19): Added fourth argument, runFinishCallback
.
Patch 5.0.4 (2012-08-28): Added willPlay
and soundHandle
return values.
See also[]
- PlaySoundFile - Accepts FileDataIDs and addon file paths.
- StopSound