Kara-Moon Forum

Developers & Technology => Musical MIDI Accompaniment (MMA) => Topic started by: sjzabel on August 24, 2014, 09:49:56 PM



Title: Parse Tree
Post by: sjzabel on August 24, 2014, 09:49:56 PM
This is more of a general how would you approach this...

In iPython I wanted to get to the point of introspecting in on the list and dicts that you have created after the parsing of the syntax but before the midi generation. I was just about to start diving through the code in the mma executable :) but figured I would just ask since my son is waking up from his nap and I won't be able to look until later :)

Cheers,
Stephen


Title: Re: Parse Tree
Post by: bvdp on August 24, 2014, 11:49:39 PM
Okay, this is off the top of my head ... but the idea is that:

1. We have a dict of midi events for each track. This is called miditrk and is part of the gbl.mtrks{} class

2. We use the offset for the name of the keys.

3. Each key  in miditrk has a number of lists []. The list is the actual midi data.

The data is put in the track in the order it's encountered.

Is this muddy business clear enough? Have a look at writeout() in midi.py for a good example of how to parse this mess.


Title: Re: Parse Tree
Post by: sjzabel on August 26, 2014, 02:08:03 AM
Cool, thank you for the pointers :) its not often that I get a project maintainer that is as responsive.

I'll let you know as I get a chance to dig in.

Cheers,
Stephen


Title: Re: Parse Tree
Post by: bvdp on August 26, 2014, 04:18:58 PM
Before you dig too much ... share with us what you're trying to accomplish. It might already be there :)


Title: Re: Parse Tree
Post by: sjzabel on September 08, 2014, 03:12:22 AM
Cool,
One thing that I'm interested in is how you define a tuning and chords? For instance I'm working with an open G tuning (GBDGDB) and all major cords are just barred straight across.

I also have some pieces that I want to do using an eight strings (but in reality would like to be able to program n strings)

So, is there a syntax for defining chord voicings for different tunings?  (I'll go back and double check the documentation again)

Cheers,
Stephen


Title: Re: Parse Tree
Post by: bvdp on September 08, 2014, 04:52:39 PM
Yeah, it's covered in the manual in excruciating detail :) But, simply you want a command like:

   Plectrum Tuning e- a- d g b e+

The number of notes/pitches in the tuning option also sets the number of strings in the instrument. Duplicates are silently ignored.