Get an Epic Experience with Premium

Pet Battle Music

Audio & Video Login to Add Favorites
  • World of Warcraft
  • 213 Monthly Downloads
  • Supports: 6.2.2
  • 6,054 Total Downloads
  • Updated 09/14/2015
  • Created 09/02/2012
  • 11 Favorites
  • Project Site
  • Comments
  • Release Type: Release
  • License: MIT License
  • Newest File: 1.6

About Pet Battle Music


This AddOn simply plays custom music (like Pokemon music) during pet battles. To add tracks, follow the instructions in music.lua.

For copyright reasons I can't distribute any Pokemon music with this AddOn, but if you know of some suitable music with a permissive licence (or in the public domain), just leave a comment on Curse or WoW Interface and I'll see if I can package it with future releases.

CAUTION: The included Populate_Music scripts will completely overwrite your existing music.lua file! Make sure you back up any manual changes you make.

Both the Windows and Unix scripts require the ogginfo program from the vorbis-tools package.

On Windows, download vorbis-tools-win32-bin.7z from here, unpack it and copy ogginfo.exe, libogg.dll and libvorbis.dll into the Interface\AddOns\PetBattleMusic\ogginfo folder.

On Mac OSX, you can install vorbis-tools from Homebrew (you don't need to put ogginfo in the AddOn folder like on Windows). On other Unix-like systems, you can probably install it from your package manager.

The Unix script also requires mp3info, available from Homebrew or your package manager.

Alpha Versions, API and Source Code

For the latest alpha versions, check CurseForge. API documentation for AddOn authors can be found here.

The source code is now available on GitHub.


  • Update Windows scripts to work with Windows 10
    • Thanks to badjujumojo of Curse for the index
  • Update to 6.2


  • Stop mute timer when starting a new battle before the previous battle's victory/defeat music has finished
    • Fixes music stopping completely and game music being left off in the middle of a battle


  • Change PopulateMusic_Windows to use ogginfo for Ogg files
  • Update unsupported OS message in Windows scripts


  • Update to 6.0
    • Replace animation timers with new C_Timer system
  • Add Windows 8.1 support to PopulateMusic_Windows scripts
  • Add pause to end of shell script
  • Replace %d with %.0f in format patterns
    • ogginfo can return non-integer file lengths, which don't work with %d.
  • Stop using -r option to sed
    • -r is a GNU extension, not portable to all platforms
  • Add option to use backslashes in
    • Move then and do to same line as if and for
  • Change PopulateMusic_Windows.js to compare file types instead of file extensions (which are only included in the name when they're shown in Windows explorer).
    • Move file type checks into the isAudioFile function to make the logic easier to change in future.
  • Replace all == with === in PM_Windows.js
  • Add a missing backslash in the main comment of ScriptParts\music_part0.lua and music.lua


  • Victory/defeat music will now stop playing when you enter a new battle.
  • Updated music.lua with the new instructions.
  • Removed libraries from TOC/.pkgmeta
    • We're using animation objects instead of AceTimer now
  • Added support for Ogg files to the scripts.
  • Replaced README.txt with (for GitHub)
  • Updated TOC Interface number.
  • Added support for separate music tables
    • Most public API functions now take a music table name as their first argument.
    • The script part files are now numbered to support easy construction of music.lua using for loops.
  • Moved settings from core.lua to a new config.lua file.
    • Added a :GetOptionValue() method to the API to get the value of options set in config.lua
  • More documentation changes
  • Changed .docmeta format


  • Added manual LICENCE.txt output
  • Re-added the .docmeta and .pkgmeta files
  • Added public API, removed debugging code
  • Commented out CVar stuff


First Previous Page 1 of 5 Next Last
  • #77

    You've hard coded the WoW directory in the the 2 Populate music scripts. It won't find anything if WoW isn't installed by the default settings into "C:\Users\Public\Games\World of Warcraft". Perhaps you should read the directory from a textfile?

    I should also mention that the script works perfectly fine on windows 10 with "lengthIndex = 27". Windows 10 has a version number of "10.0" so you can just change line 26 of the shell script to "if ( isVer "6.3" "6.2" "6.1" "6.0" "10.0" )" and line 46 of the js to "if ( isVer("6.3", "6.2", "6.1", "6.0", "10.0") )"

  • #78

    You're meant to change the WoW path in the script to match your installation. That's why I put it at the top of the script with a comment explaining the variable.

    Thanks for the Windows 10 check, I'll update the scripts.

    Last edited by Choonster on 9/14/2015 2:17:20 AM
  • #79

    I've just uploaded version 1.6, which includes this change.

  • #75

    Please explain how you determinate when to play win or defeat music cause if my opponent forfits and im thus winning i get the defeat sound to hear?



  • #76

    I use the PET_BATTLE_FINAL_ROUND event to detect victory or defeat. This event has a single argument that describes who the winner is; if it's LE_BATTLE_PET_ALLY the player won, otherwise the player lost.

    Try run this script in game and tell me what it outputs when you win or lose a battle:

    /run local f=PBT or CreateFrame("Frame","PBT")f:RegisterEvent("PET_BATTLE_FINAL_ROUND")f:SetScript("OnEvent",function(_,_,w)print("Winner: LE_B_P_"..(w==LE_BATTLE_PET_ALLY and"ALLY"or w==LE_BATTLE_PET_ENEMY and"ENEMY"or"WEATHER"))end)

    Last edited by Choonster on 8/14/2013 11:28:15 PM
  • #62

    I'm trying to add music with the Java Script, but after changing the game path, i receive the message "Added 0 music files to music.lua". I put a mp3 file in every folder, just in case, but i still receive the same error.

    Thanks for help.

  • #63

    Could you copy and paste the section of your JavaScript file starting with START OF CONFIG and ending with END OF CONFIG into a new CurseForge Paste and paste the URL of that here?

    Could you also tell me where your WoW folder is and what Windows Explorer shows in the "Type" column for MP3 files?

    Last edited by Choonster on 4/17/2013 1:57:41 AM
  • #74

    Well, nothing seems to work, so i just put them manually and worked like a charm.

    The script beat me tho. :(


    Thanks anyways for your help, and sorry for the troubles.

  • #73

    Everything I'm seeing says the script should be working, I have no idea why it isn't. Try run the alpha script from comment #65 from the command prompt with cscript C:\Path\To\Script.js. Do you get any errors or strange output?

  • #72

    The Script shows the following:

    Name: Prueba* Type: Archivo de Audio MPEG Layer 3 Length: 00:02:26

    * that's the title of the MP3 i put there.

  • #71

    I have no idea why the script isn't working. Try this script with MUSIC_DIR set to a folder with around 5 music files in it:

    To run it, open a command prompt (Start > All Programs > Accessories > Command Prompt or press Windows Key + R and type cmd without the quotes) and type cscript C:\Path\To\Script.js >> pbmout.txt before pressing Enter. This should create a text file called pbmout.txt in the folder shown at the start of the current line of the prompt (usually your user folder).

    Post the contents of that file here.

    Last edited by Choonster on 4/18/2013 1:13:14 PM
  • #70

    OS Name: Microsoft Windows 7 Home Premium

    Property Name: Duración

    Index: 27


    (Duración = length)

  • #69

    Strange, it works perfectly well on my computer.

    Could you run the GetLengthIndex_Windows.js script and click OK until you get to "Length" (or whatever it's called on your computer) and then put the contents of that popup in a comment?

  • #68

    Tried the alpha JS, changing the values you pointed out. Still, the same message.

  • #65

    Ah, I forgot that I never packaged the changes with START OF CONFIG as a release version. Try use this alpha version:

    You'll need to set the WOW_DIR, MP3_TYPE and OGG_TYPE variables at the top to the appropriate values.

  • To post a comment, please login or register a new account.
Login to Curse

Don't have an account? Create One.

Get an epic experience with Curse Premium
  • Faster addon downloads
  • Premium-Only Beta Giveaways
  • Ad-Free Curse experience
  • Premium Curse Client
  • and many More Features
  • Learn More »

Gamepedia Free-shirt Giveaway