play_mml advanced "MML" player

Discuss NSF files, FamiTracker, MML tools, or anything else related to NES music.

Moderator: Moderators

Post Reply
troutsneeze
Posts: 7
Joined: Sun Aug 20, 2023 5:36 pm

play_mml advanced "MML" player

Post by troutsneeze »

Hello. I'm a game developer who has written an extended MML syntax for my games. My game library comes with a command line player for the MML files. I call it play_mml for now. I've used it in several games for music and sound effects.

For the low on what's different between NES, check out this document: https://github.com/troutsneeze/shim4/bl ... cs/MML.txt

A command line binary with some of my game music and SFX examples is here: https://drive.google.com/drive/folders/ ... sp=sharing

The code is still evolving so I am not resisting changing the syntax. Anyway, this isn't exactly the same as NES, but I did convert one of my games soundtracks from this custom player into an NES ROM soundtrack: https://www.indiedb.com/company/nooskew ... dtrack-nes so they're similar enough.
troutsneeze
Posts: 7
Joined: Sun Aug 20, 2023 5:36 pm

Re: play_mml advanced "MML" player

Post by troutsneeze »

Here is an example MML file from my player (from my game Dog-O):

Code: Select all

@S0 = { kick.flac }
@S1 = { clap.flac }
@R0 = { 3 0 500 64 0 }

A t200 @S0
A o5a8r4.a8r4.
A a8r8a8r8a8r4.
A a8r4.a8r4.
A a8r8a8r8a8r4.
A a8r4.a8r4.
A a8r8a8r8a8r8a8r8
A a8r4.a8r4.
A a8r8a8r8a8r4.
A a8r4.a8r4.
A a8r8a8r8a8r4.
A a8r4.a8r4.
A a8r8a8r8a8r4.
A a8r4.a8r4.
A a8r8a8r8a8r8a8r8
A a8r4.a8r4.
A a8r8a8r8a8r4.
A a8r2r8a8r8
A a8r8a8r8a8r8a8r8
A a8r2r8a8r8
A a8r8a8r8a8r8a8r8
A a8r2r8a8r8
A a8r8a8r8a8r8a8r8
A a8r2r8a8r8
A a8r8a8r8a8r8a8r8
A a8r2r8a8r8
A a8r8a8r8a8r8a8r8
A a8r2r8a8r8
A a8r8a8r8a8r8a8r8
A a8r2r8a8r8
A a8r8a8r8a8r8a8r8
A a8r2r8a8r8
A a8r8a8r8a8r8a8r8

B t200 @S1
B o4g8r1...
B g8r1...
B g8r1...
B g8r1...
B g8r1...
B g8r1...
B g8r1...
B g8r1...
B g8r1...
B g8r1...
B a8r1...
B a8r1...
B g8r1...
B g8r1...
B a8r1...
B a8r1...

C t200 @R0 @BTYPE0 @BV10 @BF8
C o5a8..r32a16.r32a16.r32a16.r8r32b8r8
C <c8r8>b8r8a8r8g8r8
C g8..r32g16.r32g16.r32g16.r8r32a8r8
C b8r8a8r8g8r8f8r8
C f8..r32f16.r32f16.r32f16.r8r32g8r8
C a8r8g8r8f8r8e8r8
C e8..r32e16.r32e16.r32e16.r8r32f8r8
C g8r8f8r8e8r8d8r8
C a8..r32a16.r32a16.r32a16.r8r32b8r8
C <c8r8>b8r8a8r8g8r8
C g8..r32g16.r32g16.r32g16.r8r32a8r8
C b8r8a8r8g8r8f8r8
C f8..r32f16.r32f16.r32f16.r8r32g8r8
C a8r8g8r8f8r8e8r8
C e8..r32e16.r32e16.r32e16.r8r32f8r8
C g8r8f8r8e8r8d8r8
C a8..r32a16.r32a16.r32a16.r2....
C r4..
C g8..r32g16.r32g16.r32g16.r2....
C r4..
C f8..r32f16.r32f16.r32f16.r2....
C r4..
C e8..r32e16.r32e16.r32e16.r2....
C r4..
C a8..r32a16.r32a16.r32a16.r2....
C r4..
C g8..r32g16.r32g16.r32g16.r2....
C r4..
C f8..r32f16.r32f16.r32f16.r2....
C r4..
C e8..r32e16.r32e16.r32e16.r2....
C r4..
>
D t200 @TYPE3 v128
D o4a1w1
D g1w1
D f1w1
D e1w1
D a1w1
D g1w1
D f1w1
D e1w1
D >a1w1
D g1w1
D <f1w1
D <a1g1
D >>a1w1
D g1w1
D <f1w1
D <a1b1
I use PetiteMM to convert my MIDIs exported from FL Studio to MML then hand edit for effects.

Anyway one thing I kind of want to try sometime is adding some switches for this to play NES syntax MML with DMC samples and stuff.
Pokun
Posts: 2556
Joined: Tue May 28, 2013 5:49 am
Location: Hokkaido, Japan

Re: play_mml advanced "MML" player

Post by Pokun »

Looks very interesting as there are not too many MML options for homebrew use. Can't get the player to work though, it just crashes.
troutsneeze
Posts: 7
Joined: Sun Aug 20, 2023 5:36 pm

Re: play_mml advanced "MML" player

Post by troutsneeze »

Pokun wrote: Mon Aug 28, 2023 3:33 pm Looks very interesting as there are not too many MML options for homebrew use. Can't get the player to work though, it just crashes.
What are you giving it as a parameter? It actually was crashing for me but your post is more recent than the update, so it's not crashing for me now. Which platform are you using and which parameters? The Linux version is built on Debian 12 so I'm not sure if distros are updated to a new enough libc yet to run that.

It is still EXTREMELY finicky, it will crash if you feed it bad data.
Pokun
Posts: 2556
Joined: Tue May 28, 2013 5:49 am
Location: Hokkaido, Japan

Re: play_mml advanced "MML" player

Post by Pokun »

I think the only parameter was one of the included MML files.
The system was a Windows 10 computer at the time and I used the zip version which had a Windows binary.
It failed mostly silently except that it said that it wrote a crash report somewhere on the computer.
troutsneeze
Posts: 7
Joined: Sun Aug 20, 2023 5:36 pm

Re: play_mml advanced "MML" player

Post by troutsneeze »

Something like:

Code: Select all

play_mml "examples\Dog-O Soundtrack\boss.mml"
Should work. At least it works on my Windows 11 system. As long as the flacs are in the same directory as the MML. Sorry if that doesn't work.
Pokun
Posts: 2556
Joined: Tue May 28, 2013 5:49 am
Location: Hokkaido, Japan

Re: play_mml advanced "MML" player

Post by Pokun »

Ah thanks that was the problem! I only grabbed the mml file and copied to the same directory as the executable, but I didn't touch the flac sample used by the song.
You may want to output an error message if any expected files are not found to tell the user what's going on and prevent it from failing silently.
troutsneeze
Posts: 7
Joined: Sun Aug 20, 2023 5:36 pm

Re: play_mml advanced "MML" player

Post by troutsneeze »

Thanks, I made an issue on GitHub for it. It was probably logged but that isn't obvious (C:\Users\<u>AppData\Roaming\Nooskewl Shim or something like that)
troutsneeze
Posts: 7
Joined: Sun Aug 20, 2023 5:36 pm

Re: play_mml advanced "MML" player

Post by troutsneeze »

I forgot to mention that it doesn't currently support ties either. I run a regex to replace ^. (^ and the next character) with a 'w'. This shouldn't be too hard to fix either, but if for example you have c4^g4 which I don't know if that's possible because I haven't seen it from FL Studio, that would require more work to bend the note. I'm a programmer who had no music theory knowledge before writing this. To bend notes I use pitch envelopes but it would definitely be possible to allow a tie to a different note if that's a thing.
Pokun
Posts: 2556
Joined: Tue May 28, 2013 5:49 am
Location: Hokkaido, Japan

Re: play_mml advanced "MML" player

Post by Pokun »

Yeah it told me where it created the log but it was some random binary file with no indication on what to do with it.
troutsneeze
Posts: 7
Joined: Sun Aug 20, 2023 5:36 pm

Re: play_mml advanced "MML" player

Post by troutsneeze »

I updated the builds at the original link so they print missing samples errors instead of crashing. There was some code I wrote a couple weeks ago that had some simple but serious errors.
Post Reply