[LAU] Command-line midi player with fast forward, pause, rewind?

Alexandre Ratchov alex at caoua.org
Mon Sep 7 06:59:07 EDT 2009


On Mon, Sep 07, 2009 at 01:57:57AM -0700, Ken Restivo wrote:
> On Fri, Aug 28, 2009 at 03:11:52PM +0200, Alexandre Ratchov wrote:
> > On Thu, Aug 27, 2009 at 11:06:51PM -0700, Ken Restivo wrote:
> > > I'd love to find a command-line MIDI file player that will
> > > use ALSA MIDI (not its own internal synth), and also will
> > > accept arrow keys or some other key commands on stdin to
> > > fastforward, rewind, pause, play, etc.
> > > 
> > 
> > recent midish versions can almost do that, but not with the
> > arrow keys, unfortunately.  It's controlled from stdin,
> > supports start/stop and relocate (for rewind/fastforward).
> > 
> > ex:
> > 
> > 	dnew 0 "28:0" wo	# use 28:0 port for output
> > 	import "myfile.mid"	# import file to play
> > 	p			# play
> > 	s			# stop
> > 	g 17			# go to measure #17
> > 
> > when you change the position, it restores the states of all 
> > controllers and handles the note-off events of skipped
> > notes.
> > 
> 
> Thanks, I've build the latest version, and used it a bit
> so far, and I like it a lot, it does indeed do pretty much
> what I want.
> 
> It looks like it could also do a lot of useful stuff, but
> I find it bewildering and the documentation not quite
> complete.
> 

You mean the ``manual.html'' file ?

> A few questions, if I may?
> 
> 1) How do you get it to pause? Not stop, which is "s", and
> then it resets the position back to zero, but just
> momentarily pause and keep the position at wherever it is
> at?
> 

there's no pause function yet; i guess because nobody needed
this until now.

AFAICS the code to pause would be the same as the code to
stop, except that it must not restore the initial position.

> 2) How can I route output to a different channel when I'm
> *playing* a MIDI file? I found documentation on how to
> route and filter when recording, but I need to do the
> filtering/routing at playback time.
> 

there are two options:

 - edit the file to change the channel of the events;
   possibly you can save the file, or apply the change
   to only a portion of the file. Ex.

	ct mytrack			# set current track
	g 17				# go to measure #17
	sel 16				# select 16 measures
	tevmap {any piano} {any organ}	# map piano->organ

   assuming ``piano'' and ``organ'' are channel names registered
   with ``onew'' function (you can use dev/chan numbers instead,
   though; ex ``{0 1}'' instead of ``piano'')

 - use two midish processes, one to play the file
   and one to handle the routing only, handly to experiment
   in realtime or to use other midi software.

> 3) Is there any rudimentary editing capability? i.e., cut
> the file keeping only events from range X-Y and J-K?
> 

yes, example:

	ct mytrack		# select track ``mytrack''
	g 17			# goto measure #17
	sel 16			# select 16 measures
	ev {note {} 60..72}	# select notes 60..72
	tclr			# delete them

the following functions might be useful for editting, you
could look at their description in the manual: g, sel, setq,
ev, tcopy, tpaste, tclr, tcut, tins, tquant, ttransp,
tevmap, tren, mcut, mins, mdup, mend, t, ls.

-- Alexandre



More information about the Linux-audio-user mailing list