Navigation

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

    MML Player

    Work In Progress
    12
    37
    2542
    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.
    • Discostew
      Discostew F last edited by Discostew

      Finally got the parser done (as far as I can tell), and now have begun on the playback portion. Here is the first successful test of the playback. Forced the envelope because that part is not ready yet. Little blips and such, but nothing too bad for a first run.

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

        Nice! Again, it's so cool to see so many different approaches to the "play music" thing. I hope to be posting my way shortly.

        Does the MML specs support multiple channels (in paralell)?

        Discostew 1 Reply Last reply Reply Quote 0
        • sys64738
          sys64738 F last edited by

          Also love seeing the music programs!

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

            @Nisse5 It does indeed, up to 8 channels in tandem. However, I've been hitting the "Stack overflow" error recently, and it comes up quicker as I include more notes and channels. I wish this particular issue was easier to debug.

            1 Reply Last reply Reply Quote 1
            • Discostew
              Discostew F last edited by

              Worked on the code a little. Pretty sure the stack overflow problem comes from the whole ByVal vs ByRef alongside how some created local variables aren't getting cleaned out when reassigned. After some changes, I've been able to run my code for almost 3 minutes before the error popped up, and this was with 6 channels running. Before with 6 channels, I couldn't even get through 4 seconds.

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

                I'll make a try on a MML parser of my own as well, although I need to enhance the syntax with some additional stuff that I really need. As a start, I'll base it on the GWBASIC MML syntax for the PLAY command.

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

                  Updated to provide macro support, volume changes, and portamento (sliding from one note to another). Tests involves some sound effects in Mega Man 2.

                  1 Reply Last reply Reply Quote 3
                  • Discostew
                    Discostew F last edited by

                    Updated to get necessary functionality to allow me to playback full MML tracks. For your listening pleasure, here's a snip of Mega Man 2's Wood Man stage theme. It was the only track that mostly used the 1:2 Square Wave tone (all other tracks utilize other duty cycles much more). If you have me friended, you can grab the program under the Shared section.

                    Be warned, because of the current Stack Overflow problems with the current FUZE4 build, playback will be interrupted just after 1 minute. Nothing I can do about that at the moment.

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

                      @Discostew Really really nice!!!

                      How do you set the waveform? I saw the ".tone" in your source code, but I couldn't find how it you actually set it.

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

                        @Nisse5 Setting the tone in the MML string? It's done using the @ symbol (which designates a channel command), followed by a number. Other channel commands, like MP for modulation, follow the @ symbol (though I should have mentioned that modulation isn't supported yet).

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

                          Implemented modulation now, but it's something I'll need to test with more tracks to ensure that it's done properly. At this point I think I have just one more command to do that's specific to PTC, and that is the Time Gate. May push the tempo setting within the MML data rather than keeping it external (but making a function that can allow adjusting playback by %, both faster and slower). Other than that, I'll be making various other additions and changes to that spec (volume slides are in already which weren't part of PTC's MML, and modulation was altered to include a tone to use, as the original was restricted to a sine wave).

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

                            Work was done in preparing v0.2 (not likely to be uploaded this week). The majority of it is how to get audio playing. Before, it was only via the handle for each loaded piece of audio, but that caused a problem, such as if someone wanted multiple instances of the same audio playing. So, I've implemented the use of "tracks", to which after audio is loaded, you go to play it by sending in not just the handle to the loaded audio, but select a track to play it on. This makes it easier to manage. Up to 8 tracks can play at the same time (but be aware there are only 16 channels to use, as we don't have the means to do mixing). One can adjust the speed and volume of each track separately. Because of this, tempo was moved into the MML spec. I've also adjusted the use of channels. Before, it was directly using whatever the MML audio requested, which meant if more than one track used a channel, it would cause issues. Now, it's more of a reference, and the system will choose any available channel (from first to last) to designate for the audio requested for playback. In time I do want to go back to re-implement the direct channel usage properly as an optional mode, to allow tracks to share channels (with lower track numbers having priority). This usage would be similar to how retro systems dealt with multiple pieces of audio at the same time with their limited number of channels.

                            v0.2 will not only include updated function lists, but will also contain the command syntax for the MML audio, to help better understand how it's all put together for when you're ready to make your own audio. Should also note that I've reduced overall CPU usage, mainly due to shortening variable names as this is running under an interpreter that must take each character in code into account. Less characters to look at, less time to process them some rearranging of variables, and accessing structures in a ByRef manner.

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

                              Brought over another piece of music from my MM2PTC project, this time an 8-bit rendition of MMX2's Absolute Zero (used for my project's boss rush mode). The original rendition I did used envelopes heavily, which the current form in FUZE does not fully have (but we were told it's coming), but when I forced some reverb on the channels (not included in tweet), it sounded quite nice. Guess that's the next thing to do with my MML spec. To add reverb as a command.

                              1 Reply Last reply Reply Quote 3
                              • Discostew
                                Discostew F last edited by

                                Folks trying to run my program after the update might have an issue where a struct element "IsInited" does not exist. That is because, I believe, now case-sensitivity is enforced. It's a simple fix with the SetVolume and SetSpeed functions where you find the problematic line, and change to "isInited" with a lower-case "i".

                                Other than that, the patch helped a little in the program stack overflow bugs, but it will still occur. I don't think this patch was meant to focus on this issue as they planned this one before we made mention of it.

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

                                  @Discostew said in MML Player:

                                  I don't think this patch was meant to focus on this issue as they planned this one before we made mention of it.

                                  Some work was done in that area but as we can see it's certainly not 100% yet. All I can say right now is watch this space. We are most certainly aware!

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

                                    @Martin said in MML Player:

                                    @Discostew said in MML Player:

                                    I don't think this patch was meant to focus on this issue as they planned this one before we made mention of it.

                                    Some work was done in that area but as we can see it's certainly not 100% yet. All I can say right now is watch this space. We are most certainly aware!

                                    Thank you.

                                    To everyone who grabbed my program, you probably noticed how loud it is. I've been programming this docked the entire time, and I usually have my volume low, so having tried it portable with headphones, I found it blaring my my ears. Will adjust the volume. It wasn't an issue with Petit Computer that the MML was initially designed for, as I believe they had the volume low internally from the get-go.

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

                                      Hearing that Megaman track was absolutely surreal! Incredible!

                                      What would the workflow be like for this-- is there a sequencer which can generate MML, which could then be manually typed into a Fuze program? Also, is your code going to be pretty portable-- like, could it be easily copy and pasted?

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

                                        @Spacemario The plan is to make it as simple to incorporate into your own projects. Simply copy the functions and structures into your own project, and copy a line that defines the base structure used by the MML system that must be executed before any MML function is called. After that, you just call the init function to initialize it, load MML strings that return a handle, then play those MML strings to a track, up to 8 at the same time. Will also have the option to manually update the system per frame, or automatic via timer during initialization.

                                        Currently, you make the MML strings by hand, but because it's meant to be similar to Petit Computer's MML design, if there is a sequencer than can make those strings, then it could possibly be used for this as well, though a few changes would need to be made to make it compatible.

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

                                          @Discostew Got it, that makes total sense! With the quality of your solution, I could see this becoming a or maybe the de facto way of doing music in Fuze games.

                                          I wonder if there are plans to eventually do "libraries" of sorts on Fuze? That would be a lot easier than copying and pasting. Or, maybe that's way beyond the scope of what Fuze is trying to accomplish.

                                          1 Reply Last reply Reply Quote 0
                                          • lawyerlounge
                                            lawyerlounge last edited by

                                            Do you still need to type the notes and duration out in this program?: D4 E4 F4 G4 E4 C4 D4 etc. or how is programming the notes and duration done differently?

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