How to convert WEM files into playable audio WAV, OGG and MP3

How to convert WEM files into playable audio WAV, OGG and MP3

Published at: 11/14/2021
Updated at: 11/03/2024
Categories
Tags

Convert WEM files into WAV, 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.

Errors with ww2ogg

If you get this error:

Parse error: expected 0x42 fmt if vorb missing 

It means the WEM file cannot be converted with ww2ogg, at this point you can try using VGMSTREAM as indicated below.

Convert WEM into WAV with VGMSTREAM

We can also use vgmstream to obtain a similar or even better result than ww2ogg.

  1. Download the latest release of vgmstream from Github for your system, I have downloaded r1810 for Windows
  2. Extract the archive in the same folder where you have the WEM files

Now you can simply drag and drop the WEM files over the executable file (vgmstream-cli.exe, before version r1831 the filename was test.exe) and this will make a standard conversion into playable WAV files, in the same folder. By default the bitrate will be of 768kbps.

Otherwise you can make a .bat file as before, this time using the new executable, like this:

for %%f in (*.wem) do "./vgmstream-cli.exe" -o %%f.wav %%f
pause

This will conver the WEM files in the folder into WAV which can be played. You can of course convert the WAV into MP3 with ffmpeg if you want.

Convert OGG into MP3

  1. Download FFMPEG
    • I downloaded the full version of 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.exe -i filename.ogg -acodec libmp3lame -b:a 192k filename.mp3

This way you can convert "filename.ogg" into "filename.mp3". You can now play the MP3.

UPDATE: I have made an important update on this code following the comment written by Alastor. I have now specified a bitrate of 192kbps because by default the output bitrate would otherwise be of 64kbps. This should now give you a higher quality audio. The added parameter is -b:a 192k but you can find more options in the ffmpeg documentation.

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 -b:a 192k %%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.

Convert WAV into MP3

In case you have used VGMSTREAM to convert WEM into WAV, you might want to convert the WAV into MP3.

So, from my tests, the WAV files you obtain will have a bitrate of 768kbps. By using ffmpeg we selected the libmp3lame codec, we can of course use different codecs that you can find in the ffmpeg documentation. For this codec we will set a bitrate of 192kbps.

Place the ffmpeg.exe file in the folder where you have WAV files, and then run this command:

./ffmpeg.exe -i filename.wav -acodec libmp3lame -b:a 192k filename.mp3

Again, you can also make another bat file for running the conversion massively:

for %%f in (*.wav) do "./ffmpeg.exe" -i %%f -acodec libmp3lame -b:a 192k %%f.mp3
pause

Also 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!

Let me know your feedback with a comment here below and tell me what other guides you'd like to read!

Leave a comment

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

You can just use a random nickname, it is usefull to allow me to at least answer your comments. And if you choose to submit your email, you can receive a notification whenever I reply to your comment.

*
  • 2024-07-14 18:13:32

    Author: Erik Malkavian

    Worked Beautifully for Wem to Ogg. Thank you!

  • 2024-01-20 22:04:33

    Author: Wuu

    Had to install foobar and then installed the vgmstream release. The key was not extracting the vgm download and going into foobar and importing it. Then converted all the wem and bnk files inside. TO CONVERT BACK YOU NEED WWISE (or something similiar) and WHAM.

  • 2024-01-07 10:16:50

    Author: falreign

    Yo great stuff. However everyone might benefit if the output files in your batch suggested code uses %%~nf instead of %%f so they don't have file names with two extensions in them. Since ~n removes the extension of the filename. For instance: %%f yields "1073686869.wem.wav" while %%~nf yields "1073686869.wav"

  • 2023-12-04 21:35:34

    Author: eartahhj

    @AWD the new name of text.exe (r1810) is vgmstream-cli.exe (r1879). You can see this change in version r1831 here: https://github.com/vgmstream/vgmstream/releases/tag/r1831 (See the Recent Changes where it says "rename test.exe to vgmstream-cli.exe"). In any case, if you download the r1810 release for windows, you can still find the test.exe file. See the file named vgmstream-win.zip here in the r1810 release: https://github.com/vgmstream/vgmstream/releases/download/r1810/vgmstream-win.zip - About BG3 I am not sure what the problem could be, maybe the files have a different format or encoding?

  • 2023-12-04 17:39:59

    Author: AWD

    None of this worked for bg3 atleast. Kinda sucks. And to top it off there is no test.exe in vgmstreamer in any github link.

  • 2023-10-16 12:44:06

    Author: eartahhj

    @SanDeity thank you for your feedback!

  • 2023-10-16 01:32:58

    Author: SanDeity

    Hey this is great! Thanks for all your hard work <3 This is very organized and helpful.

  • 2023-09-25 11:09:08

    Author: eartahhj

    @Anber_liang what exactly did not work on your Mac? Probably some of the programs are based on Windows so I am not sure they will work on all the systems. Also the .bat files work only on Windows, you might need to convert the code into a Mac-friendly alternative.

  • 2023-09-25 10:34:54

    Author: Anber_liang

    Thank you for sharing! I downloaded it and tried it, but it doesn't seem to work on my Mac pro 12. So now I'm using a free converter-TuneSolo Spotify Music Converter to convert OGG files to MP3 format.

  • 2023-05-07 02:31:26

    Author: eartahhj

    @V thank you for your feedback. Please follow us on facebook and youtube! Cheers!

  • 2023-05-06 22:19:41

    Author: V

    Just Works. WEM Audio files from Cyberpunk 2077. thanks!

  • 2023-02-13 16:07:01

    Author: eartahhj

    @Q ok sure let me know!

  • 2023-02-13 15:52:08

    Author: Q

    That works, thanks! haven't lost the files, but I am seeing if I can make a mod for a game. Will report back to you if it works!

  • 2023-02-13 10:56:33

    Author: eartahhj

    @Q I haven't tried but you can do this attempt, I am not sure it will work, try doing the opposite: "for %%f in (*.wav) do "./test.exe" -o %%f.wem %%f" and see if it works. Have you overwritten the WEM files by mistake?

  • 2023-02-13 02:38:31

    Author: Q

    Thanks for the guide, anyway to convert these files back into wem's again?

  • 2023-01-29 15:30:33

    Author: eartahhj

    @Alastor I have just updated the guide to include options to get a better audio quality. Also, I have added instructions on how to use VGMSTREAM to convert WEM into WAV, and also on how to convert WAV into MP3 with ffmpeg. Please let me know if this works better for you and gives you a higher quality.

  • 2023-01-29 10:55:21

    Author: eartahhj

    @Alastor well there are of course a lot of options for ffmpeg that you can apply, for the quality you could try with adding -b:a 192k but that depends on the codec used, in this case libmp3lame, which can be also changed with something else. I will update the article later anyway to add some more information about this. Please remember that the content that you find in this website is all for free. It is fine if you ask to improve the guide of course, but not really to say to go read another guide, that's not really kind of you.

  • 2023-01-29 03:57:02

    Author: Alastor

    I made a comment earlier saying this is helped me a lot, but on closer look in to the mp3 files it looks like they were encoded in 64kbps which really low quality. i'm sure there is a way to fix this in ffmpeg and make a bat file to batch process all the audio clips but in the meantime i suggest the anyone find a different guid on how to do this if you want good quality audio.

  • 2023-01-29 00:13:40

    Author: eartahhj

    @Alastor I am glad this helped you! Good to know that this article is useful! Enjoy your OST and follow us on facebook and youtube, the links are in the footer below!

  • 2023-01-28 06:04:37

    Author: Alastor

    Great article, helped me get the losses Version of Fields of Ard Skellige straight from the Witcher 3 file.

  • 2023-01-02 16:52:37

    Author: eartahhj

    @Brill: You are welcome! Enjoy your new OST. If you can, support us by following our facebook or youtube pages, or by making a donation!

  • 2023-01-02 15:21:16

    Author: Brill

    Thanks for the great explanation! It helped me to extract the wonderful OST of the game AGOS - A Game of Space .

  • 2022-07-03 15:00:59

    Author: eartahhj

    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

    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

    i dont have time for math clas