First, create a .mime.types file in your home directory containing
audio/x-abc abcThen, create a .mailcap file in your home directory containing
audio/x-abc; mimeabc %sFinally, create a little shell script mimeabc in your bin directory
#!/bin/sh
# Bourne shell script which translates files in Chris Walshaw's ABC format
# to visible (printable) and audible forms. This could be made much
# more cool if it were a Tcl/Tk script which gave pushbutton control
# over the viewing and playing of the music.
########################################################################
# various and sundry extra inputs for TeX, mostly for music
ABCHOME=$HOME/abc
TEXINPUTS=.:$ABCHOME/abc2mtex:$ABCHOME/musictex/macros:
export TEXINPUTS
TEXFONTS=.:$ABCHOME/musictex/tfm:
export TEXFONTS
TEXPKS=.:$ABCHOME/musictex/300pk:
export TEXPKS
XDVIFONTS=$TEXPKS
export XDVIFONTS
########################################################################
for file in $*; do
################
# construct the sound
nfile=`echo $file | sed s/abc/au/`
# sed steps around a bug in playabc 1.0 on Linux
gawk '
/^P:/ {
# trim out all the TeX garbage found in P fields
gsub("Ch" , "A" );
gsub("/2" , "" );
gsub("\\infty" , "" );
gsub("[}$. ^{]", "" );
}
{ print }
END { print "" } # add a blank line at the end (for flex)
' < $file | playabc | tune > $nfile
################
# construct the picture
abc2mtex m $file
tex music.tex
# alternatively, could proceed on to PostScript and use Ghostview
xdvi music.dvi &
/bin/rm abc2mtex.log
/bin/rm music.tex music.log
sleep 3
################
# play the sound
showaudio $nfile
# clean up
/bin/rm $nfile
/bin/rm music.dvi
################
done
########################################################################
This assumes that Don Ward's playabc and tune
programs are built and in the default
search path.
You'll have to restart Mosaic before this takes effect.
Back to the Seabright home page.