#   ----------------------------------------------------------------------
#	CS2MTX.SH
#   ----------------------------------------------------------------------
#
#   Mscore release 1.1
#
#   Description:
#
#   Example script for converting a Csound score into an Mscore score
#   which may then be converted into a MIDI file with mscore.awk.
#
#
#	Run cs2mtx.awk
#
#	Usage:		sh cs2mtx.sh
#
#	"drums" list all instruments to be aliased as ch10
#	"tracks" is not the number of tracks, but lists the channel numbers
#		for each track
#
if [ -e "newsong.mtx" ]; then

	cp newsong.mtx newsong_bak.mtx

fi


#
#	sort the Csound score
#
cat song3.sco | awk -f ../mscore/cs2sort.awk > tmpsort.txt

#
#	convert the Csound score into an MTX score
#
cat tmpsort.txt | awk -f ../mscore/cs2mtx.awk  bpm=120\
	 drums=50,51,52,53,54,55,56,57 tracks=1,10,2 nshift=12,0,12\
	 alias2=30,31,32,33,34,35,36,37,38,39,40,41,42\
	| awk -f ../mscore/malign.awk > body.mtx

#
#	create an MTX header
#
echo "junk" | awk -f ../mscore/mtxheader.awk tracks=1,10,2 programs=34,-1,0\
		volumes=80,60,80 bpm=120 ticks=220 name=SONG3  >  header.mtx


#
#	combine header with body
#
cat header.mtx body.mtx > newsong.mtx


