Donkey Kong: Walking Sound Hack?

callanabrown
Posts: 85
Joined: Thu Jul 30, 2020 1:05 pm
Has thanked: 14 times
Been thanked: 21 times

Re: Donkey Kong: Walking Sound Hack?

Unread post by callanabrown »

I'm also an EE.

Look at the DK schematic, TKG4-14-CPU page 3. In the bottom right, you'll see an NE556 surrounded by a lot of analog buffers, resistors, transistors, capacitors. These make sounds directly like a Jupiter 8, and are mixed in with the digital sounds (from the MB8884 after the DAC).
https://arcarc.xmission.com/PDF_Arcade_ ... TKG-4).pdf

The Fantom (I had a Fantom G6) is PCM sample based. Everything it can do is based on its giant WAV memory.

Roland's Aira line use ACB (analog circuit behaviour) which is basically what MAME uses, and what we should be talking about for DK.

Here's the MAME audio driver for DK:
https://github.com/mamedev/mame/blob/d3 ... /dkong.cpp

You will notice that it starts off with a list of nodes and then the exact components from the schematic. MAME itself has what is basically an entire SPICE solver that can simulate the entire audio schematic continuously, which requires a lot of CPU power. Maybe you remember using Multisim or something back in school where doing a transient analysis of the first 1/10th of a second required 10 or more seconds to solve.

Info on how analog audio simulation was only added in in MAME 0.224 about a year ago:
https://www.reddit.com/r/emulation/comm ... s_and_70s/

Elsewhere in the forums I've been advocating for the use of the new MT32-Pi-Lite official board (which attaches to a Rasp Pi) to be used to basically run MAME's audio drivers and pipe the sound back to the DE10 to be mixed in, similar to how MT32 does it. So far no experts have weighed in on that.
thorr
Top Contributor
Posts: 1100
Joined: Mon Jul 06, 2020 9:37 pm
Has thanked: 537 times
Been thanked: 252 times

Re: Donkey Kong: Walking Sound Hack?

Unread post by thorr »

Thanks, I will check this out. My Fantom is the new one with Zen-core. It is not PCM (but it can do PCM).
dmckean
Posts: 307
Joined: Sat Jan 16, 2021 7:03 am
Has thanked: 387 times
Been thanked: 95 times

Re: Donkey Kong: Walking Sound Hack?

Unread post by dmckean »

I think you guys should trust the MAME analog audio for making comparisons.

The team that created that audio code worked on it for close to a decade and had full access to all the original golden age cabinets (they even flew across the world at times to check out bootleg versions and other rare cabinets). They took into account the aging components and other factors. I'm not even sure it would be possible to duplicate their effort again today.
dshadoff
Core Developer
Posts: 534
Joined: Sun May 24, 2020 9:30 pm
Has thanked: 19 times
Been thanked: 141 times

Re: Donkey Kong: Walking Sound Hack?

Unread post by dshadoff »

My issue with "trusting" MAME sounds (or anything) is that each board/system/module is built to a different standard, and there really doesn't seem to be a "known issues/limitations" list anywhere. Trusting MAME has gotten many an emulator/core author in trouble in the past because of bad axiomatic thinking.

Perhaps Donkey Kong is in a much better state than other boards, as it sounds like significant effort has gone into more research on these specific items.

As was mentioned earlier in the thread, if MAME can programmatically produce a more accurate simulated output, so can MiSTer. It's more a question of who is willing to implement it in the core.
dmckean
Posts: 307
Joined: Sat Jan 16, 2021 7:03 am
Has thanked: 387 times
Been thanked: 95 times

Re: Donkey Kong: Walking Sound Hack?

Unread post by dmckean »

Analog sound was a project within a project for MAME with it's own team working on it. It was all recreated at the circuit level, unlike most of the other code in MAME.

I'm just saying that trusting it is going to be easier than the alternative, which is duplicating that entire effort which we know took them almost a decade.
thorr
Top Contributor
Posts: 1100
Joined: Mon Jul 06, 2020 9:37 pm
Has thanked: 537 times
Been thanked: 252 times

Re: Donkey Kong: Walking Sound Hack?

Unread post by thorr »

I agree that using the Mame source code as a resource makes total sense given the amount of effort that went into it. The big question in my mind at this point is how much processing power does it take and how powerful is the FPGA compared to the Arm side of the MiSTer. I have compiled the newer versions of Mame on my Raspberry Pi 3 (and maybe also the 4 but I don't remember) specifically for the new Donkey Kong sound and when I played the game, it was clear that the Pi was not fast enough. This led me to a short time of using a PC instead of the Pi and eventually I discovered the MiSTer and I haven't really touched Mame since, except for a few games that are not on the MiSTer. I don't know how the Arm compares to a Pi 3, but only a subset of the Mame code would be needed. I suspect that the relatively massive FPGA in the MiSTer could be programmed in a way to specifically handle the Donkey Kong math very efficiently using more of the FPGA to get the job done quicker. As I mentioned previously, a lower sample rate could be used if the computing power requirements are too high for perfect sound. If the Arm side of the MiSTer is used, then the Mame code could be almost used directly, but I don't know if the Arm side is fast enough, and it is using a computer instead of dedicated FPGA so it is theoretically less efficient. Clock speed is also a major difference between the FPGA side and the Arm side, but again the FPGA can do things in parallel giving it a massive potential advantage.
rcade
Posts: 100
Joined: Wed May 27, 2020 7:57 pm
Been thanked: 13 times

Re: Donkey Kong: Walking Sound Hack?

Unread post by rcade »

For those that say "it should be possible. someone should just do it."

That is a sign that maybe this is a place for you to insert yourself- you should research it and see about implementing it. Maybe you will discover why it hasn't been done before. :)

That does NOT mean try to nominate someone else to do it for you. That is not the right approach. This is done as a hobby only. Nobody wants another job.

Modeling analog behavior requires heavy math and a CPU which an FPGA does not have unless you build one for it to use.
The MiSTer does have the ARM you can use as a coprocessor, but that is a very advanced programming project to interface that to a core.
akeley
Top Contributor
Posts: 1303
Joined: Mon May 25, 2020 7:54 pm
Has thanked: 416 times
Been thanked: 399 times

Re: Donkey Kong: Walking Sound Hack?

Unread post by akeley »

rcade wrote: Tue Feb 08, 2022 2:49 pm For those that say "it should be possible. someone should just do it."
Has anybody actually said that though?

Also, it's not really always "just a hobby" anymore, not in the high-yielding Patreons era. That does not of course mean that anybody, not even patrons, can demand anything or expect their requests and wishes to be fulfiled, but it's not quite like the old days either. If people here want to raise a bounty for a specific issue and somebody capable might want to take it up, then it's an entirely different cup of tea.
rhester72
Top Contributor
Posts: 1107
Joined: Thu Jun 11, 2020 2:31 am
Has thanked: 13 times
Been thanked: 169 times

Re: Donkey Kong: Walking Sound Hack?

Unread post by rhester72 »

@rcade nobody has said OR implied that to the best of my knowledge, but it's quite correct that it ABSOLUTELY _can_ be done in the same manner it was for MAME, as I pointed out over a year ago. Using digital technology to simulate discrete analog components is nothing new. Just because I, for example, don't have the skill to do so doesn't mean it can't be done, and if it hasn't been done due to lack of interest, lack of time, lack of skill, lack of funding, or lack of giving a shit...that's a whole other thing that I personally won't be getting into as too painfully obvious to mention. There are, however, those 'experts' on the forum that are POSITIVE it *can't be done* because analog != digital, and I figure they are owed having their ignorance dispelled, at least.

For those who say "yeah, but MAME has it easier, it's software!!!"...no. Just no. MAME's discrete simulation actually has the deck stacked against it because it's necessarily serial and run in-line with all the other emulation code in a single thread. Discrete components, of course, have the advantage of (potential) parallelism, where FPGA truly shines and the performance bottleneck is no longer a factor. Now as to whether FPGA gating on the DE-10 specifically is fast enough to execute the Spice-like simulation, that's a whole other question...and one I'm ill-equipped to answer, as is anyone else until it's tried someday.

#rant off
thorr
Top Contributor
Posts: 1100
Joined: Mon Jul 06, 2020 9:37 pm
Has thanked: 537 times
Been thanked: 252 times

Re: Donkey Kong: Walking Sound Hack?

Unread post by thorr »

I think we all or most of us are on the same page now, where we weren't before. Short-term mission accomplished. Hopefully someday, someone with the skills and interest will give this an attempt. It would be an amazing accomplishment and much appreciated.
Modeling analog behavior requires heavy math and a CPU which an FPGA does not have unless you build one for it to use.
The MiSTer does have the ARM you can use as a coprocessor, but that is a very advanced programming project to interface that to a core.
Exactly.
thorr
Top Contributor
Posts: 1100
Joined: Mon Jul 06, 2020 9:37 pm
Has thanked: 537 times
Been thanked: 252 times

Re: Donkey Kong: Walking Sound Hack?

Unread post by thorr »

This is interesting: https://opencores.org/projects/fpu designed to go with this: https://opencores.org/projects/or1k_old

Basically what is really needed is to replace the analog circuits with digital ones that produce the analog signal that can be mixed with the other digital sound. A black box with inputs and outputs. How this gets done in FPGA is very flexible but requires math components obviously. Needing some kind of CPU is questionable, but there needs to be something to manage everything. I haven't really thought it through so I am just sort of thinking out loud.

Also, I was thinking that LUT's (lookup tables) might be an option since the same calculations might be used over and over again. Just pre-calculate everything and store the results for reference later, or even create new samples using the Mame code but for each specific sound that might ever happen that can be mixed together inside the MiSTer as the sounds are called upon.
User avatar
pgimeno
Top Contributor
Posts: 669
Joined: Thu Jun 11, 2020 9:44 am
Has thanked: 246 times
Been thanked: 208 times

Re: Donkey Kong: Walking Sound Hack?

Unread post by pgimeno »

This post from the classic synths thread might give ideas, or at least raise the hopes: viewtopic.php?p=37414#p37414
thorr
Top Contributor
Posts: 1100
Joined: Mon Jul 06, 2020 9:37 pm
Has thanked: 537 times
Been thanked: 252 times

Re: Donkey Kong: Walking Sound Hack?

Unread post by thorr »

The article linked there looks promising!: https://www.researchgate.net/publicatio ... it_Designs
shertz
Posts: 145
Joined: Sun May 24, 2020 8:12 pm
Has thanked: 14 times
Been thanked: 25 times

Re: Donkey Kong: Walking Sound Hack?

Unread post by shertz »

Don't want to let this thread die. The DK core is so close to being perfect but there's still some sound issue to wrinkle out.
mhartman
Posts: 96
Joined: Fri Jul 03, 2020 1:26 pm
Has thanked: 46 times
Been thanked: 20 times

Re: Donkey Kong: Walking Sound Hack?

Unread post by mhartman »

I just manually updated to get the walking sound upgrade working. It really sounds good! Thank you.
shertz
Posts: 145
Joined: Sun May 24, 2020 8:12 pm
Has thanked: 14 times
Been thanked: 25 times

Re: Donkey Kong: Walking Sound Hack?

Unread post by shertz »

Another sound issue I've noticed. The 'boom' sound when mario gets hit by an object or when DK is beating his chest is missing when you are walking. If you are standing still you can hear it. The original arcade game you can always hear it.
jopdorp
Core Developer
Posts: 20
Joined: Tue Mar 29, 2022 10:07 pm
Has thanked: 14 times
Been thanked: 61 times

Re: Donkey Kong: Walking Sound Hack?

Unread post by jopdorp »

I'd like to have a look at the DK analog sound implementation.
It'll probably be an analog modeled sound, because a SPICE-like simulation is not realistic to implement as of now.

I've tried the LiveSPICE project that I had to port to Linux, but it's not fast enough on a raspberry pi 3b to simulate an entire analog sound PCB, just a couple of elements, wasn't helpful.

About the mame sounds system, I know there are two versions that do some kind of element-wise simulation of the electronics.

One of them is called "discrete" sound, and they say it sounds good. I haven't personally heard it. But if it's really that good, it might be worth trying to port it, or even to make a custom on-fpga chip for it to be able to run it fast enough. I can do some investigation.

The other one I'm not sure what's it's called, but that's what's used in their battlezone/red baron emulators, and it is not accurate.
Some sounds are literally wrong and the others are very low fidelity, kind of like an 8 bit version of the sounds.

One way or another, it would be nice to find some way to make implementation of analog sound in MiSTer easier.
jopdorp
Core Developer
Posts: 20
Joined: Tue Mar 29, 2022 10:07 pm
Has thanked: 14 times
Been thanked: 61 times

Re: Donkey Kong: Walking Sound Hack?

Unread post by jopdorp »

Well, I've started on MiSTer Discrete.
https://github.com/jopdorp/MiSTer-Discrete

It's not finished, but the Donkey Kong walk sound is implemented and alive!

You can hear the output from my dk_walk core here:
https://github.com/jopdorp/MiSTer-Discr ... v?raw=true

Still have to integrate it with the Donkey Kong core
Robgus
Posts: 90
Joined: Sun Feb 21, 2021 3:52 pm
Has thanked: 62 times
Been thanked: 5 times

Re: Donkey Kong: Walking Sound Hack?

Unread post by Robgus »

Amazing! Thank you for taking this on!
User avatar
HerrBerzerk
Posts: 232
Joined: Tue Feb 01, 2022 1:45 pm
Has thanked: 96 times
Been thanked: 30 times

Re: Donkey Kong: Walking Sound Hack?

Unread post by HerrBerzerk »

As I understand it, this is fantastic. Do you create subsystems for analog sounds, like the 6 Sounds in Asteroids or the Galaxian background or explosion sound and they can get linked to the cores then? While all the new arcade cores work fine, especially the classic arcade cores all need some love.
jopdorp
Core Developer
Posts: 20
Joined: Tue Mar 29, 2022 10:07 pm
Has thanked: 14 times
Been thanked: 61 times

Re: Donkey Kong: Walking Sound Hack?

Unread post by jopdorp »

I'm still integrating the walk sound with the DK core right now, then I think I'll do another another iteration on the circuit simulation, see if I can implement a general circuit solver. to solve everything except capacitors, inductors and opamps, which are implemented as high/low pass filters.

Then I'll finish the DK core first.
After finishing the first core, others should become considerably less work.

I like Asteroids, so that might be a good contender for the next one :)
thorr
Top Contributor
Posts: 1100
Joined: Mon Jul 06, 2020 9:37 pm
Has thanked: 537 times
Been thanked: 252 times

Re: Donkey Kong: Walking Sound Hack?

Unread post by thorr »

Yes! Thanks so much. I knew it could be done. Thanks for proving it for all of our benefits! ;-)
jopdorp
Core Developer
Posts: 20
Joined: Tue Mar 29, 2022 10:07 pm
Has thanked: 14 times
Been thanked: 61 times

Re: Donkey Kong: Walking Sound Hack?

Unread post by jopdorp »

The walk sound is integrated into the DK core.

The release pullrequest is pending, but you can already download the build here:
https://github.com/jopdorp/Arcade-Donke ... 220429.rbf

It is great to see so much enthusiasm around the analog sounds of these arcades!
Persuaded by the enthusiasm here and on the Discord, I've created a Patreon, to help me be able to spend more time on these projects.

https://www.patreon.com/jopdorp

If you like the work, and want me to support me to keep on building these analog sound implementations, become a patron :)
Robgus
Posts: 90
Joined: Sun Feb 21, 2021 3:52 pm
Has thanked: 62 times
Been thanked: 5 times

Re: Donkey Kong: Walking Sound Hack?

Unread post by Robgus »

jopdorp wrote: Sat Apr 30, 2022 8:12 am The walk sound is integrated into the DK core.

The release pullrequest is pending, but you can already download the build here:
https://github.com/jopdorp/Arcade-Donke ... 220429.rbf

It is great to see so much enthusiasm around the analog sounds of these arcades!
Persuaded by the enthusiasm here and on the Discord, I've created a Patreon, to help me be able to spend more time on these projects.

https://www.patreon.com/jopdorp

If you like the work, and want me to support me to keep on building these analog sound implementations, become a patron :)
This is truly amazing, a dream come true. Will become a patron today!
User avatar
HerrBerzerk
Posts: 232
Joined: Tue Feb 01, 2022 1:45 pm
Has thanked: 96 times
Been thanked: 30 times

Re: Donkey Kong: Walking Sound Hack?

Unread post by HerrBerzerk »

Also became Patreon, we need someone who cares for those old arcade cores that all have wrong sounds like Galaxian, Frogger and many many more.
mario64
Posts: 119
Joined: Sun May 24, 2020 6:50 pm
Has thanked: 18 times
Been thanked: 10 times

Re: Donkey Kong: Walking Sound Hack?

Unread post by mario64 »

jopdorp wrote: Sat Apr 30, 2022 8:12 am The walk sound is integrated into the DK core.

The release pullrequest is pending, but you can already download the build here:
https://github.com/jopdorp/Arcade-Donke ... 220429.rbf

It is great to see so much enthusiasm around the analog sounds of these arcades!
Persuaded by the enthusiasm here and on the Discord, I've created a Patreon, to help me be able to spend more time on these projects.

https://www.patreon.com/jopdorp

If you like the work, and want me to support me to keep on building these analog sound implementations, become a patron :)
This release doesn't work at all for me. I'm using the 4/29 rbf along with the included mra. Upon launch the game just sits there glitching and playing the mario death sound over and over.
jopdorp
Core Developer
Posts: 20
Joined: Tue Mar 29, 2022 10:07 pm
Has thanked: 14 times
Been thanked: 61 times

Re: Donkey Kong: Walking Sound Hack?

Unread post by jopdorp »

mario64 wrote: Sat Apr 30, 2022 2:47 pm
jopdorp wrote: Sat Apr 30, 2022 8:12 am The walk sound is integrated into the DK core.

The release pullrequest is pending, but you can already download the build here:
https://github.com/jopdorp/Arcade-Donke ... 220429.rbf

It is great to see so much enthusiasm around the analog sounds of these arcades!
Persuaded by the enthusiasm here and on the Discord, I've created a Patreon, to help me be able to spend more time on these projects.

https://www.patreon.com/jopdorp

If you like the work, and want me to support me to keep on building these analog sound implementations, become a patron :)
This release doesn't work at all for me. I'm using the 4/29 rbf along with the included mra. Upon launch the game just sits there glitching and playing the mario death sound over and over.
Thank you for reporting this, do you have any more information for me to reproduce?
What addons are you using, power adapter, does it also happen when you don't have any expansion boards and peripherals attached?
mhartman
Posts: 96
Joined: Fri Jul 03, 2020 1:26 pm
Has thanked: 46 times
Been thanked: 20 times

Re: Donkey Kong: Walking Sound Hack?

Unread post by mhartman »

Very cool. Galaga explosion sound is another one in high demand. Nice work!
User avatar
pgimeno
Top Contributor
Posts: 669
Joined: Thu Jun 11, 2020 9:44 am
Has thanked: 246 times
Been thanked: 208 times

Re: Donkey Kong: Walking Sound Hack?

Unread post by pgimeno »

Works quite well for me.

There's a very minor bug, that you could argue is more of a style thing than a bug. In this change:

Code: Select all

-	.I_SW(I_DKJR ? 3'b000 : W_6H_Q[2:0])
+	.I_SW(I_DKJR ? 3'b000 : W_6H_Q[2:1])
the 3'b000 should have become a 2'b00. It won't make a difference; I'm not sure if Quartus will be issuing a warning for it but if it does, it's an easily avoidable warning :)

I'd also check how is W_6H_Q[0] generated, to see if it needs cleanup.

It's a bit confusing that the patch is already committed to master, but the PR is still open. What happened there?
lagomorph
Posts: 15
Joined: Mon Jul 06, 2020 2:18 pm
Has thanked: 2 times
Been thanked: 1 time

Re: Donkey Kong: Walking Sound Hack?

Unread post by lagomorph »

I commented on the original PR that got merged. I'm in the camp that was slightly bothered by the samples in that they can't reproduce the random nature of how the walking sound is actually produced. I'd think though that anyone sensitive enough to want an improvement in the existing walking sound would not be convinced that this is an improvement. It sounds too high pitched and squeaky compared to the original. The existing samples are closer to correct. I'm not sure why it sounds so off based on the modeling approach taken which is closer to what actually happens and I haven't seen much negative feedback. I hope everyone concerned can try it out for themselves and sanity check my assessment before this gets released.
Post Reply