News: 11 March 2016 - Forum Rules, Mobile Version
Current Moderators - DarkSol, KingMike, MathOnNapkins, Azkadellia

Author Topic: .cbd/.chd sound file replacement on Donkey Konga 2  (Read 537 times)

Chandy

  • Jr. Member
  • **
  • Posts: 5
    • View Profile
.cbd/.chd sound file replacement on Donkey Konga 2
« on: November 20, 2017, 01:49:34 pm »
Hi all, first time poster here. I am looking to learn about sound effect file replacement on Gamecube ISOs, specifically Donkey Konga 2. One of the new features DKonga 2 added compared to the original was the "Freestyle Zone", a game mode that just lets you jam on your bongos indefinitely, with no scorekeeping or note track, to whatever backing track you want within the game's song list. If you turn the game music volume all the way down in the options, you can use this mode to perform with just the drum sounds and play along to an external track.

This mode is fun and I've loved screwing around with it in the past simply because of the novelty of DK bongos and the silly sounds, but there are a few things that hold it back from being a viable platform for drum performance, and I plan to fix these by replacing some sound files in the ISO. It will be a solid meme and I would really appreciate some help bringing it to fruition!

The first problem is that the game tracks your hits in Freestyle mode, and on every 50th hit, it will play a random jungle sound effect as a "reward." This may seem charming at first, but hearing a weird monkey screech in the middle of your groove gets old pretty quick.

I was able to fix this by extracting the ISO in Gc-Rebuilder, finding the folders that contain the 50-hit sound effects ("envoice.cbd" and "envoice.chd"), and blanking them out in NotePad and replacing them before rebuilding the new ISO. Now the game tries to play a sound on the 50 hits, but the only thing in the file is silence, so you don't even notice. This makes other parts of the game weirdly lacking in sound effects, but given that this ISO hack is focused solely on Freestyle mode, it's not a concern for me. I can provide some footage as proof of the fix if anyone's curious.

The second problem is that although the bongos are hilarious and fun, it's still weird for me as a drummer to play the bass and hi hat sounds with my hands. On a real drum kit, you have the kick drum and hi hat pedals, leaving your hands open to do more complex rhythms. I fixed this by busting out my old MadCatz Gamecube racing wheel. Donkey Konga recognizes it as a standard Gamecube controller, and I was able to configure it so I can play drum sounds on the gas and brake pedals attached to the steering wheel. They're a far cry from real drum pedals in terms of feel, but I was able to get used to it and my bongo grooves are way smoother now (I can get some footage of the full kit in action if you guys would like).

The third problem, and the one that will be hardest to address, is that the drum sounds in the game are not grouped within bongo sets in a way that is conducive to drum performance. For those who are not aware, in Donkey Konga, you collect coins from clearing songs which you can use to buy custom sound sets for your bongos. Each bongo set has three sounds (left drum, right drum, and clap), and there's a pretty large variety to choose from. A lot of the sounds are just cheesy sound effects that you use to annoy your friends when they actually want to hear the songs you're drumming along to in the main game modes (cats, dogs, barnyard animals, etc.), but there are some usable drum sounds hidden away in the vast library of memes.

However, these usable drum sounds are all scattered across several different bongo sets, and in many cases they're the only sound out of the three that isn't terrible. You only get four controller ports to work with, and although each controller can be set to a different sound set, you still end up basically wasting two sounds just to get a decent snare or hi-hat to work with. As an example, the "Fight" bongo sound set has a slapping/striking noise on the left drum that could pass for a decent dry snare, but the other sounds are a cheesy impact and sword clang sound that are basically worthless.

In the context of my racing wheel set-up, it would be ideal to have a closed hat sound on the left pedal and a bass drum sound on the right. However, the only closed-hat-like sound in the game is on the left drum of Latin Percussion set (you unlock it by having a Donkey Konga 1 save on your memcard with that set purchased), and the other drums of that set are not bass drum sounds. That would mean I would have to buy a whole other racing wheel and take up another controller port just to be able to play the hat and bass drum sounds with my feet, which is not an ideal solution. I intend to fix this by moving the DSP files around within the ISO to create more convenient bongo sets for solo performance.

This project is not without some precedent. A couple years ago, a user named RadioShadow documented a similar project on these forums about importing songs and drum sets over from Donkey Konga 3, which was only released in Japan. I tried getting touch with him over YouTube and his account on here, but he hasn't responded yet. This tidbit was particularly helpful in solving the 50-hit sound problem:

Quote
Going back to this project, I don't think I mentioned that the "drum sets" are different (some were kept) to the ones in the US / EU version.  In fact, they even had more.  I remember last year that the drum sets were kept in the "se" folder.  The ".cbd" file basically contains the sound effects, while the ".chd" contained the necessary data on loading them.  I actually tried replacing some of the Japan drum sets into the US version of "Donkey Konga 2", but they didn't work.

Luckily, I figured out that the byte at location 07 in the ".chd" file needs to match with the file you are replacing.  It was as simply as that.  What I plan to do is replace the drum sets (the ones you buy in the shop) with better drum sets, like the "Star Fox, "Pikmin", Pac-Man" etc.  I'm hoping to figure out how to get the other sound effects unlocked, without having unlocked them unlocked on a "Donkey Konga 1" save.

This confirms what I know from looking at the ISO in GC-Rebuilder. There are 36 "inst" sets in the "se" folder, and each one has a .cbd and .chd file. 18 drum sets in the base game and 18 that can be unlocked with a DKonga 1 save makes 36, so that makes sense, but that means each "inst" set contains the sound files and instructions for all three of the drum sounds; they are not packaged individually, which will make the extraction and replacement of the individual sounds quite tricky. When I open these .cbd and .chd files in NotePad, it's all gibberish, so no help there.

As of right now I still don't know which "inst" sets in the directory correspond to the list of bongos in the game. I could find out the hard way, by blanking out the .cbd and .chd files in notepad one by one and testing the game to see which drum sets end up empty afterward, but that would take a long time and wouldn't solve my problem of figuring out how to extract individual drum sounds from the inst sets.

Anyone have experience with these .cbd and .chd files who could offer some advice or help? The extent of my ISO hacking experience is Super Smash Bros Melee texture mods, and the sound file format for Melee is .ssm, which is apparently way different. I would also like to re-label the drum sets within the game text for clarity, so if anyone knows where to start with text editing, please let me know. Thanks in advance!
« Last Edit: November 20, 2017, 04:14:41 pm by Chandy »

Jorpho

  • Hero Member
  • *****
  • Posts: 3737
  • The cat screams with the voice of a man.
    • View Profile
Re: .cbd/.chd sound file replacement on Donkey Konga 2
« Reply #1 on: November 21, 2017, 12:20:06 am »
When I open these .cbd and .chd files in NotePad, it's all gibberish, so no help there.
I can at least tell you that opening binary files in Windows Notepad tends to be a bad idea.  Notepad will pretty much just display only what it recognizes as ASCII characters and blank out the rest.  This is what you need a hex editor for: a hex editor will show you each and every byte in a file (as well as the ASCII representations, when applicable).

There are many, many different hex editors out there, of course.  I am rather attached to XVI32.

If each .cbd file contains three different sound effects, then if you're lucky they'll all be stuck one after the other.  If you're luckier still, each sound effect will start with the same sequence of bytes that you'll find near the start of the .cbd file.  (For instance, any standard Windows .WAV file starts with the string "RIFF", but there's no reason to expect this game uses standard WAV files.)

Perhaps you could upload a small example of a .cbd and a .chd somewhere?
This depresses me. I feel like a goldfish right now...

Chandy

  • Jr. Member
  • **
  • Posts: 5
    • View Profile
Re: .cbd/.chd sound file replacement on Donkey Konga 2
« Reply #2 on: November 21, 2017, 02:24:24 pm »
Thanks for the hot tip. I downloaded XVI32 and will get to looking through the inst files with it later tonight most likely.

I uploaded the .chd and .cbd files for the first three inst sets in the "se" folder to my Google drive.

I also found out that you can import the .cbd files into audacity as Raw Data. Just go to import -> raw data and when it prompts you, set it to encode as VOX ADPCM. The result will be heavily distorted, but at the very least I was able to make out what sounds are in each inst .cbd and in what order.

The .cbd files always have the sound effects in order of left drum, right drum, and clap (at least that's the way Audacity encodes the file). All the DKonga 1 bongo sets are listed first and have a 1 or 0 as the first digit (except the standard Bongos and NES kits, which are technically not considered DKonga 1 sets by the game since they are unlocked by default but are still brought over from the first game), and all the Donkey Konga 2 sets are listed after. The DKonga 1 sets were all out of order, but the DKonga 2 sets all appear in exactly the same order as they do in the Freestyle Mode options menu.

Spoiler:
Default/DKonga 1 Unlocks
001 - Bongos
101 - NES
102 - Quiz
103 - Electric Drum
104 - Mario
105 - Konga Crew
106 - Toy
107 - Dogs
108 - Laser Space
109 - Car
110 - Barnyard
111 - Whip It
112 - Jungle
113 - Kirby
114 - Cold
115 - Classical Orchestra
116 - Country
117 - Big Band
118 - Latin Percussion
119 - Zelda

DKonga 2 Unlocks
201 - Alarms
202 - Birds
203 - Boing
204 - Party
205 - Drums
206 - Fight
207 - Gigglebox
208 - Gong
209 - Horns
210 - Kittycat
211 - Office
212 - Safari
213 - Ding
214 - Sea Mammals
215 - Symphony
216 - Synth

I guess as a first test, I would want to put the hi-hat and bass drum sounds on the same set to work with my racing wheel set-up. So I want to replace the right drum sound of inst118 (Latin Percussion) with the right drum sound of inst205 (Drums), both of which I have added to the Google drive folder for your perusal. Any ideas on where to start?
« Last Edit: November 21, 2017, 04:11:33 pm by Chandy »

Jorpho

  • Hero Member
  • *****
  • Posts: 3737
  • The cat screams with the voice of a man.
    • View Profile
Re: .cbd/.chd sound file replacement on Donkey Konga 2
« Reply #3 on: November 23, 2017, 01:07:39 am »
Well, when you look at the cdb files in XVI32, you'll notice that each one tends to have two rather conspicuous blank sections.  Those might correspond to the end of the samples.  So, you could try copying the first 2643 bytes of inst205.cbd and pasting it over the start of inst118.cbd and see what that does.  (It's very easy to replace one piece of data with another piece of data that's exactly the same size – it's when lengths change that things start getting very messy.)

I tried doing the import into Audacity as you suggested and it just sounds like noise, even when selecting VOX ADPCM.  Are you changing any of the other options?
This depresses me. I feel like a goldfish right now...

Chandy

  • Jr. Member
  • **
  • Posts: 5
    • View Profile
Re: .cbd/.chd sound file replacement on Donkey Konga 2
« Reply #4 on: November 23, 2017, 04:11:43 am »
Nope, just import as ADPCMs. Sometimes the kits that are just short drum sounds can be hard to pick out with all the distortion, but the goofier ones (like NES) are discernible. Here's an example vid of my process, but there's some severely distorted audio so fair warning if you're a headphone user.

Just to make sure we're not getting it backwards: If the clips appear in left/right/clap in the folders, and I want to swap the right sound of the Latin Percussion Kit (inst118) with the with the right sound of the Drums kit (inst205), that's functionally the same transplanting the left drum sound from 118 (first clip in the .cbd) and then overwriting the left drum sound at the beginning of 205 with those bytes. You said I should paste the start of 205 over 118 and I think maybe you goofed and flipperino'd them. Is it still 2643 bytes if we're transplanting the start/left of 205 to the start of 118?

I'm new to XVI but i assume you would do that by placing your cursor on the first/upperleftmost byte after opening the file, marking a block of <n> = 2643 bytes (decimal), then going to edit -> clipboard -> copy. Open up the destination .cbd, place your cursor on the first/upperleftmost byte and then hit paste? When I do that I get a message saying the block is invalid. Maybe I'm just a being a real silly sam here but I've never used a hex editor before so it never hurts to check.

Could you make me a modified 205.cbd with the transplanted 118.cbd bytes just to check? The one I tried to make just resulted in some very distorted sounds so I'm guessing I screwed up somewhere.
« Last Edit: November 23, 2017, 04:17:23 am by Chandy »

Jorpho

  • Hero Member
  • *****
  • Posts: 3737
  • The cat screams with the voice of a man.
    • View Profile
Re: .cbd/.chd sound file replacement on Donkey Konga 2
« Reply #5 on: November 23, 2017, 10:19:12 pm »
Ah, inst101.cbd is indeed very distinctive.  But I kind of doubt it's actually VOX ADPCM, which is really kind of obscure.  Using signed 8-bit PCM and a sample rate of 22050 kHz produces something of the same length, though it's still heavily distorted.  I suspect someone out there could take a listen and know exactly how it's being incorrectly processed (8000 Hz 8-bit stereo is another possibility), but it sure isn't me.  There could be additional data interspersed throughout the audio that the game uses for its own purposes, and that will have to be filtered out before the audio will play normally, but it's hard to say.

I was suggesting that you copy bytes from 205.cbd to 118.cbd as a test since simply because the first sample in 205.cbd appears to be shorter than the one in 118.cbd.  I don't know what this will do, but experimentation is inevitable here.

I don't use XVI32 very often either, but I used edit -> clipboard -> copy as hex string, then opened up the destination, marked another block of 2643 bytes, used edit -> block delete, and then edit -> clipboard -> paste as hex string.

Let's have a go at Expirebox:
https://expirebox.com/download/ec907a6313c65f1a82d9f3df56ac440f.html
« Last Edit: November 23, 2017, 11:08:16 pm by Jorpho »
This depresses me. I feel like a goldfish right now...

Chandy

  • Jr. Member
  • **
  • Posts: 5
    • View Profile
Re: .cbd/.chd sound file replacement on Donkey Konga 2
« Reply #6 on: November 24, 2017, 02:58:15 am »
For some reason your attachment is a .mod movie file? maybe you erroneously left in a period somewhere or something. or i'm just dumb and missing something.

Thanks for the XVI tips.

Jorpho

  • Hero Member
  • *****
  • Posts: 3737
  • The cat screams with the voice of a man.
    • View Profile
Re: .cbd/.chd sound file replacement on Donkey Konga 2
« Reply #7 on: November 25, 2017, 12:11:29 am »
For some reason your attachment is a .mod movie file? maybe you erroneously left in a period somewhere or something. or i'm just dumb and missing something.
Aye – when I saved the copy, I just added ".mod" to the filename rather than overwriting the original.
This depresses me. I feel like a goldfish right now...

RadioShadow

  • Sr. Member
  • ****
  • Posts: 315
  • Holding the Mega Drive controller
    • View Profile
Re: .cbd/.chd sound file replacement on Donkey Konga 2
« Reply #8 on: December 01, 2017, 05:31:49 pm »
Sorry for the late response.  YouTube's Message system is all over the place and alerts for PMs by Romhacking get sent to my AOL E-mail, while my phone uses my hotmail.  This was because romhacking wasn't even sending e-mails to my hotmail, which didn't help when a file I submitted got denied, and I had no idea why.

I didn't really look into how the files were setup, but that was because I didn't really need to. I suspect there is something that tells the game how many sounds are in there and a bunch of offsets.  I would need to have a dig myself.  I do suggest the file you want to mute is in the "envoice" file (the Euro version has more the other languages).

The other way is to modify the games code to not load the sound.  Again, I would need to have a look at the main.dol.

Chandy

  • Jr. Member
  • **
  • Posts: 5
    • View Profile
Re: .cbd/.chd sound file replacement on Donkey Konga 2
« Reply #9 on: December 03, 2017, 11:38:54 pm »
Sorry for the late response myself, things got kind of busy for me there. Glad to get in touch though, no worries -- I still have accounts attached to my sbcglobal email from sixth grade, lord knows how I'll ever get back into that one.

So yeah, the envoice files were the 50-hit sound effects. I tried wiping the entire .cbd, that just resulted in distortion and random playback of other sounds. Blanking out the .chd just removed all triggers for the sounds in the first place, which leaves other parts of the game oddly silent (for example, the "ready, jam!" greeting when you enter Freestyle mode is gone), but the game is no less playable for it. So that fix worked, thanks for the tip. I would really appreciate your help on this .cbd/.chd investigation if you've got the time. If nothing else I'd love to get my hands on some of those .cbd and .chd files from the Donkey Konga 3 bongo sets that you moved around; some of the sets like tambourine and samba could have some more usable sounds in them that we could bring over and move around.

Here's a proof of concept video demonstrating my set-up and the muting fixes. Please enjoy my Brawl socks and excuse the weak drumming; I had to twist my body weird to get the camera angles I wanted and it impeded my groove a little.

@Jorpho

Thanks for making that .cbd, it sort of worked! The left drum Snare sound of 205 was transplanted onto 118's left drum successfully, but at first listen the drum sound is considerably softer and higher pitched than the vanilla Snare in its original location. See this video as an example. My gut assumption is that this has to do with the .chd "instructions" that accompany the raw sounds and set the conditions for loading the sounds. They might contain parameters that would effect tuning and volume. RadioShadow mentioned something like this in his original thread, if he could comment on that a little further I would appreciate his insight.

Part of me also thinks it actually kinda sounds like the two sounds were layered on top of each other somehow, but maybe I'm just crazy. Maybe it's a stereo audio file and we only copied one mono channel when we did the transplant? But that's just a conspiracy theory. I feel like I can clearly hear the harder attack of the snare but also hear the shaker bite and decay at the end. Turn the volume up and really compare it with the vanilla sounds. Wacky stuff.

If I want to start putting custom sounds in the game then I'll need to figure out exactly what kind of sound files the .cbds actually contain. Any advice on where to start looking into that?
« Last Edit: December 03, 2017, 11:48:22 pm by Chandy »