/usr/share/doc/gbsplay/contrib/gbs2ogg.sh is in gbsplay 0.0.93-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 | #!/bin/sh
#
# Automatically convert all subsongs from .gbs file to .ogg files.
#
# 2003-2005,2008 (C) by Christian Garbs <mitch@cgarbs.de>
#
# Licensed under GNU GPL
#
FILENAME=$1
RATE=44100
PLAY=150
FADE=6
GAP=0
if [ -z "$1" ]; then
echo "usage: gbs2ogg.sh <gbs-file> [subsong_seconds]"
exit 1
fi
if [ "$2" ]; then
PLAY=$2
fi
FILEBASE=`basename "$FILENAME"`
FILEBASE=`echo "$FILEBASE"|sed 's/.gbs$//'`
# get subsong count
# get song info
gbsinfo "$FILENAME" | cut -c 17- | sed -e 's/^"//' -e 's/"$//' | (
read GBSVERSION
read TITLE
read AUTHOR
read COPYRIGHT
read LOAD_ADDR
read INIT_ADDR
read PLAY_ADDR
read STACK_PTR
read FILE_SIZE
read ROM_SIZE
read SUBSONGS
for SUBSONG in `seq 1 $SUBSONGS`; do
printf "== converting song %02d/%02d:\n" $SUBSONG $SUBSONGS
gbsplay -o stdout -E l -r $RATE -g $GAP -f $FADE -t $PLAY "$FILENAME" $SUBSONG $SUBSONG \
| oggenc -q6 -r --raw-endianness 0 -B 16 -C 2 -R $RATE -N $SUBSONG -t "$TITLE" -a "$AUTHOR" -c "copyright=$COPYRIGHT" -c "COMMENT=Subsong $SUBSONG" -G "Gameboy music" - \
> "`printf "%s-%02d.ogg" "$FILEBASE" $SUBSONG`"
done
)
|