protodomemusic / mmml

Micro Music Macro Language - An MML Implementation for 1-Bit Music on AVR Microcontrollers
GNU General Public License v3.0
96 stars 6 forks source link

mmml & note durations #8

Open farvardin opened 8 months ago

farvardin commented 8 months ago

It looks like there is a little inconsistency in mmml-compiler, there is a difference between the output error for 3 and for 24 for example:

b8 c16. a24 e16.

will output

[ERROR 4] Line 30: Consecutive (numerical) values - invalid number.

You might have entered a number that the command doesn't support. Additionally, the compiler could be expecting this value to be a certain number of digits in length and you might have exceeded that.

while

b8 c16. a3 e16.

will output

[ERROR 5] Line 31: Not a valid note duration.

The available values here are: 128,64,64.,32,32.,16,16.,8,8.,4,4.,2,2.,1,0

it's probably not a big deal, but I also wanted to raise the question of supporting tuplet values, with thee 3, 12, 24 values...

Maybe it's not possible due to the limitation of the atmega?

protodomemusic commented 5 months ago

You're right, and thanks for the heads up on this! I mentioned in my other comment that I'm retiring MMML in favour of an upgrade: Mega Micro Macro Music Language (lol). It's got an AVR version which hasn't been committed yet, though you can look at the new syntax/data structure here. That'll will hopefully support triplets.

In the meantime, what I've been doing to get triplets is manually subdividing the values to get a rough approximation. For example c3 c3 c3 could be approximated as c16&c64 c16. c16&c64. Increase the subdivision for better accuracy.

Note for future me: division by 3 is a pain, so I'll probably just proxy 3/9/24 etc. as something like the above and keep track of any remainder duration.

farvardin commented 4 months ago

You're right, and thanks for the heads up on this! I mentioned in my other comment that I'm retiring MMML in favour of an upgrade: Mega Micro Macro Music Language

well, we'll see then.

I still don't understand how you've composed 4000AD, I just find the mml language very tedious to work with. At the moment I've only used midi and conversion to mml with some tools, but it doesn't always export it right, and in addition tracks won't be optimized for size. So I've begun to work on mml by hand. I'm used to the ABC notation language, and even if the name is not that cool in comparison to MML, I find the way it handles note duration just easier, because it's the opposite of MML, but it makes sense: if you have for example E4 BA FA | E4 AD FA | E4 cA BG | AG FG Ac BA :| then it will output:

image

so to be sure your measures are correct you just have to count to check them, in the first bar 4+1+1+1+1 = 8 and so on.

I can't find a way to do it in MML. Maybe with a spreadsheet?