Automated updating of API pages at this location, to reflect patch changes, has ceased from 10.1.7 onwards. |
Plays the specified sound by FileDataID or addon file path.
willPlay, soundHandle = PlaySoundFile(sound [, channel])
Arguments[]
- sound
- number|string - Either a FileDataID, or the path to a sound file from an addon.
- The file must exist prior to logging in or reloading. Both .ogg and .mp3 formats are accepted.
- 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] |
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 a sound file included with your addon and ignores any sound setting except the master volume slider:
- Both slash
/
or escaped backslashes\\
can be used as file separators.
PlaySoundFile("Interface\\AddOns\\MyAddOn\\mysound.ogg", "Master")
Plays the level up sound:
--by file path(dropped in 8.2.0) PlaySoundFile("Sound/Spells/LevelUp.ogg")
-- by FileDataID 569593 (added support in 8.2.0) PlaySoundFile(569593)
-- by SoundKitID 888 (SoundKitName LEVELUP) PlaySound(888)
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 8.2.0 (2019-06-25): Updated to accept FileDataIDs due to the removal of file paths.[3]
See also[]
- PlaySound - Plays a sound by SoundKitID
- StopSound
- MuteSoundFile - Mutes a sound
- UnmuteSoundFile
- PlaySoundFile macros - Listing of audio files shipped with the game