Working around the Cave Story+ “Soundtrack”

TL;DR: Here’s a bash script to build soundtrack files from the resources for the “remastered” music option is.

So I’m feeling like listening to the Cave Story+ remastered version of the title page tune that better fits the SNES-era ambiance of the game’s original visuals. No problem. The Humble Bundle gave me the soundtrack… but it doesn’t contain that version.

…it contains the version from the much maligned DS soundtrack (plantation.ogg) and some weird remix of the original NES-like version (intro menu.ogg) which uses the same instruments but with a different beat. I’m no expert but, judging by the way I hate it, I think it’s jazz.

Ugh. If I wanted to listen to a cover, I’d listen to Brentalfloss’s version with lyrics. Time to use what came in the game… OK, each track is two Ogg Vorbis files (a lead-in clip and a loop clip). I can work with this.

I whip out a lossless Ogg Vorbis concatenation tool and it works… but the abrupt end isn’t nice. Long story short, here’s a little script which uses oggCat and sox to produce a soundtrack-like output file with everything except the ending fade-out being a lossless repackaging of existing compressed data.

It does give a couple of warnings on the console, but they seem to be harmless and I think that’s just because oggCat contains code that expects correct frame timestamps.

#!/bin/sh
# Tool for generating acceptable soundtrack Oggs from Cave Story+ data files
#
# Usage:
# 1. Save this and chmod it executable
# 2. cd into CaveStory+/data/base/Ogg11
# 3. Run something like "~/cavestoryplus_dump.sh curly"
# 4. Enjoy your music
#
# Dependencies:
# - SoX
# - oggvideotools

if [ "$#" = 0 ]; then
    echo "Usage: $0 <track name> [...]"
    echo 'Note: The track name is the portion before the "_intro" or "_loop"'
    exit
fi

for X in "$@"; do
    sox "${X}_loop.ogg" -C 5 "${X}_fade.ogg" fade h 0 6 6
    oggCat "${X}.ogg" "${X}_intro.ogg" "${X}_loop.ogg" "${X}_fade.ogg"
    rm "${X}_fade.ogg"
done

GiHub Gist

CC BY-SA 4.0 Working around the Cave Story+ “Soundtrack” by Stephan Sokolow is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License.

This entry was posted in Geek Stuff. Bookmark the permalink.

One Response to Working around the Cave Story+ “Soundtrack”

  1. Pingback: Extracting The Soundtrack From Your Copy of Desktop Dungeons | Stephan Sokolow's Blog

Leave a Reply

Your email address will not be published. Required fields are marked *

By submitting a comment here you grant this site a perpetual license to reproduce your words and name/web site in attribution under the same terms as the associated post.       Also, please be aware that non-constructive comments will have their URL field erased before being approved in order to combat SEO spam.