MML Player
-
-
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)?
-
Also love seeing the music programs!
-
@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.
-
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.
-
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.
-
-
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.
-
@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.
-
@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?