MML Player
-
@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).
-
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).
-
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 themsome rearranging of variables, and accessing structures in a ByRef manner. -
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.
-
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.
-
@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!
-
@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.
-
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?
-
@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, thenplay
those MML strings to a track, up to 8 at the same time. Will also have the option to manuallyupdate
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.
-
@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.
-
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?
-
@lawyerlounge You can assign a default length using the L command (ex: L4), so the sequence L4 C D8 E F E2 D C will be interpreted as C4 D8 E4 F4 E2 D4 C4.
-
@Discostew Can you post your friend code? It used to be in your signature, but I didn't grab it in time. Also, does your solution still have a crash or two in it?
-
@Spacemario SW-6473-2521-3817. Still need to share the program after they changed a few things that caused the share feature to not work. Been working on the program, since, so it needs some clean-up.
It still crashes. Tried a few methods, and while I've been able to extend the playback time, it still ultimately stops because of the stack overflow. It's something that will just have to wait until the next patch that hopefully fixes this problem.
-
stack overflow is fixed in the next patch
-
@Discostew Awesome, sounds good! And friend request sent
-
@MikeDX Fantastic!
-
@Discostew Commenting back in your main thread... I know it's not solving the real problem, but could you avoid the crash by picking some period of time-- let's say, 40 seconds-- and fade out the music, then restart it?
This would limit people to 40 second songs, but at least then the code would be usable until you can isolate the real issue? Also, the "fade out and restart" thing would evoke the Red Book 32-bit days, which wouldn't be a bad thing.
Just a random thought anyway.
-
@Spacemario The problem is cumulative from within FUZE itself. It'll just keep adding up as playback continues.
-
@Discostew I think I found a fix. Couldn't wait for the patch. Having such an MML player would be much of a help (I mean it contains portamento effect, I love that). My vision is to try to export sound from my Musical USB Keyboard or another music editor to your format. I hope you don't mind or let me know. Because your format is containing a lot (also a lot of work I guess). I can imagine it could become a standard format to integrate complex music.
@Gothon, quoted by @chiizujin in this post about structs and arrays mentioned that assigning a complete struct to another object like this, can cause problems over time:
first[0] = [.xpos = 4, .ypos = 1]
so I checked for other kind of assignments like (in the function
_dmmlUpdateSystem()
)
t = dmml_Main.t
which assigns a reference to t (what would make the code more readable). Changing t then also changes dmml_Main.t later. Well it seems to, and does, but it crashs after a while.
So, I replaced t with a declared local struct, and filled it with the content ofdmml_Main.t
one element by one.sDMML_track t[8] for j = 0 to len(t) loop t[j].isPlaying = dmml_Main.t[j].isPlaying ... repeat
and there the assignments to t, I replaced by direct
dmml_Main.t[tID].
{any struct attribute} assignments.I shared it as version 0.31. Please have a look if it still works as expected. I wonder if this patch is useful.