TUTORIAL: How to put custom music in VVVVVV

Started by allison, January 17, 2016, 08:06:04 PM

Previous topic - Next topic

allison

EDIT: Infoteddy recently put together a tutorial for adding multiple custom songs to VVVVVV: https://www.youtube.com/watch?v=VkD7Tkn1duc

The command he uses in the terminal to download the script is here for your copy and pasting pleasure: wget http://78.72.124.73/fiq.zip

He glosses over a few things so I'd like to put together a tutorial here soon, but I figured I'd put this link here in the meantime.
If you'd prefer to use the old, somewhat simpler one-song method, read below.




Introduction
In VVVVVV 2.2, an asset modding feature was added that allows you to easily add custom tiles, sprites, and sound effects to your level. However, adding custom music is a bit trickier, because all of the game's music is stored in a single binary file. Unfortunately, people have only figured out how to replace one song: "Predestined Fate Remix", but this may change in the future.




Step 1: Set up your song file
VVVVVV only accepts music in the "Ogg Vorbis" file type, and music cannot have metadata (author, genre, etc). If your music already ends with the extension ".ogg" and lacks metadata you're all set. If not, there are programs online to convert your file to OGG and remove metadata.




Step 2: Get the binary file from VVVVVV's data
If you've modified tiles/sprites/sfx before, you probably already know how to do this. VVVVVV's data is stored in "data.zip", a compressed folder. data.zip is stored next to the executable in the Windows version. In the Mac version, it's stored in the app itself; right click and select "View Package Contents" to get at it. Decompress data.zip and copy vvvvvvmusic.vvv somewhere else.




Step 3: Open the file in a hex editor
The rest of the tutorial will involve working with a hex editor. Hex editors are used for directly editing a file's hex data, which is essentially an easier-to-read version of the binary code. There are a variety of hex editors available. My personal preference is Notepad++ with the hex editor plugin, but pretty much any hex editor will do. Hex editors look very intimidating (like you're staring into the Matrix!), but what we need to do is simple enough. Once you open the file, it should look something like this:






Step 4: Find the position of "Predestined Fate Remix" in the file
All 15 of the songs stored in this file are prefaced with the following string:
4F 67 67 53 00 02 00 00 00 00 00 00 00 00
This is the Vorbis header, and it tells programs that a file is an OGG file. vvvvvvmusic.vvv is mostly comprised of a bunch of OGG files stuck together. Use your editor's Find function (generally opened with Ctrl+F, or Cmd+F on Mac) and paste that string:



Use it to highlight the last instance of the Vorbis header:






Step 5: Delete "Predestined Fate Remix" from the file
Highlight from the start of the Vorbis header all the way to the end of the file:



Remember, that last Vorbis header should be deleted too. Like this:






Step 6: Copy the music you want
Open the .ogg file you want to put into the game with the hex editor. This time, select the entire file (usually Ctrl+A will do this, or Cmd+A on Mac). Notice that the Vorbis header is present here too. Copy your selection to the clipboard (Ctrl+C, or Cmd+C on Mac).






Step 7: Paste the music into the binary file

Go to the very end of the vvvvvvmusic.vvv file and append your song data (Ctrl+V, or Cmd+V on Mac).






Step 8: Fix music looping

If your music is shorter than Predestined Fate Remix, you can safely skip this step. However, if your music is longer, it will loop back to the beginning prematurely in-game. Fortunately, it turns out there's a way to fix this. At the beginning of vvvvvvmusic, there's a list of each song in the game. Find these bytes:



And change them to FF FF FF:



These bytes seem to indicate how long a song is, and FF FF FF is the highest possible value, so changing it this way should make it loop correctly. If it still loops too early, then it's possible your song is simply too long for VVVVVV to load.




You should now have a working music file you can add to your VVVVVV folder in Documents! Trigger it in your level with music(15a).




Why doesn't replacing songs other than Predestined Fate Remix work?

Replacing other songs causes glitching: stuff like looping many songs in a row. I suspect this has something to do with the bytes in Step 8, so if someone smarter than me could figure out exactly how length is stored in these three bytes, it could become possible to have multiple custom songs.




If you have any comments or questions, be sure to reply to this thread!

moth ✨

#1
OH MY FREAKING GOD. YES.

Lollipop


azathothsAwakening

Does it work on make and play edition?

Warning - while you were typing a new reply has been posted. You may wish to review your post.

Lollipop

Quote from: 5tr4 on January 17, 2016, 08:09:33 PM
Does it work on make and play edition?

Warning - while you were typing a new reply has been posted. You may wish to review your post.

most likely yes

azathothsAwakening

I have no idea what the instructions mean...  :o

allison

Quote from: 5tr4 on January 17, 2016, 08:09:33 PM
Does it work on make and play edition?
Yes.
Quote from: 5tr4 on January 17, 2016, 08:11:19 PM
I have no idea what the instructions mean...  :o
What specifically don't you understand?

Trinket4067


moth ✨

#8
 When I try copying the data of my song in notepad++, it freezes up. Why?

Ally 🌠

Quote from: ShinyWolf07 on January 17, 2016, 08:41:05 PM

When I try copying the data of my song in notepad++, it freezes up. Why?
its notepad++

Lollipop

#10
Quote from: Luigi master on January 17, 2016, 09:34:47 PM
Quote from: ShinyWolf07 on January 17, 2016, 08:41:05 PM

When I try copying the data of my song in notepad++, it freezes up. Why?
its notepad++

use sublime or something

EDIT: Is there a simpler way to highlight all that?

EDIT: Nvm got it

allison

Quote from: ShinyWolf07 on January 17, 2016, 08:41:05 PM

When I try copying the data of my song in notepad++, it freezes up. Why?
That never happened to me... I recommend using a different hex editor.

Lollipop

#12
Quote from: ShinyWolf07 on January 17, 2016, 08:41:05 PM

When I try copying the data of my song in notepad++, it freezes up. Why?

because there's too much text for notepad++ to handle

EDIT: speaking of which my laptop is so shitty it cant even load the file on sublime or notepad++

moth ✨

#13
Hey I got it working! Thanks for the tutorial. I used HxD.

Trinket4067

It doesn't work. The music just doesn't play! WHYYYYYY?  :victoria: