How to convert WEM files into playable audio OGG and MP3

How to convert WEM files into playable audio OGG and MP3

Published 11/14/2021
Updated 09/07/2022
Categories
Tags
Keliweb: Slow website? Choose cloud hosting
Keliweb: Slow website? Choose cloud hosting

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

  1. Put WEM files inside a folder
  2. 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
  3. 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
  4. Create a new text file in the same folder, the content will be the code you can find here below
  5. Save the text file with .bat extension, like "run.bat". This will make the file an executable.
  6. Run the file run.bat, you will see all the WEM files in the folder will be converted into OGG.
  7. 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

  1. Download FFMPEG
    • I downloaded ffmpeg for Windows, the EXE files are inside the "bin" folder
    • 7z files can be opened as archives, you can use 7zip
  2. Open a command prompt (cmd.exe)
  3. 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"
  4. 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!

Keliweb: Fast and secure web hosting
Keliweb: Fast and secure web hosting

Leave a comment

All comments will be subject to approval after being sent. They might be published after several hours.

Fields marked with * are mandatory. Email is optional and will not be published in any case.

*
  • 2022-07-03 15:00:59

    Author: eartahhj

    Comment: Well, for the error "Parse error: expected 0x42 fmt if vorb missing", you can try what is indicated here: https://github.com/hcs64/ww2ogg/issues/14. Otherwise you can try this: https://forum.xentax.com/viewtopic.php?p=110795#p110795

  • 2022-06-10 18:41:35

    Author: I got error

    Comment: It didn't work. I got this error: Input: credits01.wem Parse error: expected 0x42 fmt if vorb missing

  • 2022-05-26 21:47:18

    Author: f

    Comment: i dont have time for math clas