MML Player
-
@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.
-
@Discostew Sorry dude this is a big ask, and no worries if you're not up for it. Any chance you could fire me an email - and please include an explanation in layman's terms about MML and or similar concepts and comparisons . I really do need to have a better understanding.
All going well, or at least reasonably so, we will soon begin the FUZE Music Editor and as such it would be good to know we have considered our user's concerns.
Of course, and as is always the case, we will not be able to please everyone but if we can at least satisfy most then we will stand a chance of coming up with something pretty decent.
My email: jon.silvera@fuze.co.uk
And like I said, no worries if you're not into it.
-
Fuze Music Editor?! Wow, that’s something to look forward to, for sure!
-
@Jonboy Honestly, my only experience prior to making my MML functions was utilizing MML on the user end with Petit Computer on the DSi, so I'm just attempting to mimic how that operated in FUZE. The way I go about it works, but may not be the correct method. It's really just a sequencer where for each channel, you have a start, and then go through them instruction by instruction (I convert MML strings to an numeric array where each instruction is assigned a code, and additional values follow, mainly for speed purposes as continually working with it as strings requires more processing). I keep a state for most instructions for when they are needed later (like if you set the Octave, and later down the line, you wish to drop it by 1), and each note is given an amount of time to play, either individually or based on the default length, so instructions generally halt until the note is done. This includes when at rest.
It has been a while since I last touched the code, and I don't have my Switch on me atm to review what I did. Maybe when I have the time, I could go through my code and document it thoroughly.
@spikey I'll take a look at it when I get the chance. I figured it was an issue with struct-copying, but I thought I had tried something like copying each piece one at a time when tested the issue, and my results came up no different. Maybe I was missing something. Anyways, I'll check it out later.
-
Let's face it, a lot has happened in Fuze in 7 months too :)
-
-
@Discostew ‘s mml player no longer works after the latest patch. I would love if he (or someone else) could get it up and running again.
-
It would seem that in addition to a few cases of needing to replace 'handle' with
var
, the code uses reference variables (similar to a 'with' block).For example 't' is used as shorthand for 'dmml_Main.t' throughout the code.
t = dmml_Main.t ... t[ tID ].something = [ stuff ]
This no longer works since 't', is now only a copy of 'dmml_Main.t' but replacing t with 'dmml_Main.t' seems to have fixed it. My version also has changes I made to stabilize it prior to v2.15. Although I am not sure those changes are needed anymore, I have left them in.
I have friend shared the program for now. I don't want to submit for public sharing it since I am not the author.
-
Thanks, @Gothon!