Donkey Kong: Walking Sound Hack?
-
- Posts: 89
- Joined: Thu Jul 30, 2020 1:05 pm
- Has thanked: 14 times
- Been thanked: 27 times
Donkey Kong: Walking Sound Hack?
Hi everyone,
I'm building a Donkey Kong machine and only just realized the DK core uses samples for the sound. I'm not too much a stickler on this but I would really love the pitch modulated walking sound found on a real board.
Would anyone have the expertise to mod the core to randomly (or sequentially) roll through several different samples recorded from MAME? I think that would go a long way to enhance the experience.
I asked around on twitter if analog/discrete audio would come to MiSTer, and a few people thought it might be too much to implement.
I'm building a Donkey Kong machine and only just realized the DK core uses samples for the sound. I'm not too much a stickler on this but I would really love the pitch modulated walking sound found on a real board.
Would anyone have the expertise to mod the core to randomly (or sequentially) roll through several different samples recorded from MAME? I think that would go a long way to enhance the experience.
I asked around on twitter if analog/discrete audio would come to MiSTer, and a few people thought it might be too much to implement.
Re: Donkey Kong: Walking Sound Hack?
Question is partially how is those sounds played on the original board? Most of these early arcade boards utilize analog sound instead of digital samples.
In DK's case its the various sound effects "jump", "walk" and "stomp" sounds are generated via analog circuitry, the music is digital.
That is why every early console and computer port of Donkey Kong sounded different than the Arcade. As the consoles had to resort using digitally generated sounds.
Playing the audio recorded samples pulled from MAME isn't a good fix ether, as in Mame it's all done in software.
For the DE 10 Nano, you have to get the two sides of the hardware "talk" to each other (the FPGA and the ARM CPU running Linux).
And it not a straight forwards process.
In DK's case its the various sound effects "jump", "walk" and "stomp" sounds are generated via analog circuitry, the music is digital.
That is why every early console and computer port of Donkey Kong sounded different than the Arcade. As the consoles had to resort using digitally generated sounds.
Playing the audio recorded samples pulled from MAME isn't a good fix ether, as in Mame it's all done in software.
For the DE 10 Nano, you have to get the two sides of the hardware "talk" to each other (the FPGA and the ARM CPU running Linux).
And it not a straight forwards process.
It is my great regret that we live in an age that is proud of machines that think and suspicious of people who try to.
-
- Posts: 89
- Joined: Thu Jul 30, 2020 1:05 pm
- Has thanked: 14 times
- Been thanked: 27 times
Re: Donkey Kong: Walking Sound Hack?
The MRA for Donkey Kong currently contains WAVs already, take a look at the big data section:
https://github.com/MiSTer-devel/Arcade- ... t%201).mra
I want to record a bunch of WAVs from MAME, reformat them to what is already in the MRA, then put in code to redirect the lookup of those WAVs so it plays different ones each time (say, 8 different WAVs).
https://github.com/MiSTer-devel/Arcade- ... t%201).mra
I want to record a bunch of WAVs from MAME, reformat them to what is already in the MRA, then put in code to redirect the lookup of those WAVs so it plays different ones each time (say, 8 different WAVs).
-
- Core Developer
- Posts: 300
- Joined: Sun May 24, 2020 6:55 pm
- Has thanked: 5 times
- Been thanked: 154 times
Re: Donkey Kong: Walking Sound Hack?
This should be possible. Let me know if you convert the audio.callanabrown wrote: ↑Wed Oct 06, 2021 9:06 pm The MRA for Donkey Kong currently contains WAVs already, take a look at the big data section:
https://github.com/MiSTer-devel/Arcade- ... t%201).mra
I want to record a bunch of WAVs from MAME, reformat them to what is already in the MRA, then put in code to redirect the lookup of those WAVs so it plays different ones each time (say, 8 different WAVs).
Re: Donkey Kong: Walking Sound Hack?
I bought a mister solely to put it in my newly built DK replica cabinet, and I love it! With that said I totally agree - to get the sounds closer to the original would be a dream come true. I would even consider sponsoring such work on patreon or something similar.callanabrown wrote: ↑Wed Oct 06, 2021 6:34 pm Hi everyone,
I'm building a Donkey Kong machine and only just realized the DK core uses samples for the sound. I'm not too much a stickler on this but I would really love the pitch modulated walking sound found on a real board.
Would anyone have the expertise to mod the core to randomly (or sequentially) roll through several different samples recorded from MAME? I think that would go a long way to enhance the experience.
I asked around on twitter if analog/discrete audio would come to MiSTer, and a few people thought it might be too much to implement.
-
- Posts: 89
- Joined: Thu Jul 30, 2020 1:05 pm
- Has thanked: 14 times
- Been thanked: 27 times
Re: Donkey Kong: Walking Sound Hack?
So from Audacity, there is File->Import->Raw Data, and you can actually point to the text file and it seems to grab it. I've attached it here. I haven't figured out the right parameters yet, maybe someone more familiar with audio can figure it out. 32-bit float at 11025 Hz Mono does seem to give recognizable sounds (ish).
- Attachments
-
- dk.zip
- dk audio extract text
- (18.68 KiB) Downloaded 431 times
-
- Posts: 89
- Joined: Thu Jul 30, 2020 1:05 pm
- Has thanked: 14 times
- Been thanked: 27 times
Re: Donkey Kong: Walking Sound Hack?
OK I did a dumb and was trying to import the text, not the binary data. Turns out the MRA only contains 1 walk sample, while the old MAME sets had 3!
So I found the old MAME sample set which has the 3 walk sounds and put them into the sound ROM. To do this I had to cut off some of the fade out of the sound but I don't think it's noticeable.
The new map is:
walk sample 1 - 0x000 - 0x554
walk sample 2 - 0x555 - 0xAA9
walk sample 3 - 0xAAA - 0xFFF
The rest of the sounds are untouched.
Attached is the binary file. You can import->import raw data at 8-bit unsigned PCM 11025Hz if you want to inspect it.
So at this point, I need someone to try putting this into the core. I see in dkong_wav_sound.v:
parameter Walk_cnt = 13'h07d0; // 10000 - 10FFF
parameter Jump_cnt = 13'h1e20; // 11000 - 12FFF
parameter Foot_cnt = 13'h1750; // 13000 - 14FFF
I'm guessing it should now be:
parameter Walk1_cnt = 13'h0555; //each walk is 0x555 bytes long
parameter Walk2_cnt = 13'h0555;
parameter Walk3_cnt = 13'h0555;
parameter Jump_cnt = 13'h1e20;
parameter Foot_cnt = 13'h1750;
Then the offsets for walk1, walk2 and walk3 have to go near the bottom, and somewhere which offset is chosen should be based on a random choice?
I don't know anything about FPGA programming I'm just using my best guesses. Hope somebody can help!
So I found the old MAME sample set which has the 3 walk sounds and put them into the sound ROM. To do this I had to cut off some of the fade out of the sound but I don't think it's noticeable.
The new map is:
walk sample 1 - 0x000 - 0x554
walk sample 2 - 0x555 - 0xAA9
walk sample 3 - 0xAAA - 0xFFF
The rest of the sounds are untouched.
Attached is the binary file. You can import->import raw data at 8-bit unsigned PCM 11025Hz if you want to inspect it.
So at this point, I need someone to try putting this into the core. I see in dkong_wav_sound.v:
parameter Walk_cnt = 13'h07d0; // 10000 - 10FFF
parameter Jump_cnt = 13'h1e20; // 11000 - 12FFF
parameter Foot_cnt = 13'h1750; // 13000 - 14FFF
I'm guessing it should now be:
parameter Walk1_cnt = 13'h0555; //each walk is 0x555 bytes long
parameter Walk2_cnt = 13'h0555;
parameter Walk3_cnt = 13'h0555;
parameter Jump_cnt = 13'h1e20;
parameter Foot_cnt = 13'h1750;
Then the offsets for walk1, walk2 and walk3 have to go near the bottom, and somewhere which offset is chosen should be based on a random choice?
I don't know anything about FPGA programming I'm just using my best guesses. Hope somebody can help!
- Attachments
-
- dk_sound_mod.zip
- (32.72 KiB) Downloaded 390 times
Re: Donkey Kong: Walking Sound Hack?
I had a thought... is it possible to go together and contribute via patreon or something, to get someone to take this on? To look over the sound effects I mean.
Surely there are plenty willing to pitch in.
Surely there are plenty willing to pitch in.
-
- Posts: 48
- Joined: Thu Feb 11, 2021 10:59 pm
- Has thanked: 27 times
- Been thanked: 31 times
Re: Donkey Kong: Walking Sound Hack?
I've been wanting this sound fix since I got my MiSTers. I'd contribute to a direct fix. A shame when games are so close to being perfect then development goes into hiatus.
[Edit - an even more worthwhile inve$tment would be someone looking at analog audio in general for the sake of many old games. Def something I'd back]
[Edit - an even more worthwhile inve$tment would be someone looking at analog audio in general for the sake of many old games. Def something I'd back]
-
- Posts: 89
- Joined: Thu Jul 30, 2020 1:05 pm
- Has thanked: 14 times
- Been thanked: 27 times
Re: Donkey Kong: Walking Sound Hack?
I'm wondering if this could be solved with an add-on like an RPi running just the audio section of MAME.
If I can find the time I'll try to set up to implement the changes I mentioned, I just don't actually know anything about FPGA or how to set up the environment!
If I can find the time I'll try to set up to implement the changes I mentioned, I just don't actually know anything about FPGA or how to set up the environment!
- jlancaster86
- Posts: 148
- Joined: Sat Jun 27, 2020 1:33 pm
- Has thanked: 130 times
- Been thanked: 35 times
Re: Donkey Kong: Walking Sound Hack?
I've wondered that too: something like mt32-pi, but for analogue audio. It might be an overengineered solution, though—at least for just this game.callanabrown wrote: ↑Tue Nov 16, 2021 12:12 pm I'm wondering if this could be solved with an add-on like an RPi running just the audio section of MAME.
I think I'd be happy with better and more varied samples. Having 6–8 variations of the walking sound taken from a current build of MAME and played randomly would probably sound enough like the real thing.
-
- Posts: 48
- Joined: Thu Feb 11, 2021 10:59 pm
- Has thanked: 27 times
- Been thanked: 31 times
Re: Donkey Kong: Walking Sound Hack?
Although I want it fixed, I don't particularly like the idea of modifying a core (using wav's) to fix a sound issue, even if the original implementation did it. I'd rather a core be implemented 100% correctly true to original hardware and have a solution outside the core.
For example, I'm curious to see if the audio coming out of the MiSTercade (when it arrives) JAMMA edge fixes the issue, but I doubt it if wavs have been hacked in. I assume the JAMMA edge audio is being driven by the core (hardware) which would directly drive output to my cab analog speakers. If the core is running 100% original to hardware spec and the signal is going to the jamma edge, surely I would get correct analog audio?
For example, I'm curious to see if the audio coming out of the MiSTercade (when it arrives) JAMMA edge fixes the issue, but I doubt it if wavs have been hacked in. I assume the JAMMA edge audio is being driven by the core (hardware) which would directly drive output to my cab analog speakers. If the core is running 100% original to hardware spec and the signal is going to the jamma edge, surely I would get correct analog audio?
Re: Donkey Kong: Walking Sound Hack?
Unfortunately, I believe that MiSTer’s FPGA is only implementing the digital sections of the PCB. The analog section is simulated with samples.80sArcadeKid wrote: ↑Wed Nov 17, 2021 12:56 am Although I want it fixed, I don't particularly like the idea of modifying a core (using wav's) to fix a sound issue, even if the original implementation did it. I'd rather a core be implemented 100% correctly true to original hardware and have a solution outside the core.
For example, I'm curious to see if the audio coming out of the MiSTercade (when it arrives) JAMMA edge fixes the issue, but I doubt it if wavs have been hacked in. I assume the JAMMA edge audio is being driven by the core (hardware) which would directly drive output to my cab analog speakers. If the core is running 100% original to hardware spec and the signal is going to the jamma edge, surely I would get correct analog audio?
BitKit FPGA has an interesting/cool digital plus analog section implemented by hardware, but that is only for the analog explosions I believe.
A randomly varied sample solution might work ok on Mister as you likely could use the digital signals that trigger the analog sounds on the PCB to trigger the samples instead.
I do wonder if someone could make an analog sound add on board. That would be a cool solution as the analog section on DK is pretty straight forward. Would love the analog Galaga explosion while we’re at it!
-
- Posts: 89
- Joined: Thu Jul 30, 2020 1:05 pm
- Has thanked: 14 times
- Been thanked: 27 times
Re: Donkey Kong: Walking Sound Hack?
Unfortunately you're misunderstanding the problem, the core isn't generating the analog audio so no arcade add on will do anything to change that. The core currently has 1 WAV for walking, the old style MAME had 3.80sArcadeKid wrote: ↑Wed Nov 17, 2021 12:56 am Although I want it fixed, I don't particularly like the idea of modifying a core (using wav's) to fix a sound issue, even if the original implementation did it. I'd rather a core be implemented 100% correctly true to original hardware and have a solution outside the core.
For example, I'm curious to see if the audio coming out of the MiSTercade (when it arrives) JAMMA edge fixes the issue, but I doubt it if wavs have been hacked in. I assume the JAMMA edge audio is being driven by the core (hardware) which would directly drive output to my cab analog speakers. If the core is running 100% original to hardware spec and the signal is going to the jamma edge, surely I would get correct analog audio?
Re: Donkey Kong: Walking Sound Hack?
You are looking for the analog equivalent of an FPGA, which is an FPAA to handle this properly. They do exist but would need someone with the technical chops to interface with a DE10-Nano.jlancaster86 wrote: ↑Tue Nov 16, 2021 12:55 pmI've wondered that too: something like mt32-pi, but for analogue audio. It might be an overengineered solution, though—at least for just this game.callanabrown wrote: ↑Tue Nov 16, 2021 12:12 pm I'm wondering if this could be solved with an add-on like an RPi running just the audio section of MAME.
I think I'd be happy with better and more varied samples. Having 6–8 variations of the walking sound taken from a current build of MAME and played randomly would probably sound enough like the real thing.
I saw one for sale but it’s a bit pricey and has been in “restocking” status forever.
https://zrna.org/shop
I am sure there are other FPAAs that actually can be found. I am in the same boat that I want arcade perfect sounds because only the sounds really hold the MiSTer back on arcade games that ran analog sound components.
-
- Top Contributor
- Posts: 1311
- Joined: Mon Jul 06, 2020 9:37 pm
- Has thanked: 634 times
- Been thanked: 308 times
Re: Donkey Kong: Walking Sound Hack?
My feeling is that an FPAA is not necessary. The beta Atari 7800 core has perfect Atari 2600 sound (not 100% sure it is analog on the Atari, but it is just an example). Mame has perfect sound, etc. These are all digital systems creating perfect analog sound. What needs to happen is to recreate the analog sound using digital similar to how it is done with VST's for old keyboard instruments and how Mame does it. If you know what the output of the analog is supposed to be, it can be reproduced digitally. We just need to create the FPGA logic to do the same thing. It will be cleaner and more precise than the original, and filters can be added to make it sound more analog.
-
- Posts: 48
- Joined: Thu Feb 11, 2021 10:59 pm
- Has thanked: 27 times
- Been thanked: 31 times
Re: Donkey Kong: Walking Sound Hack?
Really feels like a missing peice of the ambition of the MiSTer project to accuratley record old PCB hardware. So going by my interpretation of this conversation, we would need a new FPGA/FPAA platform (or analog hardware addon?) to really achieve 100% accuracy on both the digital and analog aspects of a PCB.
In the meantime doing what software emulation does is the current answer?
In the meantime doing what software emulation does is the current answer?
-
- Top Contributor
- Posts: 1311
- Joined: Mon Jul 06, 2020 9:37 pm
- Has thanked: 634 times
- Been thanked: 308 times
Re: Donkey Kong: Walking Sound Hack?
Take what I am saying with a grain of salt, but they are educated guesses. My guess is that the MiSTer itself is completely capable of producing accurate sound of the original analog hardware with proper coding.
Re: Donkey Kong: Walking Sound Hack?
If someone had the skills and was really in love with DK, they could do it, but bringing analog to the digital world is pretty complex. Multiple randomized, well sampled samples for the analog sounds is probably the answer for now.
Re: Donkey Kong: Walking Sound Hack?
Pong is not analog, it just has a primitive transistor-transistor logic design lacking integrated circuits instead of using a microprocessor like many post-1975 arcade games. In fact Nolan Bushnell used to falsely claim back in the day that Magnavox Odyssey was an analog device compared to fully digital Pong to refute the notion that Atari broke Magnavox's patents. Even Odyssey built around dated 1960s components was already digital.
-
- Top Contributor
- Posts: 1321
- Joined: Thu Jun 11, 2020 2:31 am
- Has thanked: 15 times
- Been thanked: 213 times
Re: Donkey Kong: Walking Sound Hack?
Quite correct, my apologies - I got the arcade variant mixed up with it's o-scope predecessor (which was indeed analog). Sorry about that!TLPD-AVW wrote: ↑Sat Nov 20, 2021 2:58 amPong is not analog, it just has a primitive transistor-transistor logic design lacking integrated circuits instead of using a microprocessor like many post-1975 arcade games. In fact Nolan Bushnell used to falsely claim back in the day that Magnavox Odyssey was an analog device compared to fully digital Pong to refute the notion that Atari broke Magnavox's patents. Even Odyssey built around dated 1960s components was already digital.
But to your point, Donkey Kong's discrete audio is also digital, so... LOL
Re: Donkey Kong: Walking Sound Hack?
Does anyone know someone that might consider taking this on, if we are a few chipping in for the time and effort?
I realise that requests like this are common, and I really don’t want to come across as ungrateful but it would be amazing if one, two or all samples could be looked over.
I realise that requests like this are common, and I really don’t want to come across as ungrateful but it would be amazing if one, two or all samples could be looked over.
- pgimeno
- Top Contributor
- Posts: 709
- Joined: Thu Jun 11, 2020 9:44 am
- Has thanked: 277 times
- Been thanked: 226 times
Re: Donkey Kong: Walking Sound Hack?
I've made this, which I don't know if it will help.
Includes patch in `git am` format. The .MRA changes are not in the patch though.
(Edit: new version fixes an inconsistency with tabs and spaces in the patch, but the core is unchanged)
Includes patch in `git am` format. The .MRA changes are not in the patch though.
(Edit: new version fixes an inconsistency with tabs and spaces in the patch, but the core is unchanged)
- Attachments
-
- DKsndfixv2.zip
- (1.04 MiB) Downloaded 406 times
-
- DKsndfix.zip
- (1.04 MiB) Downloaded 360 times
Converters I've written: Floppy DIM/FDI/FDD/HDM to D88, D88 to XDF, Tape SVI 318/328 CAS to WAV
- pgimeno
- Top Contributor
- Posts: 709
- Joined: Thu Jun 11, 2020 9:44 am
- Has thanked: 277 times
- Been thanked: 226 times
Re: Donkey Kong: Walking Sound Hack?
Now that I have more time to elaborate... The above is what can be done with a sample-based approach using the old MAME's sample set. I'm not familiar with the original Donkey Kong; in my vicinity there were mostly Crazy Kong bootlegs. But from playing a bit with MAME it looks to me like the apparent cycling was mostly sequential, so that's how I've implemented it. If those samples aren't good enough, another approach would be to record the sounds using the output of MAME itself. If even that is not enough, it means that using samples isn't the way to go.
I've looked into the MAME sources and it implements the analog circuitry down to the resistor/capacitor level, see https://github.com/mamedev/mame/blob/ma ... g.cpp#L412. MAME seems to rely a lot on macros which I haven't looked into, so I don't know how complex they are; anyway it would certainly be possible to do the same with the FPGA, but it would also certainly not be a trivial task. It's not one I'd take for sure. The Cyclone V has multiplier units, but no division units and I believe no floating-point either, so everything needs to be done with fixed-point integer maths.
To install the above patch, you need to:
I've looked into the MAME sources and it implements the analog circuitry down to the resistor/capacitor level, see https://github.com/mamedev/mame/blob/ma ... g.cpp#L412. MAME seems to rely a lot on macros which I haven't looked into, so I don't know how complex they are; anyway it would certainly be possible to do the same with the FPGA, but it would also certainly not be a trivial task. It's not one I'd take for sure. The Cyclone V has multiplier units, but no division units and I believe no floating-point either, so everything needs to be done with fixed-point integer maths.
To install the above patch, you need to:
- remove the DonkeyKong_xxxxxx.rbf from the MiSTer's /media/fat/_Arcade/cores/
- copy Arcade-DonkeyKong.rbf extracted from the above zip file to that location
- copy DKsndfix.mra from the zip file to /media/fat/_Arcade/ and optionally rename it to something more sensible
Converters I've written: Floppy DIM/FDI/FDD/HDM to D88, D88 to XDF, Tape SVI 318/328 CAS to WAV
-
- Posts: 89
- Joined: Thu Jul 30, 2020 1:05 pm
- Has thanked: 14 times
- Been thanked: 27 times
Re: Donkey Kong: Walking Sound Hack?
Just tried it out! It definitely sounds better. I checked an old MAME video on YouTube and indeed it sounds sequential. I think it's still a bit off from a real board, but it's a big improvement, thanks for making this happen!!