[LAU] midi record and play

Alexandre Ratchov alex at caoua.org
Mon Jan 3 22:36:34 UTC 2011


On Mon, Jan 03, 2011 at 02:12:50PM -0700, Bob van der Poel wrote:
> 
> 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''
     	^^^^
/bin/sh will replace ``$i'' with it's own value (an empty string), you
have to quote (prefix with ``\'') all ``$'' characters when using
the ``<<'' shell construct

>        ct $i                   # set currect track
	    ^^
	    same here

>        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.

the ``import'' command creates a new project so it resets all saved
settings, including the metronome state. Moving ``m off'' after the
``import'' statement should disable it.

-- Alexandre


More information about the Linux-audio-user mailing list