Kara-Moon Forum

Developers & Technology => Musical MIDI Accompaniment (MMA) => Topic started by: nileshtrivedi on February 12, 2011, 08:47:35 PM



Title: Quick track on command line
Post by: nileshtrivedi on February 12, 2011, 08:47:35 PM
I use this Ruby script to quicky play a short repeating pattern when I am trying out soloing ideas:

Code:
#!/usr/bin/env ruby
groove = ARGV.slice!(0)
tempo = ARGV.slice!(0)
count = ARGV.slice!(0)

puts "Generating MMA file"
File.open("/tmp/mmaout.mma","w") { |f|
  f.puts "Tempo #{tempo}"
  f.puts "Groove #{groove}"
  count.to_i.times {
   ARGV.each { |chord| f.puts chord }
  }
}
puts "Running MMA"
`mma /tmp/mmaout.mma`

puts "Running Timidity"
`timidity /tmp/mmaout.mid`

puts "Done"

You can run the script in the shell something like this:

Code:
mmacmd.rb Rhumba 130 20 G F C C

I hope someone finds this useful.


Title: Re: Quick track on command line
Post by: nileshtrivedi on February 12, 2011, 09:21:46 PM
It would be awesome if MMA supported these kind of quick accompanying tracks out of the box !


Title: Re: Quick track on command line
Post by: bvdp on February 12, 2011, 09:34:27 PM
Yes, cool.

Just some thoughts which might help you do it "out of the box".

1. You know that you can set a repeat count for a bar:

       C * 20

will give 20 bars of a C chord.

2. You can do this with the -V (preview) command. Just set the COUNT option for the number of loops. So, "mma -V Rhumba1 Chords=A,B,C,D Tempo=123  Count=20" should do the same as your example???

3. Instead of repeating the data bars, consider using a Repeat section...

    Repeat
     C
     D
     ...
     Repeatend 20

Would give you 20x of the pattern.

Hope this helps.


Title: Re: Quick track on command line
Post by: bvdp on February 12, 2011, 09:39:04 PM
Forgot to mention that you can get mma to play a file it generates (and delete the file) with the -P option. I use that all the time. See the entry for SetMidiPlayer for details on how to configure the player to timidity.


Title: Re: Quick track on command line
Post by: nileshtrivedi on February 12, 2011, 10:50:50 PM
Thanks. I was using the older version (0.12) that is shipped with Ubuntu 10.10. Now using the latest .deb and the "-V' option works fine.  :)



Title: Re: Quick track on command line
Post by: Oren on February 13, 2011, 06:45:43 PM
Thanks. I was using the older version (0.12) that is shipped with Ubuntu 10.10. Now using the latest .deb and the "-V' option works fine.

Cool!