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

Constant background hum in Vong demos #52

Open
sa666666 opened this issue Mar 20, 2017 · 3 comments
Open

Constant background hum in Vong demos #52

sa666666 opened this issue Mar 20, 2017 · 3 comments

Comments

@sa666666
Copy link

This is basically a copy of the exact same issue from Stella: stella-emu/stella#104. I've decided to put it off until I get to the new sound core, as you probably will as well. But the symptoms are the same in Stella and Stellerator (background hum), which are not present in other emulators tested (MAME, javatari, z26, etc).

@DirtyHairy
Copy link
Member

DirtyHairy commented Mar 20, 2017

Interesting, I didn't even bother trying as the audio synthesis mechanism in Stella and 6502.ts is totally different: while Stella generates a PCM signal, 6502.ts drives oscillators provided by the browser as part of the WebAudio API. However, of course, you are right: the hum is there in 6502.ts, too 😏

I have logged AUxx register writes, and that's what I get after leaving the intro screen:

AUDF 0 0
AUDC 1 0
AUDC 0 0
AUDC 0 5
AUDV 0 12

(the first number is the channel index). There are no more writes after that. This suggests that Thomas' analysis from the AA thread is off, and that channel 0 indeed gets stuck at AUDF=0, AUFC=5, AUDV=12. The actual waveforms fed into the oscillators are stored as compressed 1-bit samples in src/machine/stella/tia/ToneGenerator.ts and looking at those suggests an approx. 15kHz square wave. My hearing is far from absolute pitch, but that sounds about correct 😄

Even though they look different, I think that our audio implementations share a similar origin. Our version was adapted by @mschroeder from code originally written by Adam Wozniak (see the note here), and I am pretty sure that it encodes a pre-calculated version of the very same patterns calculated in TIASnd.cxx (I think I found evidence for this on the web some time ago).

I think the reason that this is only audible with Stella on Windows may be due to resampling and due to ideosyncrasies of the audio systems on the different platforms (after all, 15 kHz is not far from the threshold of the human ear). However, I have no idea what this means for emulation accuracy. Is the underlying model in our emulators wrong? Is the signal suppressed by the charactaristics of the VCSs audio circuitry? I guess we'll find out once we implement Chris Brenner's algorithm 😈

@DirtyHairy
Copy link
Member

DirtyHairy commented Mar 21, 2017

I just tested Vong on my Jr. and, after turning our stereo to a dangerously high level (especially with a sleeping toddler next door), I can actually hear a high-pitched hum after leaving the intro screen. It's close to the edge of my hearing, so definitely higher than what we get from Stella and 6502.ts, but still....

I guess I'll repeat this test later this week, this time connecting the audio out of my modded Jr. directly to the stereo in order to avoid any signal processing by the TV.

@sa666666
Copy link
Author

This gave me an idea to try it in MAME. When I turn its software volume all the way up, I too can hear the hum. So it looks like it's being generated in MAME correctly, but in Stella and Stellerator it's much too pronounced. Anyway, like you said, its a moot point until we get to the new sound core. I just wanted it documented as a good test case for the new core.

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