Convert WEM files into OGG and MP3 audio
Some games like Age of Empires or Warhammer: 40,000 use WEM files to reproduce sound effects and voices.
As an example, I found WEM to be used in Age of Empires 4, so I wanted to understand how to make them playable. By default WEM can't be listened to.
Convert WEM into OGG
- Put WEM files inside a folder
- Download ww2ogg from Github, you need to download the last release
- As an example, I downloaded "ww2ogg024.zip"
- Extract the ww2ogg ZIP into the same folder with WEM files. There must be the file ww2ogg.exe
- Download reVorb from Github, the latest release available
- I downloaded "ReVorb.exe"
- Place the reVorb EXE file inside the folder with WEM files and with ww2ogg.exe
- Create a new text file in the same folder, the content will be the code you can find here below
- Save the text file with .bat extension, like "run.bat". This will make the file an executable.
- Run the file run.bat, you will see all the WEM files in the folder will be converted into OGG.
- Additionally, you can convert the OGG files into MP3, read below to find out how.
run.bat: (credits Pastebin)
for %%f in (*.wem) do "./ww2ogg.exe" %%f --pcb "./packed_codebooks_aoTuV_603.bin" pause for %%f in (*.ogg) do revorb.exe %%f pause
Basically, this file run.bat scans the folder where it is placed in, it executes ww2ogg.exe on all WEM files, which will be converted into OGG files. Then, OGG files are adjusted one by one with reVorb.exe, so they will be playable.
If you want, you can edit the code of run.bat by opening it simply with any text editor. You might want to change the files folders in the script.
"./" is the current folder, while "./ww2ogg/ww2ogg.exe" means "run the ww2ogg.exe file inside the ww2ogg folder". The path of these folders refers to where the run.bat file is placed, that is why it is better keep it with the WEM and the other EXE files, it will be easier for you.
Now you can use a player like MPC-BE to listen to OGG files.
Convert OGG into MP3
- Download FFMPEG
- Open a command prompt (cmd.exe)
- Move inside the folder where ffmpeg.exe is, for a easier use you can move the OGG file inside the folder where ffmpeg.exe is.
- To do so, use the command "cd" which means change directory, example: "cd C:\Programs\ffmpeg"
- Execute the command below, the path of the OGG file could be different if the folder differs.
ffmpeg -i filename.ogg -acodec libmp3lame filename.mp3
This way you can convert "filename.ogg" into "filename.mp3". You can now play the MP3.
You can massively convert the OGG into MP3 file creating another BAT file with the following code:
for %%f in (*.ogg) do ffmpeg -i %%f -acodec libmp3lame %%f.mp3 pause
Basically, I adapted the previous BAT file so that it scans all OGG files and automatically convert them with FFMPEG into MP3.
Let me know your feedback with a comment here below and tell me what other guides you'd like to read!
Stay up to date!
In the future we will surely talk about other topics on this subject, so if this article was useful to you I invite you to follow us on Facebook and to subscribe our Youtube channel!