Kara-Moon Forum

Developers & Technology => Musical MIDI Accompaniment (MMA) => Topic started by: alexis on July 20, 2011, 02:24:40 PM



Title: Configuring aplaymidi
Post by: alexis on July 20, 2011, 02:24:40 PM
Hi again,

I'm trying to get MMA play a midi file, for example to get the preview of a groove:

Code:
mma -V Waltz


But it doesn't play and I get this message :

Code:
Creating new midi file (4 bars, 0.10 min): 'MMAtmp6024.mid'
Playing MIDI 'MMAtmp6024.mid' with aplaymidi.
[b]Please specify at least one port with --port.[/b]
Play complete (0.00 min), file has been deleted.

You have to specify a port to aplaymidi.
You get the port list like this :
Code:
 aplaymidi -l

This command returns :
Code:
 Port    Client name                      Port name
 14:0    Midi Through                     Midi Through Port-0
128:0    TiMidity                         TiMidity port 0
128:1    TiMidity                         TiMidity port 1
128:2    TiMidity                         TiMidity port 2
128:3    TiMidity                         TiMidity port 3

So you must tell MMA to include the port number in the command line passed to aplaymidi.

For this, I've created a mmarc file in my current dir:
Code:
SetMIDIplayer aplaymidi --port=128:0

But when trying to play a mma file, I have this message:
Code:
ERROR:<Line 1><File:mmarc>
     SetMidiPlayer: unknown option '--PORT'.

So my question is: how can I specify this timidity port without hacking MMA?

I'm using MMA stable version (1.7) with Ubuntu Natty 64 bits, and Timidity running against Pulse Audio.

Thanks!

Greeting from France,

Alexis


Title: Re: Configuring aplaymidi
Post by: bvdp on July 20, 2011, 04:34:13 PM
Good one ... you forced me to scratch my head on this one.

Here's the problem: when you call SetMidiPlayer it presumes that xx=xx is a command pair for its command. This means that you cannot have a command like --port=something. I think I'll need to look at this and see if i can figure an alternate.

However, in the meantime, use -p.

So, you can have a line

    SetmidiPlayer aplaymidi -p20:0

and it'll work.

Suggestions on the '=' issue are welcome!

Best,


Title: Re: Configuring aplaymidi
Post by: alexis on July 20, 2011, 05:19:02 PM
Again, thanks for your help. It works now :;  :)

I could have figured out this parameter simplified syntax alone! :-[

BTW, looking at MMA manual, I have a question about RC files.
I read in page 199:
Quote
\˜{}/.mmarc —this is an “invisible” file in the users home directory.

What does the "\˜{}/. " mean? Is it kind of regular expression?
For hidden file in user directory, I would simply have written:
Code:
~/.mmarc

Thanks

Alexis


Title: Re: Configuring aplaymidi
Post by: bvdp on July 20, 2011, 09:22:56 PM
That's called a misprint :)

I needed the {} and \ at one point to keep latex happy. Then, later, I wrapped it in another latex function which didn't need it.

Anyway, thanks for pointing it out. Fixed in the next version.

Best,


Title: Re: Configuring aplaymidi
Post by: bvdp on August 12, 2011, 04:56:58 PM
I've just had a look at the problem with passing args to the midi player. This is a simple fix which works:

In line 58 of player.py change:

  if '=' in l:

to

 if '=' in l and l[0].isalpha():

This limits the mma variable checks to things starting with a..z (which I can control). Things like "--port=foo" or "/windowoption=123" will now be be passed to the command, not assumed to be a mma setting.

This will be part of the next developer edition.


Title: Re: Configuring aplaymidi
Post by: alexis on August 16, 2011, 10:14:21 AM
I've just had a look at the problem with passing args to the midi player. This is a simple fix which works:

In line 58 of player.py change:

  if '=' in l:

to

 if '=' in l and l[0].isalpha():

This limits the mma variable checks to things starting with a..z (which I can control). Things like "--port=foo" or "/windowoption=123" will now be be passed to the command, not assumed to be a mma setting.

This will be part of the next developer edition.


Thanks for this fix, Bob.

Alexis