• Welcome to Final Fantasy Hacktics. Please login or sign up.
 
March 19, 2024, 02:05:01 am

News:

Don't be hasty to start your own mod; all our FFT modding projects are greatly understaffed! Find out how you can help in the Recruitment section or our Discord!


SMD Parser (WIP)

Started by lirmont, June 25, 2014, 02:41:21 pm

lirmont

I know there's already something that will get a MIDI into SMD format. I was curious to get the notes out of an SMD, though. This is the file "MUSIC_24.SMD" (LvUp L) with varying MIDI instruments: MUSIC_24.mp3.

As soon as I finish cleaning up the code, I'll post a link here. I believe some of the unknowns point to the information the BGM test shows (an actual title, author, and help text), but I wasn't that curious.

Name: music_24
Tracks: 10
Path: MUSIC_24.SMD
Start Track #1
    Set tempo to 128 (128/102 * 120bpm).
    Set time signature to 4/4.
    BEGIN LOOP, Loop x3
        Rest for 192/192 of a whole note.
    END LOOP
End Track.
Start Track #2
    Set volume to 30/127.
    Set balance to 64/127 towards right speaker.
    Set instrument to 79.
    Set octave to 5.
    C5 (74%) for 6% of a whole note, NOTE ON
    Rest for 60/192 of a whole note.
    F5 (74%) for 6% of a whole note, NOTE ON
    Rest for 84/192 of a whole note.
    C5 (74%) for 6% of a whole note, NOTE ON
    Rest for 12/192 of a whole note.
    Rest for 48/192 of a whole note.
    F5 (74%) for 6% of a whole note, NOTE ON
    Rest for 36/192 of a whole note.
    Set instrument to 80.
    C#5 (74%) for 12% of a whole note, NOTE ON
    Rest for 24/192 of a whole note.
    Set instrument to 79.
    C#5 (74%) for 6% of a whole note, NOTE ON
    Rest for 36/192 of a whole note.
    C5 (74%) for 6% of a whole note, NOTE ON
    Rest for 144/192 of a whole note.
    Rest for 36/192 of a whole note.
End Track.
Start Track #3
    Set volume to 30/127.
    Set balance to 64/127 towards right speaker.
    Rest for 48/192 of a whole note.
    Set instrument to 80.
    Set octave to 4.
    G4 (74%) for 6% of a whole note, NOTE ON
    Rest for 60/192 of a whole note.
    A#4 (74%) for 6% of a whole note, NOTE ON
    Rest for 48/192 of a whole note.
    Rest for 12/192 of a whole note.
    Rest for 24/192 of a whole note.
    G4 (74%) for 12% of a whole note, NOTE ON
    Rest for 24/192 of a whole note.
    Increment octave from 4 to 5.
    C5 (74%) for 6% of a whole note, NOTE ON
    Rest for 36/192 of a whole note.
    Decrement octave from 5 to 4.
    A#4 (74%) for 6% of a whole note, NOTE ON
    Rest for 36/192 of a whole note.
    Set instrument to 79.
    A#4 (74%) for 6% of a whole note, NOTE ON
    Rest for 12/192 of a whole note.
    Rest for 192/192 of a whole note.
End Track.
Start Track #4
    Set volume to 36/127.
    Set balance to 64/127 towards right speaker.
    Set instrument to 70.
    Set octave to 6.
    C6 (78%) for 4% of a whole note, NOTE ON
    Rest for 64/192 of a whole note.
    Decrement octave from 6 to 5.
    G#5 (78%) for 3% of a whole note, NOTE ON
    Rest for 90/192 of a whole note.
    Increment octave from 5 to 6.
    C6 (78%) for 4% of a whole note, NOTE ON
    Rest for 16/192 of a whole note.
    Rest for 48/192 of a whole note.
    Decrement octave from 6 to 5.
    G#5 (78%) for 3% of a whole note, NOTE ON
    Rest for 42/192 of a whole note.
    C#5 (78%) for 12% of a whole note, NOTE ON
    Rest for 24/192 of a whole note.
    A#5 (78%) for 3% of a whole note, NOTE ON
    Rest for 36/192 of a whole note.
    Rest for 6/192 of a whole note.
    Increment octave from 5 to 6.
    C6 (78%) for 4% of a whole note, NOTE ON
    Rest for 144/192 of a whole note.
    Rest for 36/192 of a whole note.
    Rest for 4/192 of a whole note.
End Track.
Start Track #5
    Set volume to 36/127.
    Set balance to 64/127 towards right speaker.
    Set instrument to 70.
    Set octave to 5.
    G5 (78%) for 4% of a whole note, NOTE ON
    Rest for 64/192 of a whole note.
    D#5 (78%) for 3% of a whole note, NOTE ON
    Rest for 90/192 of a whole note.
    G5 (78%) for 4% of a whole note, NOTE ON
    Rest for 16/192 of a whole note.
    Rest for 48/192 of a whole note.
    D#5 (78%) for 3% of a whole note, NOTE ON
    Rest for 42/192 of a whole note.
    Decrement octave from 5 to 4.
    A#4 (78%) for 12% of a whole note, NOTE ON
    Rest for 24/192 of a whole note.
    Increment octave from 4 to 5.
    F#5 (78%) for 3% of a whole note, NOTE ON
    Rest for 36/192 of a whole note.
    Rest for 6/192 of a whole note.
    G5 (78%) for 4% of a whole note, NOTE ON
    Rest for 144/192 of a whole note.
    Rest for 36/192 of a whole note.
    Rest for 4/192 of a whole note.
End Track.
Start Track #6
    Set volume to 36/127.
    Set balance to 64/127 towards right speaker.
    Set instrument to 70.
    Set octave to 5.
    E5 (78%) for 4% of a whole note, NOTE ON
    Rest for 64/192 of a whole note.
    C5 (78%) for 3% of a whole note, NOTE ON
    Rest for 90/192 of a whole note.
    E5 (78%) for 4% of a whole note, NOTE ON
    Rest for 16/192 of a whole note.
    Rest for 48/192 of a whole note.
    C5 (78%) for 3% of a whole note, NOTE ON
    Rest for 42/192 of a whole note.
    Set instrument to 68.
    F#5 (78%) for 12% of a whole note, NOTE ON
    Rest for 24/192 of a whole note.
    Set instrument to 70.
    C#5 (78%) for 3% of a whole note, NOTE ON
    Rest for 36/192 of a whole note.
    Rest for 6/192 of a whole note.
    E5 (78%) for 4% of a whole note, NOTE ON
    Rest for 144/192 of a whole note.
    Rest for 36/192 of a whole note.
    Rest for 4/192 of a whole note.
End Track.
Start Track #7
    Set volume to 36/127.
    Set balance to 64/127 towards right speaker.
    Rest for 48/192 of a whole note.
    Set instrument to 70.
    Set octave to 5.
    G5 (78%) for 3% of a whole note, NOTE ON
    Rest for 66/192 of a whole note.
    F5 (78%) for 4% of a whole note, NOTE ON
    Rest for 64/192 of a whole note.
    Rest for 24/192 of a whole note.
    G5 (78%) for 12% of a whole note, NOTE ON
    Rest for 24/192 of a whole note.
    F5 (78%) for 3% of a whole note, NOTE ON
    Rest for 42/192 of a whole note.
    F#5 (78%) for 3% of a whole note, NOTE ON
    Rest for 42/192 of a whole note.
    Set instrument to 71.
    Increment octave from 5 to 6.
    C#6 (78%) for 3% of a whole note, NOTE ON
    Rest for 18/192 of a whole note.
    Rest for 192/192 of a whole note.
End Track.
Start Track #8
    Set volume to 36/127.
    Set balance to 64/127 towards right speaker.
    Rest for 48/192 of a whole note.
    Set instrument to 70.
    Set octave to 5.
    E5 (78%) for 3% of a whole note, NOTE ON
    Rest for 66/192 of a whole note.
    D5 (78%) for 4% of a whole note, NOTE ON
    Rest for 64/192 of a whole note.
    Rest for 24/192 of a whole note.
    E5 (78%) for 12% of a whole note, NOTE ON
    Rest for 24/192 of a whole note.
    D5 (78%) for 3% of a whole note, NOTE ON
    Rest for 42/192 of a whole note.
    C#5 (78%) for 3% of a whole note, NOTE ON
    Rest for 42/192 of a whole note.
    A#5 (78%) for 3% of a whole note, NOTE ON
    Rest for 18/192 of a whole note.
    Rest for 192/192 of a whole note.
End Track.
Start Track #9
    Set volume to 36/127.
    Set balance to 64/127 towards right speaker.
    Rest for 48/192 of a whole note.
    Set instrument to 70.
    Set octave to 5.
    C5 (78%) for 3% of a whole note, NOTE ON
    Rest for 66/192 of a whole note.
    Decrement octave from 5 to 4.
    A#4 (78%) for 4% of a whole note, NOTE ON
    Rest for 64/192 of a whole note.
    Rest for 24/192 of a whole note.
    Increment octave from 4 to 5.
    C5 (78%) for 12% of a whole note, NOTE ON
    Rest for 24/192 of a whole note.
    BEGIN LOOP, Loop x2
        Decrement octave from 5 to 4.
        A#4 (78%) for 3% of a whole note, NOTE ON
        Rest for 42/192 of a whole note.
    END LOOP
    Increment octave from 4 to 5.
    F#5 (78%) for 3% of a whole note, NOTE ON
    Rest for 18/192 of a whole note.
    Rest for 192/192 of a whole note.
End Track.
Start Track #10
    BEGIN LOOP, Loop x3
        Rest for 192/192 of a whole note.
    END LOOP
End Track.

Elric

I wish I understood any of this but GREAT work none the less, music editing/changing (and an easy way to do so) is something we
desperately need more of around here.
  • Modding version: PSX

lirmont

June 27, 2014, 06:00:02 am #2 Last Edit: June 30, 2014, 05:20:37 pm by lirmont
Let the most bizarre game of "Name That Instrument" begin: Instruments.

--

Disgaea's "Red Moon" (as found on VGMusic)



Instruments 41 and 42 (main, accompaniment).

--

I have discovered what offset 0x1A-0x1B (bytes 26 and 27) is (part of the 3rd unknown block on this page: Music/SMD). This sound file demonstrates a kind of reverb for values of 0 (0x0 0x0), 1084 (0x02 0x1e), and 15364 (0x04 0x3c; what FFT SMDs have): listen.

--

I'm sure it's been explained elsewhere about the SMD format, but most of the stuff is not complicated (considering they're mostly just MIDI files, which is a mature specification even back in 1997).

To help visualize the songs, I've added the feature to plot the notes and instruments out (because I'm having trouble finding suitable alternatives for the samples FFT used). If you can understand something like the graphs, I can probably set it up to interactively change the note (because the graphing application already supports interactivity). However, that won't cover any of the effects (and MIDI files depend on them to make engaging music).

The following are note graphs for two songs (songs provided).

LvUp L (i.e. "MUSIC_24.SMD") (listen)




KUMA BALL (i.e. "MUSIC_25.SMD", Mr. Bear Goes to the Ball) (listen)
Bass line only.



View: larger.