# Atari YM preprocessed soundfiles # (these are normally packed by lha, so this only works if unpacked) 0 string YM YM atari chipmusic # C64 soundchip music files 0 string PSID SID commodore 64 chipmusic
#!/bin/bash # this script needs lha, /usr/local/bin/stsoundc and xterm # Gunstick / Unlimited Matricks 11/1999 12/2000 01/2001 # this now also handles mod and zipped-mod if it is delivered as # plain text by the webserver # and plain text is displayed back into the browser (sometimes not # working really well) logger ymplay $* if [ "$1" = "" ] then echo "usage: $0 file" echo "uncompresses ym file and gives it to stsoundc" exit 1 fi YMFILE=$1 if tty -s then if [ "$(file "$YMFILE"|grep -i lha)" = "" ] then if [ "$(file "$YMFILE"|grep -i zip)" != "" ] then # seems to be a zip file embedded? # I only know modfiles for this silly way :-) gunzip < $YMFILE > /tmp/ym$$ else cat "$YMFILE" > /tmp/ym$$ fi else lha -pq "$YMFILE" > /tmp/ym$$ fi if [ "$(file "/tmp/ym$$"|grep YM)" != "" ] then # this needs '0 string YM YM atari chipmusic' in /usr/share/misc/magic /usr/local/bin/stsoundc /tmp/ym$$ >/dev/null & p=$! trap "rm /tmp/ym$$;kill $p;exit" 1 2 3 echo -n "Playing $YMFILE" read a exec 2>/dev/null kill $p else if [ "$(file "/tmp/ym$$"|grep "module sound data")" != "" ] then /usr/bin/xmp /tmp/ym$$ >/dev/null & p=$! trap "rm /tmp/ym$$;kill $p;exit" 1 2 3 echo -n "Playing $YMFILE" read a exec 2>/dev/null kill $p else read a & p=$! trap "sleep 10;rm /tmp/ym$$;kill $p;exit" 1 2 3 echo -n "Playing $YMFILE" exec 2>/dev/null if [ -s /tmp/ym$$ ] then netscape -remote "openFile(/tmp/ym$$)" fi kill $p fi fi rm /tmp/ym$$ else xterm -geom 120x1 -font 5x7 -iconic -title $(basename "$1") -e "$0" "$1" fi
audio/stsound: snd,psg,ym: Atari YM audio files text/plain: snd,psg,ym: Atari YM audio files : /usr/local/bin/ymplay.sh $file </dev/null # the text/plain line is needed as some websevers send YM as text/plain # and pluggeruses this. it's not clean and breakes asci text viewing # of the browser, so the script views text itself.
Why is that xterm thingie? Well on my system, stsoundc makes a crash if it is run as a plugin but works fine in a xterm, well so I create a tiny little xterm, et voila...
Of course this also works on the command line, so you do no more need to uncompress and then play the files but can run them straigth away!