René Nyffenegger's collection of things on the web
René Nyffenegger on Oracle - Most wanted - Feedback
 

Batch convert dx7 patches

On www.parnasse.com/dx72csnd.shtml is a a zip file (dx72csrc.zip) that contains 329 (!) DX7 banks as well as a C programm to convert them into sco files.
The programm converts each bank into 32 .sco files.
Those .sco must have an according .orc file to produce a wav file. The orc file to be used can be found as a part of the name in the .sco file.
The following simple shell script automates the task and produces wav files. Note, cs is another shell script that converts .orc and .sco files into wav files).
It is assumed that the programm is compiled into a programm name a.out and that a.out resides in a directory one level higher than the directories in which the banks are stored. Also, this directory must contain the NEWDX7nn.ORC files. Lastly, it is assumed there is a sibling directory called tst which is going to store the wav files.
for dx in *.DX7; do
  dx_bank=$(basename $dx .DX7)

  ../a.out $dx

  for patch in patch*; do
    alg=$(echo ${patch:10:2})
    pno=$(echo ${patch:5:2})

    mv $patch ../tst/${dx_bank}_$pno.sco
    cp ../NEWDX7${alg}.ORC ../tst/${dx_bank}_$pno.orc
    (cd ../tst; cs ${dx_bank}_$pno)
  done
done