High pitch explosions for Xevious and Galaga
High pitch explosions for Xevious and Galaga
I've noticed that in Xevious both the player and bomb explosions seem to play at too high a speed. In Galaga there appears to be a similar issue with the player explosion. In MAME with the same ROMs they seem ok.
Re: High pitch explosions for Xevious and Galaga
Looks like the explosions are generated with the 54xx. Researching a bit it looks like the CPUs are supposed to run at 3072000Hz and the 54xx at half that. Perhaps the 54xx is running at the CPUs speed instead making the explosions fast? That would sound about right at least.
Re: High pitch explosions for Xevious and Galaga
having a quick look at the galaga code, it time slices an 18Mhz clock across 6 zones, each CPU uses 1 slice, so 3Mhz equivalent and the 54xx / mb88 is only enabled every 8th occurence of slice 0 - so 375Khz
Re: High pitch explosions for Xevious and Galaga
Thanks for looking macro. I see that now as cs54xx_ena_div is three bits and is incremented once each time through the six slots. This must work differently than it does in MAME as the 54xx runs at 1/2 the CPU speed there and sounds correct. I'd expect it to be slow on the MiSTer at 1/8 CPU and not fast.
Re: High pitch explosions for Xevious and Galaga
Just double checked Mame, and it seems the clock passed to the MB54xx should be 1.5Mhz (half the CPU clock), but then that clock is divided by 6 in the actual MB54xx code - so it should be 1/12 of the master clock overall
so at the moment it is 1/8 * 3Mhz = 375Khz
but it should be 1/2 * 1/6 * 3Mhz = 250khz
so not quite half, but definitely lower. change the 3 bit counter to 4 bit and activate / zero counter when it reaches '1011' (11!) instead.
so code changes to (something like)
from:
if slot = "000" and cs54xx_ena_div = "000" then cs54xx_ena <= '1'; end if;
to:
if slot = "000" and cs54xx_ena_div = "1011" then
cs54xx_ena_div <= "0000";
cs54xx_ena <= '1';
end if;
and don't forget to knock the signal up to 3 downto 0
Have made the change on my copy, and it still makes noises in the right place, whether it has slowed it sufficiently I'll leave to others to check.
I attached the changed file to the issue in github, couldn't see how I could do a pull request for it (not that used to github!)
so at the moment it is 1/8 * 3Mhz = 375Khz
but it should be 1/2 * 1/6 * 3Mhz = 250khz
so not quite half, but definitely lower. change the 3 bit counter to 4 bit and activate / zero counter when it reaches '1011' (11!) instead.
so code changes to (something like)
from:
if slot = "000" and cs54xx_ena_div = "000" then cs54xx_ena <= '1'; end if;
to:
if slot = "000" and cs54xx_ena_div = "1011" then
cs54xx_ena_div <= "0000";
cs54xx_ena <= '1';
end if;
and don't forget to knock the signal up to 3 downto 0
Have made the change on my copy, and it still makes noises in the right place, whether it has slowed it sufficiently I'll leave to others to check.
I attached the changed file to the issue in github, couldn't see how I could do a pull request for it (not that used to github!)
Re: High pitch explosions for Xevious and Galaga
Yeah, I actually got motivated enough this morning to try and finally get a dev environment on my Mac so I could play around. I ended up with a Docker solution that works. I decided to see what would happen if I simply cut the speed in half by making cs54xx_ena_div four bits. With that it still sadly had less low end than MAME but I could tell it played longer (too long). I recorded and measured each. MAME was about 2.7 seconds, The MiSTer was originally about 1.8 seconds, and did indeed stretch to about 3.6 seconds with my modified version.
I believe you're right with the speed although I think you want a value of 1100 instead of 1011 for the check of cs54xx_ena_div. Using that I get a play length of about 2.7 seconds or the same as MAME.
It still doesn't sound right to me so there must be more to it. It's better though and almost certainly the right speed at least.
I'm going to try this same thing with Xevious. It has two explosions and they both sound even worse than Galaga to me.
I believe you're right with the speed although I think you want a value of 1100 instead of 1011 for the check of cs54xx_ena_div. Using that I get a play length of about 2.7 seconds or the same as MAME.
It still doesn't sound right to me so there must be more to it. It's better though and almost certainly the right speed at least.
I'm going to try this same thing with Xevious. It has two explosions and they both sound even worse than Galaga to me.
-
- Core Developer
- Posts: 547
- Joined: Sun May 24, 2020 9:30 pm
- Has thanked: 20 times
- Been thanked: 145 times
Re: High pitch explosions for Xevious and Galaga
I have to ask this question, because it so often turns up as being relevant:
- While the MiSTer core may not be correct, how can you be sure that MAME is correct ?
It would be ideal to corroborate with an actual arcade board.
MAME generally gets the major points correct, and has been an excellent resource over the decades for general information, but is quite often incorrect on the finer details - particularly those which may have been put into their emulation in the early days, and just assumed to be correct.
- While the MiSTer core may not be correct, how can you be sure that MAME is correct ?
It would be ideal to corroborate with an actual arcade board.
MAME generally gets the major points correct, and has been an excellent resource over the decades for general information, but is quite often incorrect on the finer details - particularly those which may have been put into their emulation in the early days, and just assumed to be correct.
Re: High pitch explosions for Xevious and Galaga
That's a good point and I'm not absolutely sure it's correct. About the most I can say is that MAME sounds right to my ears but that's subjective of course. Looks like the MAME 54xx simulation code came along later and originally they used samples. At least their 54xx sounds pretty close to the samples.
The MiSTer cores still don't sound quite as good as those samples so there's more going on than just the speed. The samples have much more bass.
The MiSTer cores still don't sound quite as good as those samples so there's more going on than just the speed. The samples have much more bass.
-
- Core Developer
- Posts: 547
- Joined: Sun May 24, 2020 9:30 pm
- Has thanked: 20 times
- Been thanked: 145 times
Re: High pitch explosions for Xevious and Galaga
There's a pretty good overlap between the MiSTer community and arcade board owners; perhaps somebody owns this board and can perform some sort of comparison - ideally, actual data acquisition via oscilloscope or recordings.
Re: High pitch explosions for Xevious and Galaga
On a open source "game recreation" project I used to be involved with, Youtube videos were sometimes sourced for reference (source of truth). A quick search on Youtube, for xevious arcade and for galaga arcade, shows some videos of people playing on arcade cabs (possibly original h/w). It might be worth taking a quick look there for comparison.
Re: High pitch explosions for Xevious and Galaga
If anyone needs a sample from an original Galaga board let me know. I love the Galaga version on MiSTer, but the explosion is so off from the original (it is a bit disconcerting). I would be awesome to get it corrected.
-
- Core Developer
- Posts: 300
- Joined: Sun May 24, 2020 6:55 pm
- Has thanked: 5 times
- Been thanked: 154 times
Re: High pitch explosions for Xevious and Galaga
Please watch YouTube videos of the original games. Also some of these boards shipped with different value parts throughout their life and sounded different depending on the board. See galaxian.
Re: High pitch explosions for Xevious and Galaga
I’ve owned several Galagas over the years (and even more PCBs). The explosion on mister is nothing like any of the originals. Again, I appreciate the work that everyone has done. The explosion is not right though.
Re: High pitch explosions for Xevious and Galaga
Agreed. If someone has the know how to implement it, I’m happy to send them a sample directly from one or two of my original Galaga PCBs.
Re: High pitch explosions for Xevious and Galaga
Cool. Here are all of the Galaga sounds sampled directly from an original Midway Galaga PCB (if you boot with the test switch on, you can play the sounds individually with the fire button). I used PCB speaker out to a speaker-to-line converter into a recording interface, so this is a pure recording straight from the PCB to digital. The sounds were recorded making sure to avoid clipping or distortion. I also cleaned the background noise using a mild digital filter once I imported to my pc.
I had to attach as a .zip file because mp3s aren't allowed as attachments.
Enjoy!
- Attachments
-
- Galaga Sounds (direct sample from PCB).zip
- (2.54 MiB) Downloaded 171 times
-
- Core Developer
- Posts: 300
- Joined: Sun May 24, 2020 6:55 pm
- Has thanked: 5 times
- Been thanked: 154 times
Re: High pitch explosions for Xevious and Galaga
i think i might have made this mistake when I patched it for Super Xevious. Thank you for the fix.
Re: High pitch explosions for Xevious and Galaga
If examining a real Galaga PCB would benefit a developer, I have a dead board I would donate to get this right. No repairs have been attempted, so it likely is fixable in the right hands.
Re: High pitch explosions for Xevious and Galaga
Hi all,
Regarding the Galaga explosion, I had a conversation with a friend of mine who is an expert in this area. Here is a summary of his thoughts:
The 54XX custom chip outputs digital white noise, usually that would be a stream of 0's and 1's randomly distributed (https://en.wikipedia.org/wiki/White_noise). However, the 54xx outputs 4bit values, so you can think of that as white noise with a 'volume' of 1-3.
The mistake that many make (including the current MiSTer core) is assuming that data is regular digital audio, and that it can be mixed directly with the output of the Namco sound circuitry. A look at the Galaga schematics reveals that the 54xx output is fed through 3 different single-pole op-amp filters, each with slightly different passive components. The analog result of each op-amp is then summed together to form the 'explosion' sound. The sum of all these parts is that Galaga's code controls the 'volume' of the 54xx white noise to create an explosion with a couple different crescendos, and then fades out gently.
Feeding a stream of digital white noise into an op-amp filter was a common method of generating explosions, bangs, and pops in early 80s arcade hardware. The op-amp acts an active low-pass filter, amplifying the digital noise with a frequency response designed to avoid sharp pops and clicks.
MAME handles the Galaga explosion pretty well. Over the years, they have implemented modeling of various analog sound circuits, including op-amps. Given the complexity, MiSTer's best approach would probably be to use a digital sample. It's definitely possible to do the analog modeling needed in FPGA to emulate op-amp filters, but it is quite specialized work.
Unfortunately, he doesn't have the availability to help out on the MiSTer core, but hopefully the info will help the community with the Galaga explosion (and sounds in other games from this era). He was incredibly generous with his time and expertise to review the code and schematics and provide this explanation. Also, if a sample-based approach is adopted, please feel free to use the Galaga explosion(s) from the file that I uploaded above.
Regards,
Mike
Regarding the Galaga explosion, I had a conversation with a friend of mine who is an expert in this area. Here is a summary of his thoughts:
The 54XX custom chip outputs digital white noise, usually that would be a stream of 0's and 1's randomly distributed (https://en.wikipedia.org/wiki/White_noise). However, the 54xx outputs 4bit values, so you can think of that as white noise with a 'volume' of 1-3.
The mistake that many make (including the current MiSTer core) is assuming that data is regular digital audio, and that it can be mixed directly with the output of the Namco sound circuitry. A look at the Galaga schematics reveals that the 54xx output is fed through 3 different single-pole op-amp filters, each with slightly different passive components. The analog result of each op-amp is then summed together to form the 'explosion' sound. The sum of all these parts is that Galaga's code controls the 'volume' of the 54xx white noise to create an explosion with a couple different crescendos, and then fades out gently.
Feeding a stream of digital white noise into an op-amp filter was a common method of generating explosions, bangs, and pops in early 80s arcade hardware. The op-amp acts an active low-pass filter, amplifying the digital noise with a frequency response designed to avoid sharp pops and clicks.
MAME handles the Galaga explosion pretty well. Over the years, they have implemented modeling of various analog sound circuits, including op-amps. Given the complexity, MiSTer's best approach would probably be to use a digital sample. It's definitely possible to do the analog modeling needed in FPGA to emulate op-amp filters, but it is quite specialized work.
Unfortunately, he doesn't have the availability to help out on the MiSTer core, but hopefully the info will help the community with the Galaga explosion (and sounds in other games from this era). He was incredibly generous with his time and expertise to review the code and schematics and provide this explanation. Also, if a sample-based approach is adopted, please feel free to use the Galaga explosion(s) from the file that I uploaded above.
Regards,
Mike