News:

Don't forget to visit the main site! There's lots of helpful docs, patches, and more!

Main Menu

Calling All Composers!

Started by Mentlegen, June 16, 2018, 08:08:46 PM

Previous topic - Next topic

Mentlegen

Here are some tools and resources to make music hacking easier!

http://www.mediafire.com/?t38l8c66y4eqq

smetroid.zip a complete collection of Super Metroid Instruments in .WAV format! (no more screwing around with sf2's!)

mITroid.zip This is a tool used to convert .IT files (impulse tracker files) into .spc files.
note:interested in writing your own music? visit https://openmpt.org/ to get started

SPCTool.zip This tool lets you rip instruments and sfx from any spc file and ave into .brr format.


Videos

some useful videos

https://www.youtube.com/watch?v=yRnJuYfzECg - more samples from other games!

https://www.youtube.com/watch?v=zpHxJuSxVig - tutorial for openmpt

I will try my best to update this page when i find more information or tools.



I hope to see lots of custom music in upcoming hacks!
Happy hacking!

QuoteMSU1 is cheating!!!!
-quote, a black man.

Moehr

Heeding the call!

If it's cool with you I am hoping to get a starter guide together this week for openMPT -> N-SPC paste-into-rom via mITroid, wouldn't mind posting it in this thread when it's done.

In the meantime, here's the link to some mp3 and .IT files for the soundtrack for my hack.
https://1drv.ms/f/s!AlQ6oVIETJWMhwF9UkSbvOAKawMf

Downloading the .IT files and opening them in openMPT will let you drag a sample from one file and drop it into another; so if any of the samples I've used are of interest, that's the easiest way to get them.

Another tool I use for composing is a sequencer; the one I use is free and in-browser... it's limited but that helps focus on composition: https://onlinesequencer.net/748789

Also, here's some additional soundfonts that provide some alternatives to the standard system defaults:
https://www.philscomputerlab.com/general-midi-and-soundfonts.html
http://www.williamkage.com/snes_soundfonts/
https://www.zophar.net/music/nintendo-snes-spc/super-metroid

Mentlegen

Quote from: Moehr on June 16, 2018, 10:05:13 PM
Heeding the call!

If it's cool with you I am hoping to get a starter guide together this week for openMPT -> N-SPC paste-into-rom via mITroid, wouldn't mind posting it in this thread when it's done.

In the meantime, here's the link to some mp3 and .IT files for the soundtrack for my hack.
https://1drv.ms/f/s!AlQ6oVIETJWMhwF9UkSbvOAKawMf

Downloading the .IT files and opening them in openMPT will let you drag a sample from one file and drop it into another; so if any of the samples I've used are of interest, that's the easiest way to get them.

Another tool I use for composing is a sequencer; the one I use is free and in-browser... it's limited but that helps focus on composition: https://onlinesequencer.net/748789

Also, here's some additional soundfonts that provide some alternatives to the standard system defaults:
https://www.philscomputerlab.com/general-midi-and-soundfonts.html
http://www.williamkage.com/snes_soundfonts/
https://www.zophar.net/music/nintendo-snes-spc/super-metroid

Ya man! just make sure to keep replies on this page more resource or tutorial oriented and not personal hack oriented. I'd like to hear your music, but maybe in a separate thread or PM. glad you're on board my d00d!

Moehr

Mostly it's just there so people can take samples from the .IT files. I figure people who are composing can share samples if we have links to each others' .IT files. The mp3 is easier to preview.

It's actually a technique I use instead of keeping them in a separate folder; just throw a bunch of samples into a single .IT file named appropriately for whatever sample set you are making.

So like, call an .IT file "norfair", add all your norfair samples to it. Make another .IT for brinstar, etc. Perhaps you have some samples shared across each region; these samples might be included in all your regional .IT sample kits.

You can easily find/replace instruments in the patterns field to test different samples at different notes for your collection. Chorus one not hot enough for your norfair? replace it with chorus 2 and see how that sounds. Also, once you start getting a bunch of songs, it's easier to find your samples this way IMO, since you know your norfair samples are all available in your norfair.IT.

I'll include this in the little guide in a bit more detail.

dredwick

Nice! This is what I have been looking for (all my life) [since Super Metroid came into existence]!

Yuki

Is there a sound engine that works by just straight up replacing the SPC files in the rom now? Last I played with custom music, I had to do a custom ASM file based off one DSO made by writing the whole song in Hex

mccad

Quote from: Kenta Kurodani on July 22, 2018, 08:27:21 AM
Is there a sound engine that works by just straight up replacing the SPC files in the rom now? Last I played with custom music, I had to do a custom ASM file based off one DSO made by writing the whole song in Hex
Check out mITroid by total. It's still a work in progress, but it allows you to create insertable NSPC files out of .IT tracker files. Works pretty well

Moehr

#7
Been messing around with the hex code for the Super Metroid fanfares a bit, and it's helped me learn a thing or two about how the music is coded and where you can get some gains when composing that will let you squeeze a bit more room for your sample data for your background music.

The super metroid fanfares are located here in the vanilla ROM:
In SPC engine, $530E, (ROM - CF:BF16 - 27BF16 in hex editor) song 1 start, "Samus appears at save station"
In SPC engine, $546E, (ROM - CF:C076 - 27BF16 in hex editor) song 2 start, "item get"
In SPC engine, $5569, (ROM - CF:C171 - 27BF16 in hex editor) song 3 start, "elevator theme"
In SPC engine, $5697, (ROM - CF:C29F - 27BF16 in hex editor) song 4 start, "hallway to statue chamber theme"
In SPC engine, $56E2, (ROM - CF:C2EA - 27BF16 in hex editor) end of trackers

Also, if you need to move the song start locations, you will need to repoint a table in the ROM that has the locations, located here: CF:C2EE - 0E 53, 6E 54, 69 55, 97 56, pointers to each of 4 vanilla fanfare starting locations

You can add $CF:6C08 to an SPC pointer to find its location in the ROM.

Realizing after editing the fanfares a little, while you CAN change volumes and instruments in channels, if you set up channel variables one time and keep them, you save a LOT of memory. Notes and notelengths are fairly economical since they use one byte each, and a lot of commands take 2 or 3 bytes each, meaning you can end up with a ton of track data very quickly.

Another neat thing is that channel data is called via pointer, so if you have a drum loop that stays the same across several tracks, it only needs to occupy a single track's worth of space and then each pattern calls the same track again. So while I often use lots of different samples in my drum track(s), I tend to reuse that track across the whole song when possible. Which leaves more room for sample data.

Some of my stuff is through-composed but if you use mITroid to convert a .IT to an N-SPC, if two of your tracks are only off by one note, you can make some substantial data gains if you can give up that one note difference.

Another thing you can do is use shorter patterns and break a riff in half - if your riff goes AB in pattern 1 and AC in pattern 2, you could break the song into 4 patterns and only use 75% of the data you would need if you kept it in 2 patterns.

When I compose a song for a fanfare, I start in openMPT, then use mITroid to convert it to an N-SPC. Right now mITroid is set up to generate full-length background scores and the data is all shot out together. However, since it sets up all songs to have tracker data coded to the same space in the SPC engine, it is possible to find the tracker data for the song by searching for the sequence 28 58 2A 58 in a hex editor. You'll end up changing these values if you're editing a fanfare since the data will need to be placed in the main SPC engine chunk of the ROM data, and not in normal song data (though you could put it there if you wanted to).

Also because mITroid is set up for custom background songs right now, if you convert an IT file with mITroid, you'll need to then edit the hex code some to get them to work. mITroid has converted all of my custom music for BGM successfully so don't make these changes below to background songs; the changes are specifically for editing fanfares (track 01-04 in SMILE)

Below is the code for one of the conversions I generated recently; I used info here to make sense of it.

28 58 2A 58 32 58 54 58 FF 00 2C 58 42 58 42 58 42 58 42 58 42 58 42 58 42 58 42 58 F5 00 00 00 E5 FF E7 64 E1 0A ED FF 12 7F C9 F0 01 00 64 58 88 58 AA 58 C0 58 C0 58 00 00 00 00 00 00 E0 18 ED 70 24 B7 B7 B7 ED 53 12 B7 ED 4E EE 48 32 5A C8 EE 01 90 24 B2 B2 ED 53 EE 6C 2A 7E C8 C9 24 C8 00 6C C9 E0 18 ED 8B 24 B2 B2 ED 77 12 B2 ED 53 EE 48 39 5A C8 EE 01 96 24 AF ED 53 EE 6C 2A 7E C8 C9 00 7E C9 36 C8 E0 18 ED 84 24 B5 B5 ED 53 EE 6C 2A 7E C8 C9 48 C8 00 7E C9 C8 C8 C8 48 C8 00 00 00 00 00 15

Since mITroid is set up to make full songs, it has some data that makes it not play in the engine if you overwrite your fanfare data without making some edits:

28 58 2A 58 32 58 54 58 FF 00 2C 58 - a string of pattern pointers with FF 00 indicating a loop and 2C 58 the pointer to the pattern to loop from. Fanfares should probably not loop, and all of these pointers will be wrong anyhow. These get replaced with correct data, and repointed after you know where each channel of each pattern starts.

42 58 42 58 42 58 42 58 42 58 42 58 42 58 42 58 - I am not sure what this string does; it looks like channel initializers. They aren't used by fanfare tracks as far as I can tell, so I got rid of them.

F5 00 00 00 E5 FF E7 64 E1 0A ED FF 12 7F C9 F0 01 00 - This is the first channel of the pattern (channel 1 in openMPT, channel 0 in N-SPC); when the first channel finishes its last note, all the channels will stop playing and the song will move onto the next pattern in that initial list. mITroid exports it with a trailing 00 byte which causes the fanfare to end abruptly. Remove this 00 for fanfares.

64 58 88 58 AA 58 C0 58 C0 58 00 00 00 00 00 00 - these are the old channel pointers for the first pattern of the song; the fanfare definitely won't play with them in the middle of channel data, so I moved them ahead of the first channel's data (the line starting F5 00 00 00)

The next four strings of data are channel info; the first continues channel 0 so I append it to the line starting F5 00 00 00, and the subsequent strings are channels 1,2, 3 and 4+5, since channel 4's data is silence and used by channel 5 as well. Channel data has a trailing 00 byte to let the player know it has finished that channel's playback; the next channel starts after this byte. Since channels 4 and 5 only have data because I forgot to delete a note in the .IT file, I will delete that data and replace the channel pointers with 00 00 later on.

E0 18 ED 70 24 B7 B7 B7 ED 53 12 B7 ED 4E EE 48 32 5A C8 EE 01 90 24 B2 B2 ED 53 EE 6C 2A 7E C8 C9 24 C8 00

6C C9 E0 18 ED 8B 24 B2 B2 ED 77 12 B2 ED 53 EE 48 39 5A C8 EE 01 96 24 AF ED 53 EE 6C 2A 7E C8 C9 00

7E C9 36 C8 E0 18 ED 84 24 B5 B5 ED 53 EE 6C 2A 7E C8 C9 48 C8 00

7E C9 C8 C8 C8 48 C8 00

The last line here is written by mITroid for full-song transfer to the SPC engine to let it know to stop moving data from ROM to ARAM, but since we don't want our fanfare data to end the initial transfers when starting gameplay, we just replace the 15 with 00.

00 00 00 00 15


It starts at CF:C030 in the hack I am working on; the first four bytes originally read "28 58 2A 58" which is how I found where it started:
2C 54, 00 00 - play the pattern at 2C 54, then stop playing this song (00 00); additional patterns could precede the 00 00

3C 54, 6A 54, 8C 54, 00 00, 00 00, 00 00, 00 00, 00 00 - Cut the track down to 3 active channels and 5 unused channels; channels are called by a 2-byte pointer and there must be 8 channels (point to 00 00 if the channel has no data)
F5 00 00 00 - sets echo-enabled channels (not used in this track), takes 3 arguments
E5 FF - sets main song volume, one argument
E7 64 - sets song speed, one argument, higher number is faster playback
E1 0A - Sets panning on channel: $14 = left, $0A = center, $00 = right
ED FF - sets channel volume, combines with main song volume
12 7F - note duration; 01-7F is a note, and if followed by a byte that is also 01-7F, the second byte adds volume and sustain
C9     - play nothing and run out the preceding note duration (in this case, 12)
F0 01 - set channel vibrato
E0 0C - select instrument 0C (in this case, the CLI string sample from the vanilla ROM)
ED 70, 24, AB AB AB - Set channel volume to 70, next notes are length 24 (at current song speed), play 3 notes AB (which is G5)
ED 53, 12, AB - Set channel volume to 53, next note is length 12, play AB
ED 4E, EE 48 32, 5A, C8 - Set channel volume to 4E, move channel volume to 32 over a duration of 48 ticks, sustain previous note
ED 90, 24, A9, A3, C8, C9, 24, C8 - Set the volume to 90, next note is length 24, play a string of notes - C8 is a dummy note that sustains the previous note
00 -   End channel playback

6C C9 - Next channel's data begins with a silence of 6C length, to delay the start of playback compared to channel 0
E0 0C ED 8B 24 A6 A6 ED 77 12 A6 ED 53 EE 48 39 5A C8 EE 01 96 24 A3 ED 53 EE 6C 2A 7E C8 C9 00 - rest of channel data

7E C9 36 C8 - Last channel's data also starts with a bit of silence, to begin playback a bit later than channel 21
E0 0C ED 84 24 A6 A6 ED 53 EE 6C 2A 7E C8 C9 48 C8 00 - rest of channel data


In the pattern data at the start of the modified track, you could list 2C54 several times to play the pattern several times, or list other patterns to add additional parts to the song, and each pattern could reference any of these channels or other channel data that you add elsewhere - you could even have 3 sets of channel data that are played, 2 at a time, by 3 different patterns. This is a neat idea if your fanfare uses the same notes but with different samples, so you could play a riff first with guitar and piano, then with bass and piano, then with piano and bass.

Anyhow, I hope you can see how you might reuse patterns and channels to cut down on the size of a track some, allowing for a few more fanfares or the ability to vary the length of fanfares compared to the original game.

aaaa

#8

Mentlegen

Quote from: aaaa on December 21, 2018, 11:04:02 AM
Custom music :https://www.dropbox.com/s/lanshv062wyn06m/let_i_snow.zip the link has expired

I'd love to hear your piece! try posting it to the main site as a resource?

Ri2nOneRok

Thanks for this thread Mentlegen, I wanted to ask you on this chat rather than private message you in case you answer this question for others that want to start somewhere but have no clue where to begin (like myself).

   Maybe I am looking at a thread that is more for advanced rom hackers... But for instance, I have been working with MIDI for quite a while (7+ years) now. And I must say some of the file extensions on this thread, or codeing... is bananas to me.

So i ask, in order to make a song for a level in a SM rom hack etc. Is there a guideline to follow such as how to compose for SM be it via MIDI or audio? and what to do to finalize it?

  If it is done by MIDI - Is there a way to import midi files to convert them to a file that an SM rom hack playback? And if so, what would you recommend is the easiest way to do so?

   Thanks in advance!

Mentlegen

Quote from: Ri2nOneRok on May 15, 2019, 10:33:48 PM
Thanks for this thread Mentlegen, I wanted to ask you on this chat rather than private message you in case you answer this question for others that want to start somewhere but have no clue where to begin (like myself).

   Maybe I am looking at a thread that is more for advanced rom hackers... But for instance, I have been working with MIDI for quite a while (7+ years) now. And I must say some of the file extensions on this thread, or codeing... is bananas to me.

So i ask, in order to make a song for a level in a SM rom hack etc. Is there a guideline to follow such as how to compose for SM be it via MIDI or audio? and what to do to finalize it?

  If it is done by MIDI - Is there a way to import midi files to convert them to a file that an SM rom hack playback? And if so, what would you recommend is the easiest way to do so?

   Thanks in advance!

Alright so SNES music is .spc format. There is a converter name mITroid that can convert .it files (impulse tracker) files into SPC files

OpenMPT is a program that I believe accepts midi input, and can write .it format
Check it out dude