No subject


Sun Sep 19 15:01:13 UTC 2010


>> > dnew 0 "<port_name>" rw =A0 =A0 =A0 =A0 # register the device number 0
>> > import "file.mid" =A0 =A0 =A0 =A0 =A0 =A0 =A0 # load the .mid file
>> > inew mykbd {0 0} =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0# register input to re=
cord from
>> > onew mypiano {0 0} =A0 =A0 =A0 =A0 =A0 =A0 =A0# register output to rou=
te events to
>> > tnew mytrack =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0# create a track
>> > r =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 # record
>> > s =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 # stop r=
ecording
>> > p =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 # play t=
he result
>> > save "myimpro" =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0# possibly save the =
result & the setup

> for i in [tlist] { =A0 =A0 =A0 =A0 =A0 =A0 =A0# iterate over all tracks
> =A0 =A0 =A0 =A0if ($i !=3D mytrack) { =A0 =A0# if the track is not ``mytr=
ack''
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0ct $i =A0 =A0 =A0 =A0 =A0 # set currect tr=
ack
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0tdel =A0 =A0 =A0 =A0 =A0 =A0# delete the c=
urrent track
> =A0 =A0 =A0 =A0}
> }

So, I figured I'd script it. Came up with:

#!/bin/sh

echo "Infile:"  $1
echo "Outfile:" $2

exec midish -b <<EOF
dnew 0 "20:0" rw               # .midishrc not read (-b), so do it here
m off                          # no metronome
import "$1"                    # get file to play
inew mykbd {0 0}               # register input to record from
onew mypiano {0 0}             # register output to route events to
tnew mytrack                   # create a track

r                              # play imported and record

for i in [tlist] {             # iterate over all tracks
   if ($i !=3D mytrack) {        # if the track is not ``mytrack''
       ct $i                   # set currect track
       tdel                    # delete the current track
   }
}
export "$2"          # save buffer as midi file
EOF

However, it doesn't work :)

First is that the metronome doesn't shut off.

Next is the error after hitting ctrl-c:

bob$ ./smfrw Downloads/bridge.mid my.mid
Infile: Downloads/bridge.mid
Outfile: my.mid
press ^C to stop recording
dkdkd^C
--interrupt--
recording stopped
11.10: expression expected afeter '('

If I take out the loop it works fine. But, of course, the original
data is saved with the input.

I'm probably not understanding the difference between rmidish and midish?

--=20
**** Listen to my CD at http://www.mellowood.ca/music/cedars ****
Bob van der Poel ** Wynndel, British Columbia, CANADA **
EMAIL: bob at mellowood.ca
WWW:=A0=A0 http://www.mellowood.ca


More information about the Linux-audio-user mailing list