Navigation

    Fuze Arena Logo
    • Register
    • Login
    • Search
    • Categories
    • Recent
    • Popular
    • Users
    • Groups
    • Help
    • Discord

    MML Music Parser (GW-Basic origin)

    Work In Progress
    5
    15
    861
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • N
      Nisse5 F last edited by Nisse5

      BTW, this is a very similar project to what @Discostew already creates in this thread:
      https://fuzearena.com/forum/topic/272/mml-player

      I'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.

      1 Reply Last reply Reply Quote 5
      • sys64738
        sys64738 F last edited by

        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?

        N 1 Reply Last reply Reply Quote 0
        • SteveZX81
          SteveZX81 F last edited by

          Wow thats so cool!

          1 Reply Last reply Reply Quote 0
          • N
            Nisse5 F @sys64738 last edited by Nisse5

            @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.

            1 Reply Last reply Reply Quote 1
            • N
              Nisse5 F last edited by Nisse5

              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.

              1 Reply Last reply Reply Quote 1
              • N
                Nisse5 F last edited by Nisse5

                Added support for triplets and some other kind of tuplets now. I tested it in the tweet below with the DKC2 theme ("K. Rool Returns") by David Wise, in which I entered the music using both triplets and quintuplets.

                EDIT: shared the updated version now. It should say version 1.1 in the source code.

                1 Reply Last reply Reply Quote 2
                • N
                  Nisse5 F last edited by

                  I now support tremolo and trills (using my own syntax) in my MML parser, which I demo in the Star Wars scroller:

                  (Latest version isn't shared yet, however.)

                  1 Reply Last reply Reply Quote 2
                  • Spacemario
                    Spacemario F last edited by

                    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!

                    N 1 Reply Last reply Reply Quote 0
                    • N
                      Nisse5 F @Spacemario last edited by

                      @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).

                      Martin Spacemario 2 Replies Last reply Reply Quote 2
                      • Martin
                        Martin Fuze Team @Nisse5 last edited by

                        @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!

                        1 Reply Last reply Reply Quote 0
                        • Spacemario
                          Spacemario F @Nisse5 last edited by

                          @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!

                          1 Reply Last reply Reply Quote 0
                          • Martin
                            Martin Fuze Team last edited by Martin

                            @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.

                            Spacemario 1 Reply Last reply Reply Quote 0
                            • Spacemario
                              Spacemario F @Martin last edited by

                              @Martin Oh, I get it now! That makes sense.

                              1 Reply Last reply Reply Quote 0
                              • Spacemario
                                Spacemario F last edited by

                                @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

                                N 1 Reply Last reply Reply Quote 0
                                • N
                                  Nisse5 F @Spacemario last edited by

                                  @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.

                                  1 Reply Last reply Reply Quote 0
                                  • First post
                                    Last post