Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DAC_8BIT_R2R sounds horrible #3603

Closed
MASHinfo opened this issue May 24, 2018 · 7 comments
Closed

DAC_8BIT_R2R sounds horrible #3603

MASHinfo opened this issue May 24, 2018 · 7 comments

Comments

@MASHinfo
Copy link
Contributor

The DAC_8BIT_R2R (devices\sound\dac.cpp/h) sounds horrible.
Best example is the Tarzan yell in Jungle King.

Listen to this wav:
http://www.mameworld.info/mameinfo/download/MAME-0197-0198.wav

@cuavas
Copy link
Member

cuavas commented May 26, 2018

"Sounds terrible" is not a useful error report. Show how it's producing inaccurate output levels.

@cuavas cuavas closed this as completed May 26, 2018
@happppp
Copy link
Member

happppp commented May 26, 2018

By ear, it sounds to me like gaps or bogus data at the start of each stream_update. Recently there was an update to MAME's sound core (emu/sound.cpp) dealing with stream updates. Is one of those the regression point?

  1. a0137c1#diff-b6e8c8ca6e3fb37d2093327884bfbb3e
  2. 4f13ab7#diff-b6e8c8ca6e3fb37d2093327884bfbb3e
  3. 4308e2a#diff-b6e8c8ca6e3fb37d2093327884bfbb3e

edit yup, that's when it regressed

@ghost
Copy link

ghost commented May 27, 2018

this sounds like it could be quite a serious issue then given that the DAC devices are used all over the place, and this is a core change? anything else obviously broken?

@happppp
Copy link
Member

happppp commented May 27, 2018

According to OG who did some testing yesterday, junglek was "generating negative numbers of samples and scribbling all over memory in the process".
So, while the emu/sound.cpp change results in broken junglek DAC sound, it is not the core cause of it.

@MASHinfo
Copy link
Contributor Author

@hap

Is one of those the regression point?
Yes! It was this line in src/emu/sound.cpp

if (update_sampindex <= m_output_sampindex)
return;

https://git.redump.net/mame/commit/src/emu/sound.cpp?id=4f13ab7d12a8b336977e89cd8b7196ed33e11f2f

When i removed the lines the yell in Jungle King sound good again.

@vidpro1
Copy link

vidpro1 commented Oct 12, 2018

I have been aware of the taitosj.cpp systems DAC audio bugs for years. Glad that someone is paying attention :) Jungle King/Hunts monkey/ape noise and falling in the bushes death sound, and rocks are distorted.I wasn't sure if it was because those samples use signed/unsigned or a different bit number.
The bouncing rock on Front Line is definitely distorted you head THUD THUD THUD like it's clipping when on the real PCB it sounds like someone is knocking on a wood door.

@Lord-Nightmare
Copy link
Contributor

Part of the problem is taitosj (and grchamp, and halleys, all of which share the same sound circuit/board with some very minor variations in the mixing and filter section) uses a very complex circuit for the DAC, using two ports from an ay-3-8910, and it depends extensively on the amount of current the ay-3-8910 can source or sink for each pin, to behave properly.

This requires extensive hardware testing against a real ay-3-8910 chip to figure out (possibly from several chips and average the results together, to compensate for process variation), and to behave properly in MAME, it probably requires a netlist implementation of the DAC circuit.

IIRC the way the volume control 8-bit port for the DAC works is the DAC output is run through a lowpass or bandpass filter, and the volume port controls the cutoff/center frequency of a SECOND bandpass filter which the output of the first dac filter runs through, so the volume is lowered when the bandpass pass band is 'misaligned' with the dac filter's passband. This also causes a significant change to the 'tone' of the sound as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants