LoginLogin
Might make SBS readonly: thread

MML Bugs

Root / SmileBASIC Bug Reports / [.]

📌
snail_Created:
Here's a thread where we can discuss bugs and intricacies of MML. The practice of each bug having it's own thread is rather messy IMHO, because most bugs are so small they don't warrant a discussion at all. I'll start it off. In the MML specification, macro names are said to be up to 8 alphanumeric characters long. In practice, this is not the case. Here is example output from DIRECT mode.
BGMPLAY "{ABCDEFGH=}"
Illegal MML(BGMPLAY:1)
  {ABCDEFGH=}
          ^

 Too long macro name (in Track 0)
OK
The MML parser encounters the error when it reaches the 8th character of the macro name, limiting you to 7 characters. I don't believe this to be a case of the manual being incorrect, I believe this is a bug. 8 is a very round, normal number to programmers (it being a power of 2), and 7 is the exact opposite (being a prime). It's also a very easy bug to make, so it wouldn't surprise me.

When using a macro, it actually allows 8 characters:
BGMPLAY "{ABCDEFGH}" '(8) Not defined macro
BGMPLAY "{ABCDEFGHI}" '(9) Too long macro name
But of course, you'll always get a "not defined macro" error. Also, macro names allow _ as well as alphanumerics, and don't allow numbers as the first character (while the manual just says the name can contain alphanumeric characters).

I noticed someone using the command @V in some MML, which isn't listed in the help menu. I think I figured out what it does. @V volume - sets the first volume multiplier (default=127) V volume - sets the second volume multiplier (default=127) The current volume is calculated as @V/127 * V/127 (ranges from 0 to 1) I believe @V is meant to be used to set the volume of entire track, while V is used to make small changes within a track. (Though technically you could do it the other way around)

When using _ like this: A_B, if the length of B isn't set, it plays a note with the length of A that slides in pitch from A to B. If the length of B is set (ex: A_B2), it will play B for that length at the end of the sliding note. This has the weird property that A_B plays for half the time of AB or A&B. I think this is the best way they could have handled this, but it's not really mentioned in the manual. (perhaps it's just standard in music though)

When using _ like this: A_B, if the length of B isn't set, it plays a note with the length of A that slides in pitch from A to B. If the length of B is set (ex: A_B2), it will play B for that length at the end of the sliding note. This has the weird property that A_B plays for half the time of AB or A&B. I think this is the best way they could have handled this, but it's not really mentioned in the manual. (perhaps it's just standard in music though)
Not an expert on music, but I think a slide is played for the duration of both notes, not just one. That's a bit weird.

Ok, here's a really horrible bug.
"A2_C&C2" == "A2_C4&C2"
"A2_C& C2" == "A2_C C2"
basically, don't do this: A_B&C where B has no length set so either do A_C& C (slide from A to C and play C) or A_Clength&C (slide from A to C and play C&C)

Ok, here's a really horrible bug.
"A2_C&C2" == "A2_C4&C2"
"A2_C& C2" == "A2_C C2"
basically, don't do this: A_B&C where B has no length set so either do A_C& C (slide from A to C and play C) or A_Clength&C (slide from A to C and play C&C)
I messed around with this, but I don't understand what the bug is, specifically where you think "A_B&C" behaves unexpectedly.

A_C&C behaves differently than A_C& C, which makes it impossible to put anything between the Cs without changing the timing of the song and ruining it.

hm so 2 years later I think I finally understand this... C&C is actually treated as one single note, unlike C&D or C& C which are separate notes A_C&C is the same as A_C2