MML Music Parser (GW-Basic origin)
-
BTW, this is a very similar project to what @Discostew already creates in this thread:
https://fuzearena.com/forum/topic/272/mml-playerI've now made my own MML parser, based on the GW-Basic/QBasic syntax for the PLAY command. Obviously, GW-Basic didn't have any support for anything other than the PC speaker back then.
I'm now finished with the implementation of the GW-Basic spec, but I made these 3 syntax changes:
- The middle C has been lowered 1 octave compared to the spec, to make better use of the MIDI key range
- The '<' and '>' commands switches octaves permanently, while the GW-Basic spec seems to indicate that it's a prefix to a note. QBasic seems to make permanent octave changes.
- The octave range has been expanded to 0-9
Here's a demo, where I wrote some arpeggiators around some simple chord progressions, basing the whole thing on MML strings. I also made the playback "visual":
I'll now continue to expand the MML syntax in various ways.
-
That's pretty fancy. Love the visual rainbow colours. Mml or a variant of seems to be the way to go for writing music . No doubt easier than writing playnote 3000 times for each song. Maybe we should settle in a standard for fuze?
-
Wow thats so cool!
-
@sys64738 The very basic parts of MML strings (playing notes and pauses, setting BPM and octaves) seem to be fairly standard between different MML dialects. But after that, since the syntax is so simplified, each dialect seems to take off in different directions, depending on what the music creators wants to do with MML.
Personally, I like that each FUZE user can make his/her own MML dialect. But OTOH, for others, a built-in MML player in FUZE would be just enough.
-
I've shared the project now, so you can use it to make your own songs if you want.
BTW, I made an additional syntax change:
- '<' increases to a higher octave
- '>' decreases to a lower octave
I think this is more graphically consistent. It's also what Petit Computer seems to do.
-
-
-
This is super cool! One thing which I also mentioned on @Discostew's thread was, part of the "deliverable" for this kind of music solution would be a workflow: how can I make a song in a tracker, and easily translate it into consumption by one of these MML parsers? If someone could nail both the MML parsing code and the workflow, I think that combined solution would become the de facto way of doing music in FUZE games. Just my two cents anyway!
-
@Spacemario Well, this is the same problem as with transferring images or any other kind of data from another location. If you create the MML outside of your current project, you will still need to type it in your source code some way (since FUZE has the restriction of not sharing file data between projects).
IMO, what's needed (and I wrote it in the feature request thread in the past) for FUZE is added support to be able to write to the FUZE text clipboard with an API. That way, users can create all kind of editors and those editors can put the data source code in the clipboard, which then can be pasted into the game project's source code. And this could then be used not only in music, but for all kinds of editing tools (graphics, level editing, etc, etc).
-
@Nisse5 said in MML Music Parser (GW-Basic origin):
and I wrote it in the feature request thread in the past
That request was noted - no promises however!
-
@Nisse5 said in MML Music Parser (GW-Basic origin):
@Spacemario IMO, what's needed (and I wrote it in the feature request thread in the past) for FUZE is added support to be able to write to the FUZE text clipboard with an API.
You mean, an application running on some other platform-- like a PC-- could write to the Fuze clipboard via an API? I'm not sure I'm following, too many carbs for lunch :D
And actually, I'd be ok with typing the MML by hand into my program-- my "workflow" concept was more like, what is a good (preferably gratis) tool to generate MML? Then the steps would be compose music in tool XYZ, export MML, copy & paste your "library"/functions into target program, manually type in the MML, and boom, working music.
Of course, if there would be a way to get external content into Fuze, so much the better!
-
@Nisse5 means permitting a Fuze program to write to the Fuze clipboard on the switch. When you exit a program the clipboard is persisted until it’s overwritten or you exit Fuze. So theory is you could write a creation tool that exports the MML to the clipboard, switch to a different program and paste the MML in.
That’s the theory anyway.
PC to Switch is subject to restrictions that we cannot discuss but it’s unlikely to happen.
-
@Martin Oh, I get it now! That makes sense.
-
@Nisse5 How consumption-ready is this? As in, if you share it, can I paste in your functions and call them from my main game loop?
I started getting annoyed with the limitations in my current music code last night, and I'm at a "build or 'buy'" point right now... :D
-
@Spacemario said in MML Music Parser (GW-Basic origin):
@Nisse5 How consumption-ready is this? As in, if you share it, can I paste in your functions and call them from my main game loop?
I started getting annoyed with the limitations in my current music code last night, and I'm at a "build or 'buy'" point right now... :D
Sure, it's ready for the functionality it currently supports. The issue right now is the stereo pan bug that was introduced in the update. I need to create a workaround for this in docked mode if I'm going to share it.