Re: [LAU] midi record and play

From: Bob van der Poel <bob@email-addr-hidden>
Date: Mon Jan 03 2011 - 23:12:50 EET

Thanks for the help on this Alexandre. Getting VERY close now!
From a rmidish shell this works perfectly.

>> > dnew 0 "<port_name>" rw         # register the device number 0
>> > import "file.mid"               # load the .mid file
>> > 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                               # record
>> > s                               # stop recording
>> > p                               # play the result
>> > save "myimpro"                  # possibly save the result & the setup

> for i in [tlist] {              # iterate over all tracks
>        if ($i != mytrack) {    # if the track is not ``mytrack''
>                ct $i           # set currect track
>                tdel            # delete the current track
>        }
> }

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 != 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?

-- 
**** Listen to my CD at http://www.mellowood.ca/music/cedars ****
Bob van der Poel ** Wynndel, British Columbia, CANADA **
EMAIL: bob@email-addr-hidden
WWW:   http://www.mellowood.ca
_______________________________________________
Linux-audio-user mailing list
Linux-audio-user@email-addr-hidden
http://lists.linuxaudio.org/listinfo/linux-audio-user
Received on Mon, 3 Jan 2011 14:12:50 -0700

This archive was generated by hypermail 2.1.8 : Tue Jan 04 2011 - 00:15:02 EET