Tutorial: How To Add Music to OpenRA from RA2 & CnC Remastered

Discussion about the game and its default mods.
Post Reply
TheShwantz27
Posts: 1
Joined: Wed Dec 23, 2020 5:30 pm

Tutorial: How To Add Music to OpenRA from RA2 & CnC Remastered

Post by TheShwantz27 »

I figured out how to add music from other Command and Conquer games into OpenRA...it was hard to piece together instructions from all over, so I wanted to put them in 1 spot for anyone else that wants to do the same. Note that this is for Windows.
Programs You Need:
Audacity https://www.audacityteam.org/
XCC Mixer https://xhp.xwis.net/utilities/ (XCC Mixer is the 5th one down)
OSBIG Editor https://www.ppmsite.com/osbigeditorinfo/ (download links are towards the bottom in middle section of the page)

STEP 1:
The first step is to extract the individual music files (.wav) from the playlist file (.mix or .MEG).
In the case of Red Alert 2, the name of the file is expandspawn01.mix and can be found in the same folder where the game launcher/exe file is (you can use the PC search feature for the name of the file if you can't find this folder).
Image
You'll need to open this file in XCC Mixer.
Image
Once opened in the XCC Mixer program, you'll need to right click the individual .wav file in the left column & select EXTRACT.
Image
A dialogue will pop up and select an appropriate folder to save this .wav file...remember this spot as you'll need it for the next step to alter the attributes of it using Audacity. Repeat this step for each track in the .mix file.
In the case of Command and Conquer Remastered, the name of the file is MUSIC.MEG and can be found in the <Steam Library>/steamapps/common/CnCRemastered/Data folder (you can use the PC search feature for the name of the file if you can't find this folder). You'll need to open this with the OSBIG Editor program.
Image
Select each of the .wav files that you want and click Edit->Extract
Image
or you can use the Edit->Extract All function to get everything.
Image

STEP 2:
The next step for either game is to take the .wav files & alter the attributes to fit the format for OpenRA. They need to have a 16-bit sample format and a 22050 Hz sample rate.
In the case of the Red Alert 2 files, they've already got the correct sample rate, but they're in 32-bit format. To change this, use the Audacity program & open the .wav file that you extracted in Step 1. On the left hand side of the track there is a box with the name of the file and some properties associated with it.
Image
Click the down arrow next to the name of the file and Select Sample Rate format (2nd to last option) and click 16-bit PCM instead of 32-bit float.
Image
You should see the properties box now change to 16-bit PCM.
Image
Then click File on top & Export to save this .wav file somewhere that you'll remember for Step 3.
Image
In the case of Command and Conquer Remastered, they need to have both attributes altered because it's got 32-bit format and a 44100 Hz sample rate. On the left hand side of the track there is a box with the name of the file and some properties associated with it. Click the down arrow next to the name of the file and Select Sample Rate format (2nd to last option) and click 16-bit PCM instead of 32-bit float. You should see the properties box now change to 16-bit PCM. Now change the sample rate in the same manner with Set Rate (last option) & 22050 Hz.
Image
You'll notice a problem...the music track just got twice as long. This is because we're sampling the audio at half the rate of the original. If you try to listen to it, you'll notice that the song is at half speed, like if you clicked the 0.5 playback button on a YouTube video. To solve this problem, we'll need to speed it up by 2x to get it back to the original tempo. Click on Effect on the top and Change Speed.
Image
In the dialogue box that pops up, change it to 100.000 percent change to make it twice as fast.
Image
Now listen back to the track & it should match the original tempo.
OPTIONAL: I found that OpenRA doesn't handle tracks that use both speakers very well...think of the intro to Blow It Up where the guitars pan from left to right speaker...when it gets to the part that pans to a different speaker, it's almost inaudible. To fix this, I changed the track from Stereo to Mono. To do this, select the Tracks option at the top and click Stereo Track to Mono.
Image
You should now see only 1 track instead of 2 previously.
Image
Again this is totally optional, but I found this to make the music sound better in OpenRA.

STEP 3:
Now we need to change these to .aud files & put them in a spot where OpenRA knows to get them. Open XCC Mixer again and navigate the left column to the folder where your OpenRA-formatted .wav files are located. Navigate the middle column to the bits folder in your OpenRA installation which can be found at <OpenRa folder>\mods\ra\bits. You could use the Windows search feature for mbSAM.int which is a file in this folder if you have no idea where to find it.
Image
Then right click on the individual .wav file & then select Copy as AUD.
Image
NOTE: if this option is greyed out, then you messed up step 2 in getting the .wav file in the right format...Copy as AUD only works in this very specific wav file format. If done properly you should see the new .aud file in the middle column.
Image
NOTE: if your install directory is protected, you may have to run XCC Mixer as an administrator to bypass permission restrictions. Repeat this process for each .wav file.

STEP 4:
So now you've got the .aud files in the <bits> folder, so the last step is to edit the music.yaml file to include these new tracks into the OpenRA playlist. This file can be found in the audio folder similar to the bits folder at <OpenRA folder>mods\ra\audio. Again, if you're having trouble finding this, use the Windows search feature for music.yaml & that should get you to the right spot. Open this file in Notepad & you'll see that it already has the music tracks for the base Red Alert game in there. The format of this file goes like this:
<name of file without .wav extension>: <name of track in playlist>
<properties>
You can alter the volume output relative to other tracks in the properties section & you'll see examples of such already there. If you'd like to make comments for yourself, start the line with #. Here's an example of new entries I've added for these tracks:
#RA2 tracks
brainfre: Brain Freeze
drok: Drok
hm2: Hell March 2
#CnC Remastered
RAB_MUS_BIG_FOOT_FKTS: Bigfoot (FKTS)
RAB_MUS_BLOW_IT_UP_FKTS2: Blow It Up (FKTS)

NOTE: if you're having problems with saving this file because your OpenRA directory is a protected folder, then open Notepad as administrator to bypass permission restrictions.

STEP 5:
Confirm that your new tracks that you've added are in OpenRA by firing up the game go to Extras then Music. Scroll to the bottom of the playlist & you'll see your new tracks here.
Image
Give them a play to make sure that volume is appropriate and that they sound good (this is where I found the Stereo/Mono problem I mentioned earlier). If you do NOT see your new tracks here, confirm that your .aud files are in the right bits folder and your edited music.yaml file is in the correct audio folder.

Also as a note, if you want to remove any music tracks from the playlist, how to do it is just comment out the lines in the music.yaml file as such:
#await_r: Afterlife (Await)
# VolumeModifier: 0.7

What I did was after extracting all of the remastered versions of the TibDawn & RA songs, I commented out the originals because why have the inferior versions in the playlist after all that work right?

You can also do this for ANY song that you want to put in the OpenRA playlist, not just music from these 2 games. You'd have to convert any .mp3 file into a .wav of the correct format so start at Step 2 & open your .mp3 from your favorite song into Audacity & go from there.

If you have questions I'll definitely try to help...I'm not sure the legality of me providing these .aud or .wav files for everyone otherwise I would have just done so in a .zip file. Here are some additional resources that helped me (but they weren't as comprehensive as this guide I think you'll find as some links are broken in the GitHub one):
https://github.com/OpenRA/OpenRA/wiki/Audio-guide
https://gamesgds.com/command-conquer-re ... dll-files/

Post Reply