[Linux] A script to convert DoomRL music from mp3 to ogg vorbis

Started by Cyber Killer, February 28, 2012, 10:16

Cyber Killer

There is a small problem with the HQ Linux version of DoomRL on some distros that do not support mp3 in SDL (notably Fedora and OpenSUSE). I've written a small script to take care of that problem...

Download DoomRL HQ, put this file in the same directory and run. This script doesn't delete anything, so in case you don't like it you can quite easily reverse what it does.

Requires bash, sed, find and ffmpeg with mp3 decoding and libvorbis encoding. Tested on OpenSUSE.

Note: Kornel told me he plans on switching to vorbis music in the next releases, but for now this is the easiest and fastest thing to do. The transcoding doesn't lower the music quality too much.

AStranger

Heh,  beat you to the punch: http://forum.chaosforge.org/index.php/topic,5248.msg42539/topicseen.html#msg42539. Mine requires sox and not ffmpeg and auto downloads, but basically the same idea.
[24|23|20|18|13] v.0.9.9.3
[17|10|8|5|2] v.0.9.9.2
[15|11|10|6|3] v.0.9.9.1
[18|17|14|10|6] v.0.9.9

Kornel Kisielewicz

A version which would download Simon-v's native ogg versions instead of converting them from mp3's would be way cooler :>
at your service,
Kornel Kisielewicz

AStranger

Okay, this one works with 0.9.9.6, it just creates an ogg directory and converts all the mp3s that comes with DoomRL. I'll probably start working on one that actually downloads the quality oggs instead of converting, but I need some coffee first.
Spoiler
#!/bin/bash

cp musichq.lua musicogg.lua

mkdir ogg

for ANMP3 in $(grep "= \"" musicogg.lua | sed -e 's/.*= \"//' -e 's/\",.*//' | awk '!x[$0]++')
do
    echo "Converting: $ANMP3"
    OGGNAME=$(echo $ANMP3 | sed 's/mp3/ogg/g')
    sox "$ANMP3" -t vorbis "$OGGNAME"
done

sed -i 's/mp3/ogg/g' musicogg.lua
sed -i 's/dofile \"music.*lua\"/dofile \"musicogg.lua\"/' config.lua
[24|23|20|18|13] v.0.9.9.3
[17|10|8|5|2] v.0.9.9.2
[15|11|10|6|3] v.0.9.9.1
[18|17|14|10|6] v.0.9.9

AStranger

Quote from: Kornel Kisielewicz on February 28, 2012, 14:16A version which would download Simon-v's native ogg versions instead of converting them from mp3's would be way cooler :>
Done and as an added bonus, I actually tested it first.
Spoiler
#!/bin/bash
cp musichq.lua musicogg.lua

SIMONSITE="http://dl.dropbox.com/u/23785083/Doom_the_Roguelike_The_Album/OGG/"

SIMONV="doom_the_roguelike.ogg final_showdown.ogg hells_weapons.ogg of_skull_and_bone.ogg something_wicked.ogg the_brick_song.ogg too_hot_down_here.ogg unholy_cathedral.ogg"

MP3S=$(grep "= \"" musicogg.lua | sed -e 's/.*= \"mp3\///' -e 's/\",.*//' | awk '!x[$0]++')

CONVERTS=$(echo "$MP3S" | awk "!/$(echo $SIMONV | sed -e 's/ /|/g' -e 's/ogg/mp3/g')/")

mkdir ogg

for ANMP3 in $CONVERTS
do
    echo "Converting: $ANMP3"
    OGGNAME=$(echo $ANMP3 | sed 's/mp3/ogg/g')
    sox "mp3/$ANMP3" -t vorbis "ogg/$OGGNAME" --show-progress
done

for ANOGG in $SIMONV
do
    QUICKFIX=$(echo "$ANOGG" | sed 's/doom_the_roguelike.ogg/doom_the_roguelike_theme.ogg/')
    echo "Downloading: $QUICKFIX"
    wget "$SIMONSITE$QUICKFIX" -O ogg/$ANOGG
done

sed -i 's/mp3/ogg/g' musicogg.lua
sed -i 's/dofile \"music.*lua\"/dofile \"musicogg.lua\"/' config.lua
[24|23|20|18|13] v.0.9.9.3
[17|10|8|5|2] v.0.9.9.2
[15|11|10|6|3] v.0.9.9.1
[18|17|14|10|6] v.0.9.9

Cyber Killer

I didn't know that there was another script for this, anyway mine was intended as a hack to get going, not a final solution.

Ah well, I just hope that these scripts won't be needed at all for the next release ;-).

AStranger

Quote from: Cyber Killer on February 28, 2012, 22:02I didn't know that there was another script for this...
Well in your defense, it's not like I made it easy to find. I just tacked it on a bug report instead of telling people it was there.
[24|23|20|18|13] v.0.9.9.3
[17|10|8|5|2] v.0.9.9.2
[15|11|10|6|3] v.0.9.9.1
[18|17|14|10|6] v.0.9.9

thelaptop

I computed, therefore I was.