Kara-Moon Forum

Developers & Technology => Musical MIDI Accompaniment (MMA) => Topic started by: infojunkie on February 20, 2022, 10:37:35 PM



Title: MusicXML to MMA
Post by: infojunkie on February 20, 2022, 10:37:35 PM
I'm working on a MusicXML to MMA converter (https://github.com/infojunkie/musicxml-mma), based on a prior iReal Pro to Music XML converter (https://github.com/infojunkie/ireal-musicxml).

One of the difficulties is mapping iReal Pro grooves to MMA grooves. In the event that no mapping is found, I would like to generate a "default" groove that just plays the specified chords at their specified position. Is there a groove to do that?

Thanks!


Title: Re: MusicXML to MMA
Post by: bvdp on February 20, 2022, 10:54:37 PM
No, but it should not be hard to create one. For example, you might have a file "xml-default-44" with a minimum content:

Code:
SeqClear         /// not needed, but for safety do this
Time 4            /// this is really needed
Timesig  4 4    /// optional, but will not harm things
Seqsize 4       /// optional, but should be here

Include stdpats    /// note that this assumes 4/4 time

Begin Chord
     Voice Piano
     Octave 5
     Articulate 80
     Sequence  C1234  /  C234   C1234
     Volume m
 End

[\code]

This should get go a working file. Not a very good sounding file ... but it will work! Of course, you could do it a few other ways:

    - just pick something fairly "plain" from stdlib
    - copy one of the files, strip out things, and rename to "default"

Shout if you need help. Looking forward to seeing a working program.

Does iReal Pro have their library file included or is it just the music/chord file?
   
 Setting something up for the "xml-default-34" is left as an exercise for the reader :)


Title: Re: MusicXML to MMA
Post by: infojunkie on February 20, 2022, 11:48:55 PM
Thanks, this works, but yes, it's a bit too intrusive for someone trying to play along, and does not follow the chord durations indicated in the chart (since it replaces them with quarter notes throughout). Plus I would need to replicate this for every time signature if I understand correctly.

Maybe I can generate a Sequence for each measure, based on the MusicXML harmony information, the same way that the generated chords correspond to the MusicXML harmony information.


Title: Re: MusicXML to MMA
Post by: bvdp on February 21, 2022, 02:29:28 AM
You might be over complicating things :)

I don't know what kind of music you are trying to convert, etc. But, trying to match the output of an existing file (midi?, audio?) and trying to convert that to a file that MMA (or, most likely any other program) will create a matching file for ... well, it's probably not going to happen.

What I would do is to first separate the rhythm and the melody of the song. In most cases (again, I don't know what kinds of music you are playing with) the rhythm can be represented by chords, bass and drums. In most cases a listener will not immediately recognize the "tune" this is associated with. Yes, there are some songs in which a chord sequence is very recognizable .. but, that is not the point of the exercise.

If I were writing your program (and I know that I am not!!) I would attempt to separate out the chords and the melody. I don't think you need to worry about the rhythm of the chords, etc. Just have the program spit out the names of the chords on bar-to-bar basis and, if they change mid-bar, that info as well. So you end up with a chord list in the format:

      1    C  Dm@2.5
      2    F@3.22
      .....

Since MMA can handle midi melody files, you might at this time, just extract the melody (including the harmony notes) into a midi file and then use MMA's MidiInc function to apply that to the file. Now, you will need to select the library file to use for the song. No, it's not all going to be automatic ... but, it should sound pretty good :)

Am I on a different page completely that what you are trying to do?


Title: Re: MusicXML to MMA
Post by: bvdp on February 21, 2022, 02:35:12 AM
BTW, is Ireal Pro the same as Band in a Box or a successor to it?


Title: Re: MusicXML to MMA
Post by: infojunkie on February 21, 2022, 05:09:02 AM
> BTW, is Ireal Pro the same as Band in a Box or a successor to it?

Yes, iReal Pro is a successor to Band in a Box. It's an extremely popular mobile app that many musicians use in gigs as a reference (like an electronic Real Book), and learners use it as well to provide backing tracks.

> If I were writing your program (and I know that I am not!!) I would attempt to separate out the chords and the melody. I don't think you need to worry about the rhythm of the chords, etc. Just have the program spit out the names of the chords on bar-to-bar basis and, if they change mid-bar, that info as well. So you end up with a chord list in the format:

Yes, that's what I am doing.

But I also want to map the iReal Pro grooves to MMA grooves. And that's where my question comes in: what accompaniment should my program provide if the groove mapper finds nothing (and until it is actually implemented) ? I want to provide the most neutral backing, which consists of just playing back each chord at its original onset and for its original duration, as specified by the leadsheet.

Hope this clarifies my approach.


Title: Re: MusicXML to MMA
Post by: sciurius on February 21, 2022, 07:19:38 AM
BTW, is Ireal Pro the same as Band in a Box or a successor to it?

No, it is a totally different beast. Main difference is that BiaB handles melodies and (improvised) solos. As for the chords and accompaniment irealPro looks a bit similar to the corresponding BiaB functionality. But iRealPro is not a band in a box even though it can be very helpful for studying and even performing.


Title: Re: MusicXML to MMA
Post by: sciurius on February 21, 2022, 07:23:05 AM
... I would like to generate a "default" groove that just plays the specified chords at their specified position. Is there a groove to do that?

I've written backends to some of my tools to generate MMA. My iRealPro toolkit (https://github.com/sciurius/perl-Data-iRealPro) has a MMA
backend, and so has ChordPro (https://github.com/ChordPro/chordpro).

I use a specially prepared style 'Neutral' that is useful to give you an impression in how it is going to sound, but tries not to get in the way. I think I posted it somewhere around here, if not, see attachments.


Title: Re: MusicXML to MMA
Post by: infojunkie on February 21, 2022, 07:59:38 AM
> I've written backends to some of my tools to generate MMA. My iRealPro toolkit (https://github.com/sciurius/perl-Data-iRealPro) has a MMA backend [..]

Fantastic stuff! Looks like we're working on very similar projects. Thanks for sharing your solutions.

For the "neutral" accompaniment, I've opted for a faithful rendition of the harmony in the MusicXML, using per-measure sequences. The output ends up looking like this:

Code:
[...]
Chord Sequence { 1 768t 50; }
10 G@1

Chord Sequence { 1 768t 50; }
11 Cmaj9@1

Chord Sequence { 1 384t 50; 3 384t 50; }
12 Eaug@1 E7@3
[...]

The above is machine-generated and not meant for human reading, so I'm not too concerned with readability.

Regarding the style mapping, I see that perl-Data-iRealPro does not currently tackle this issue either: https://github.com/sciurius/perl-Data-iRealPro/blob/0c30d3c72f1a28567dba2c20d682878d1405fd7c/lib/Data/iRealPro/Output/MMA.pm#L794-L798. If it helps, I've copied the grooves offered by iReal Pro: https://github.com/infojunkie/ireal-musicxml/blob/main/doc/ireal.md#grooves-for-playback. Maybe someone more knowledgeable can offer a tentative mapping of those to a close equivalent in MMA.

Thanks, and looking forward to collaborate further.


Title: Re: MusicXML to MMA
Post by: bvdp on February 21, 2022, 04:24:17 PM
Looks like you 2 are well into iReal Pro issues ... something beyond my scope. Great!!

One other thing I can add though, is that I played at one point with adding a yamaha set of default groove names to lib files. Alas, this was not taken very far ... but "son.mma" does have the idea. At the bottom of the file we have:

Code:
//  Standard alias definitions

Begin DefAlias
   Son Main-A
   Son Main-B
   Son Main-C
   Son Main-D
   Son Fill-AA
   Son Fill-BB
   Son Fill-CC
   Son Fill-DD
 
   SonSus Main-Asus
   SonSus Main-BSus
   SonSus Main-CSus
   SonSus Main-DSus

   SonIntro Intro-A
   SonIntro Intro-B
   SonIntro Intro-C
   SonIntro Intro-D

   SonEnd  Ending-A
   SonEnd  Ending-B
   SonEnd  Ending-C
   SonEnd  Ending-D
End

I had a dream about putting something like this at the bottom of all the stdlib files but never got around to it. With a scheme like this one could just use Main-A, Intro-A, etc. in the file can just put an "include" at top of the file. But, since I didn't use the yamaha grooves, and I found it easier to use the right grooves in my files the project did not take wings :) Sciurius' default file might be the best compromise.

Best.


Title: Re: MusicXML to MMA
Post by: sciurius on February 23, 2022, 09:19:45 AM
I frequently use DefAlias, for this purpose, but also to shorten the groove names  ;D

E.g.

Groove JazzBallad4
DefAlias JazzBallad4A GVI
DefAlias JazzBallad4A GVA
DefAlias JazzBallad4B GVB

This way I don't need to adjust all song grooves when I change to another groove set.


Title: Re: MusicXML to MMA
Post by: bvdp on February 23, 2022, 03:55:41 PM
I frequently use DefAlias, for this purpose, but also to shorten the groove names  ;D

E.g.

Groove JazzBallad4
DefAlias JazzBallad4A GVI
DefAlias JazzBallad4A GVA
DefAlias JazzBallad4B GVB

This way I don't need to adjust all song grooves when I change to another groove set.

Yes, that is the idea. The reason I was using "MAIN-A", etc was due to the naming used by Yamaha.

For my personal projects I spell out the names in full so that future readers (yeah, right!) will be able to see what's going on :)



Title: Re: MusicXML to MMA
Post by: infojunkie on March 02, 2022, 04:28:42 AM
Thought I'd update you all on the progress of my MusicXML to MMA converter: For a score that looks like this https://musescore.com/infojunkie/salma-ya-salama (https://musescore.com/infojunkie/salma-ya-salama), I can now generate the attached accompaniment. That's what I meant by "neutral accompaniment".

Cheers!


Title: Re: MusicXML to MMA
Post by: sciurius on March 02, 2022, 07:27:45 AM
Interesting...


Title: Re: MusicXML to MMA
Post by: bvdp on March 02, 2022, 04:00:50 PM
Using a neutral setting for this is the way to go. It's simple now, for the user, to change to a more complex pattern.

The only problem is that if I were to want to change this to a groove using not chord patterns but plectrum I would need to change all the "Chord Sequence" lines.

I'm really glad to see your progress on this. Please keep us informed and shout if you need help.

Thanks.


Title: Re: MusicXML to MMA
Post by: infojunkie on April 03, 2022, 09:51:31 PM
Happy to announce a major update of my iRealPro => MusicXML => MIDI demo: https://blog.karimratib.me/demos/musicxml/. It features:
- iReal Pro to MusicXML conversion
- MusicXML to MMA (and thus MIDI) conversion via an HTTP endpoint served by https://github.com/infojunkie/musicxml-mma
- Web Audio playback of MIDI file with score synchronization
- Web MIDI support to other MIDI synths

Enjoy! Feedback welcome.


Title: Re: MusicXML to MMA
Post by: bvdp on April 03, 2022, 10:41:29 PM
This is great! And I'm sure the MMA community will get lots of use out of your efforts!

On behalf of the community: Thank you for your work and for sharing!

Bob.