Page 1 of 1

DKC1 Custom Music Possible?

PostPosted: August 9th, 2011, 9:17 am
by Markster
You remember what SMW could do, import custom music using instruments from SMW, well I found this really old japanese hack of DKC, it had custom music, its called SDK mex, I found it here : http://u12.getuploader.com/tyutyuten/do ... dk_mex.zip

Don't worry, it's a IPS...

Of course most of the music hacking stuff is not compatible with the (U) ROM files, so i'm not sure if you could do the same with the (U) ROM.

Re: DKC1 Custom Music Possible?

PostPosted: October 9th, 2011, 2:08 am
by KingBrett
It's probably possible, the japanese and english ROMs are pretty much the same. I'd like to put Krematoa Koncerto into my DKC hack for its Lost World located behind Kongo Jungle (The extra Donkey Kong head behind Kongo Jungle doesn't really lead there as there is no Lost World in the original game, only in my hack but it will take some time so Necky Nutmare will only be in Chimp Caverns like in the GBC port for its beta release) There are some differences between those ROMs but I'm sure it's possible for custom music to be in the (U) version as well. But then again, I'm new to hacking the DKC games so I'm just making a guess. :P

Re: DKC1 Custom Music Possible?

PostPosted: October 9th, 2011, 3:20 pm
by Mattrizzle
Anything the SNES can do is possible when you're hacking a ROM. The question that should be asked is, "How?"

Here are my notes on the music/sound format in the DKC trilogy:
Spoiler!
Code: Select all
Header of music data:
Bytes 0x00-0x01 Length of data, not including this or the next two bytes (DKC1)/SPC RAM Destination (DKC2 & 3; Always 1300)
Bytes 0x02-0x03 SPC RAM Destination (DKC1, always 12A0)/ Length of data divided by two (DKC2 & 3)
0x04-0x13   SPC RAM Pointers to each instrument track's data for (2 bytes per pointer, 8 tracks per song)(this for song 0x00 in a set in DKC2 & 3)
0x14      Music Tempo
0x15      Sound Effect Tempo (Always A0 in DKC1; FF in DKC2 & 3)

DKC2 & 3 only:
0x16-0x??   Pointers to each song's instrument track pointer table (2 bytes per song; length varies depending on how many songs are in the set)
0x??-0x??   SPC RAM Pointers to each instrument track's data for song 0x01, followed by music and sound effect tempo (if the song exists)
0x??-0x??   SPC RAM Pointers to each instrument track's data for song 0x02, followed by music and sound effect tempo (if the song exists)
...etc.

The actual instrument track data comes after this, and can include the following control codes:

Control Codes (documentation is still incomplete):
00               End of sound data
01 II               Set Instrument sample (Valid values: 00-45(DKC1)
02 LL RR            Volume Levels (separate values for left and right speakers)
03 yy XX            Play sound data at SPC RAM address XXyy
04 NN yy XX         Play sound data at SPC RAM address XXyy NN times, then return
05               ????? (sometimes used at the end of sound data instead of 00)
06 ??               Global note length (if not set, must specify a note length after each note value)
08 ?? ?? ?? ??           ????? (DKC1)
0B ??               ????? (DKC1)
10 ?? ??            Attack/Decay/Sustain/Release(ADSR) of current instrument?
11 LL RR            Master Level (LL = left, RR = right; valid range: #$00-#$7F)
12 ??               ?????
13 PP            Set Instrument Pitch (signed)
14 PP            Increase/Decrease Instrument Pitch (signed)
15 KK LL RR         Echo of entire song (KK = feedback, LL = left echo level, RR = right echo level)
16 ?? ??            ?????
17               ????? (DKC1)
18 ?? ?? ?? ?? ?? ?? ?? ??      Finite Impulse Response(FIR) Filter for whole song
21 yy XX            Play sound data at SPC RAM address XXyy, different from 03? (DKC2 & 3 only)
23 VV            Volume Levels (same value for both speakers, DKC2 & 3 only)
28 II LL RR         Set instrument and left/right levels (DKC1 only?)
2A ??               ????? (DKC1 only?, Usually #$64)
80               Rest
81-??               Music Note Scale


And here's a patch showing that it can be done:
dkc_goal_music_replacement.ips
(5.21 KiB) Downloaded 1941 times
Apply this to a Donkey Kong Country (U) (V1.0) ROM. The file name of the patch tells what it does.

Re: DKC1 Custom Music Possible?

PostPosted: October 9th, 2011, 4:31 pm
by VideoViking
One of the songs I've been interested to hear in the form of an SNES edition is this one:

http://www.youtube.com/watch?v=EqyyFV9XF2g

You're saying, you can recreate it for the SNES?

Re: DKC1 Custom Music Possible?

PostPosted: October 11th, 2011, 12:58 am
by Mattrizzle
Yes, it should be possible.

(After reading the sentence above, if anyone is thinking about asking me the question "Will you do it for me?" my answer is no. If I started taking requests, they would never cease and I would be buried in a pile of them.)

Re: DKC1 Custom Music Possible?

PostPosted: July 23rd, 2012, 6:27 am
by TheUltimateKoopa
VideoViking wrote:One of the songs I've been interested to hear in the form of an SNES edition is this one:

http://www.youtube.com/watch?v=EqyyFV9XF2g

You're saying, you can recreate it for the SNES?


Technically, the SNES equivalent is "Voices of the Temple", but if you mean in that actual style, then that'd be awesome.

I always thought of it as some kind of dance/rock tune.

Re: DKC1 Custom Music Possible?

PostPosted: August 8th, 2012, 4:14 am
by Markster
Update!
----------
I am researching with DKC1, 2, and 3 music editing, I'm trying to find out about how the instruments work, and I'm learning ASM on the side.

Re: DKC1 Custom Music Possible?

PostPosted: February 24th, 2013, 4:51 am
by KeysOfMyMind
Jesus christ and people call these games simple what the hell :p

Re: DKC1 Custom Music Possible?

PostPosted: March 22nd, 2013, 7:47 am
by Axis
KeysOfMyMind wrote:Jesus christ and people call these games simple what the hell :p

Re: DKC1 Custom Music Possible?

PostPosted: March 22nd, 2013, 9:09 pm
by Raccoon Sam
Music hacking can be easy, given the right set of tools, but what amazes me is how thorough Mattrizzles documentation is. Documenting music data has always (to me, at least) been very difficult.
I've dealt with Super Mario Land's music format in the past, and even though the Game Boy only has four channels, I never finished the documentation. Making notes (heh) is easy when comparing changes in the ROM after you've edited graphics/tilemaps/physmaps, because upon testing you can literally see the changes you did. When it comes to editing music, I find it extremely tedious to 'hear' the changes. What byte controls the note's length or octave is somewhat easy, but echo, right/left channel, pitch bend? Come on!
Maybe I just have a bad note ear :rant:

Re: DKC1 Custom Music Possible?

PostPosted: March 23rd, 2013, 7:23 am
by Mattrizzle
To be honest, some of the notes I have related to the music format were lifted from the Japanese documents that Markster linked to in the original post. I just ran them through Google's (sloppy) translator, and tried my best to figure out what the translation said.

The original link appears to be down now, but fortunately, I still have the documents and patches!
sdk_bgm.zip
(18.53 KiB) Downloaded 1864 times

In order to view these properly, you need a text editor that can render text using Shift-JIS encoding. Notepad++ can do this.

Also, this SNES SPC700 Player is invaluable when you're trying to see how the code being executed by the sound processor is represented in hexadecimal. It has seven different information displays, which can be accessed by double clicking on the main area of the window when an SPC file is playing. It has other useful features as well, such as the ability to adjust the tempo and pitch.

Re: DKC1 Custom Music Possible?

PostPosted: May 9th, 2013, 10:41 am
by Lanky Kong

Re: DKC1 Custom Music Possible?

PostPosted: June 20th, 2022, 5:10 pm
by Cyclone
I am trying to change the music and sound around in the game. I translated this bit from the doc Mattrizzle posted.

In addition to this, the waveform set system is used.
This is the one that reads the specified waveform into ARAM.
There is one waveform set for each song.
The pointer to the waveform set starts at 0x0AB212. It is specified only in the lower 2 bytes.
The most significant byte is fixed at 0x0A.
For song number 00, it is "0xB286", in which case the waveform set starts at 0x0AB286.


I searched for the 86b2 pointer / address but it didn't find any. Any ideas?
Thanks.

Re: DKC1 Custom Music Possible?

PostPosted: June 21st, 2022, 5:32 pm
by Quaraage

Re: DKC1 Custom Music Possible?

PostPosted: June 22nd, 2022, 10:47 pm
by rainbowsprinklez
Loveemu did amazing work! I heavily used his documentation to create the music here!


Re: DKC1 Custom Music Possible?

PostPosted: June 24th, 2022, 3:23 pm
by Cyclone
How would I go about changing Crank's music with a different one?

and good work sprinklez

Mattrizzle would you be willing to help me out?

Re: DKC1 Custom Music Possible?

PostPosted: June 27th, 2022, 12:49 am
by rainbowsprinklez
That should be fairly easy: just swapping tracks. An array of songs to play by level code is here:
int MUSICTRACK = 0xb983b6;
Actually, for what you describe that might be harder. Changing LEVELS will work as I said. Kong family might be a bit different.

Re: DKC1 Custom Music Possible?

PostPosted: June 27th, 2022, 10:08 am
by Cyclone
Yes. I knew about that pointer table. It was missing some songs, like the kong family songs? There was no pointer in the table for Cranky's and the kongs songs.
But I figured it out. thanks to MAttrizzle again for the help!