PlayMusic

From Warcraft Wiki
Jump to navigation Jump to search
Flavors
Links
Info
Added in 1.0.0 / 1.13.2

Plays the specified sound file on loop to the "Music" sound channel.

willPlay = PlayMusic(sound)

Arguments

sound
number|string - FileDataID of a game sound or file path to an addon sound.

Returns

willPlay
boolean - Seems to always return true even for invalid file paths or FileDataIDs.

Example

Plays Stormstout Brew from the Mists of Pandaria Soundtrack

-- by file path (dropped in 8.2.0)
PlayMusic("sound/music/pandaria/mus_50_toast_b_03.mp3")
-- by FileDataID 642878 (added support in 8.2.0)
PlayMusic(642878)

Details

  • If any of the built-in music is playing when you call this function (e.g. Stormwind background music), it will fade out.
  • The playback loops until it is stopped with StopMusic(), when the user interface is reloaded, or upon logout. Playing a different sound file will also cause the current song to stop playing. It cannot be paused.
  • OggVorbis (.ogg) files are supported since World of Warcraft uses the FMOD sound engine.
  • You can find a full list here: https://wow.tools/files/#search=sound/music

Patch changes

Battle for Azeroth Patch 8.2.0 (2019-06-25): Dropped support for internal file paths and accepts FileDataIDs.
Legion Patch 7.1.0 (2016-10-25): Should once again work correctly. A bug was introduced in Patch 7.0.3 that caused it to be non-functional.
Warlords of Draenor Patch 6.0.3 (2014-10-28): Should now work correctly and be able to play MP3s once more.