belangeo / pyo

Python DSP module
GNU Lesser General Public License v3.0
1.31k stars 131 forks source link

MML Syntax #191

Open ultrasound1372 opened 4 years ago

ultrasound1372 commented 4 years ago

I've had a look at the documentation for the MML object, and as an MML composer myself I find it hard to work with. But now that it has been released, alternative parsing would have to be done with flags on init. My biggest problem is the handling of note lengths, in every other compiler I've used the length commands end up with 1/d notes, so c4 produces a quarter note, c8 an 8th note, and c12 a quarter tripplet. And dots can be appended, so if you want a dotted 8th note, you can actually do "c8." to obtain this. While I'm used to mml syntax where spaces are insignificant, I understand this makes parsing a nightmare especially with your arbitrary user values so I won't say you should implement fully cursor based parsing. Far as I understand it, square brackets are currently used for indicating values to the question mark choice operator, leaving '|:' and ':|' as loop indicators? In the compilers I have used '[' and ']' are the loop inicators, though they don't have a choice operator. Not sure what can be done about this. Perhaps an MMLAlt object or a flag in the normal object could be created, to allow an alternative syntax, that is more standard in certain ways like length specification and other parsing details. If you are interested in this I could give you a syntax primer from someone who has been using MCK type compilers for what I think things should look like. I am also looking at mml2vgm, which is not MCK at all, so I have a slightly different syntax there. With MCK compilers you often end up defining volume envelopes frame by frame which just doesn't make sense here, especially if we can link it to an ADSR. All in all, I just want a cleaner, more usual syntax for the parsing of MML strings, as this will be a feature I will use to really get me into using Pyo, since MIDI doesn't work and I barely know how to control synths with MIDI. I'll have to learn how to control them with the streams out of this thing as well.