grame-cncm / guidolib

Guido project - music score layout engine - music description language
http://guido.grame.fr
Mozilla Public License 2.0
155 stars 35 forks source link

Midi export not taking into account instruments #183

Closed Matthew-w56 closed 2 months ago

Matthew-w56 commented 2 months ago

With a GMN file that specifies the instrument to use in the midi representation of the score (with a tag such as \instr<"Instrument Name", "MIDI 71">), the midi file created by Guido2MidiFile (with midi support enabled in the build) does not include any instruments other than the default. In converting the midi to a CSV representation, adding the instruments manually, and converting it back, the new instrument can then be heard.

Is there something not obvious one must do to get the MIDI to reflect the \instr tags? Or is this a bug?

Matthew-w56 commented 2 months ago

While I'm following the pattern laid out in the Guido notation specification, I've found that the error behind the Midi problems was that something about the syntax causes the system to try to interpret the second half of the tag (the actual midi code) as a note name. Here is a small example that highlights this error:

[ \instr<"InstrumentKey", "MIDI 71"> c1/2 e&/4 e& | _ f a&/2 ]

The error says:

Unknown notename, replaced by rest.

And the extra print statement I threw in there to get the name of the note it tried to parse found that it tried to parse "m" as a note. This is the M that starts off the MIDI word in the instr tag. Is there a new way to notate this instrument tag?

dfober commented 2 months ago

There is no such parameter for \instr tag but that would be easy to add.

Matthew-w56 commented 2 months ago

Oh okay. Is https://guidodoc.grame.fr/rsrc/GUIDO-Music-Notation-Format.pdf just specific to the Guido language specs and not what the GuidoLib supports? And is there any other way to specify instrument in the Midi that is currently supported? It would be a very useful feature if so

dfober commented 2 months ago

This is an old document (which source is even lost). For up-to-date reference you should look at the guidodoc web site. But nevertheless, MIDI instruments support is a good idea. I'll add that as soon as possible.

dfober commented 2 months ago

Support for MIDI parameter has been added. Note that the correct documentation is online (it differs slightly from the old pdf).