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

MultiPCM: High-pitched noise with single-shot samples. #11951

Closed
ValleyBell opened this issue Jan 19, 2024 · 1 comment
Closed

MultiPCM: High-pitched noise with single-shot samples. #11951

ValleyBell opened this issue Jan 19, 2024 · 1 comment

Comments

@ValleyBell
Copy link
Contributor

MAME version

0.261 (g2b20c5ef178)

System information

Ubuntu 23.10

INI configuration details

N/A

Emulated system/software

Virtua Racing (vr), other systems using MultiPCM/YMW258

Incorrect behaviour

"One-short samples" that are terminated by looping over only 1 value can cause audible noise at the point where they should end.
The bug was introduced by #11105.

Expected behaviour

One-shot samples should be silent after they finish.

Steps to reproduce

In Virtua Racing, enter Service Mode -> Music Test and play the song SELECT.

You will hear a quiet but noticeable high pitched sound everytime the kick drum sample ends, which keeps playing until the kick restarts.

Additional details

I think the issue is caused by the interpolation code here:

slot.m_offset += step;
if (slot.m_offset >= (slot.m_sample.m_end << TL_SHIFT))
{
slot.m_offset -= (slot.m_sample.m_end - slot.m_sample.m_loop) << TL_SHIFT;
// DD-9 expects the looped silence at the end of some samples to be the same whether reversed or not
slot.m_reverse = false;
}
if (spos ^ (slot.m_offset >> TL_SHIFT))
{
slot.m_prev_sample = csample;
}

When the loop is only 1 sample value long, it doesn't update slot.m_prev_sample and will keep interpolating between data[end-2] and data[end-1] when it should stay at data[end-1].

@devinacker
Copy link
Contributor

Good catch. I guess it probably got broken by a fix I made to sample length loops in that PR. I'll submit a fix sometime soon if nobody else does.

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

2 participants