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

Nuked OPN2 Noise Bug or Feature? #62

Open
matt713 opened this issue Dec 31, 2019 · 10 comments
Open

Nuked OPN2 Noise Bug or Feature? #62

matt713 opened this issue Dec 31, 2019 · 10 comments

Comments

@matt713
Copy link

matt713 commented Dec 31, 2019

  1. i am not sure if this is bug or feature, because "Nuked" core is supposed to be most accurate according to the table here: https://github.com/jpcima/ADLplug
    if it's feature and original OPN chip has such noise problem it is very bad feature to keep, because it makes listening to the generated sound very unpleasant. Also, I am not sure if this is related to the "Nuked" core or to its integration in ADLplug, i.e. ADLplug problem. I guess if it's "Nuked" core issue it has to be upstream to its developer(s).

  2. the fact though is that the second most accurate according to the same table "MAME" core has no such problem making listening to the generated sound very pleasant on any level of amplification.

  3. in fact no any other core has such problem:

  • MAME YM2612 : OK, i.e. no noise at all
  • Nuked OPN2 : BAD, i.e. background noise throughout the whole playback
  • GENS 2.10 OPN2 : OK
  • Neko Project II Kai OPNA : OK
  • MAME YM2608 : OK
  1. what confuses me most is how such apparent problem is unnoticed - in my setup literally deaf can hear the constant background noise generated by "Nuked" core when playback MIDI. I mean if others cannot hear it, I have no idea what makes it so obvious in my setup - i have i7-4770, which means it's not due to insufficient performance for "Nuked" core to properly work. Also, I have decent audio hardware, maybe that makes amplification of those frequencies sufficient to hear.

  2. finally, i am attaching WAV recordings that clearly show the problem:

  • "MAME" one : clear, crisp sound with no any background noise on any level of amplification
  • "Nuked" one: constant background noise, very unpleasant in fact throughout the whole recording. if you cannot hear it, maybe your audio hardware cannot amplify those frequencies, but one more time - in my setup it is more than obvious. in any way frequency analysis of the PCM data inside those recording should show what are those frequency differences that lead to such background noise when decent level of amplification is applied.

mandalorian_opn_mame.zip
mandalorian_opn_nuked.zip

I hope someone can give definitive answer what is going on...also if you need more input from my side - let me know. thanks.

@Wohlstand
Copy link

Nuked OPN2 is a cycle-accurate emulator, it requires A LOT OF power to work properly. You should give a higher latency to make it work a bit better in real-time. It's not recommended for realtime work.

@Wohlstand
Copy link

OH!!!!!! (just now I have listened to the OPN2's output)
I UNDERSTOOD WHY THESE NOISES!!!
The chip does a simulation of real chip behavior, and this noise appears on real hardware because of a thin bitness of PCM output (9 bits). It's YM3438. If you'll run it in the YM2612 mode (Discrete), you'll hear much more noise, it appears because of the hardware bug that makes a "ladder effect". I have a discussion, where that was explained. I had similar questions regarding to the sounding of the Nuked OPN2 emulator.

@Wohlstand
Copy link

here is a discussion: nukeykt/Nuked-OPN2#4

@Wohlstand
Copy link

Here is an example with a "ladder effect": http://wohlsoft.ru/docs/_files_for_posts/Misc/NukedOPN2/IcePath-Nuked.flac caused by a mistake I did (I have incorrectly set the mode, and therefore worked in YM2612 mode).

@jpcima
Copy link
Owner

jpcima commented Dec 31, 2019

True remarks, and I will add that YM2612 suffers also a problem at channel levels, and hence Nuked, where sound is clipped low at channel level, and it's quite easy to overdrive it.

This was a problem of the OPN2 chip design, the OPNA has resolved it.

With the default setting that is used, it does not produce the "ladder" effect, but there is going be clipping in any case.

Frankly, I don't know if it's worth keeping this "fidelity" in Nuked, or I'd rather to patch it.
Maybe some noisy things like drums may be depending on it.

@matt713
Copy link
Author

matt713 commented Dec 31, 2019

@ALL, thank you, even your comments are too technical for newbie like me to understand.

my point is that 8-bit is less than 9-bit and yet 8-bit PCMs sound fine to me, even more Yamaha S-YXG50 uses 8-bit wavetable and same MIDIs sounds beautiful, same MIDIs sound beautiful with MAME YM2612 and MAME YM2608 core as well to me, but due to that noise they sound terrible with Nuked core. I think maybe the DAC in my audio card is very susceptible to what Nuked core outputs, because really the noise is awful. BTW, I've now tried same MIDI with OPL3 emulators and it seems Nuked and DosBOX suffer from such problem even it's harder to hear compared to Nuked OPN (where the noise is particularly amplified), but it's definitely there. So, what MAME core is doing is much better for listening and I wish there is OPL3 emu based on MAME core for OPN to totally get rid of that unpleasant background noise. in my opinion, those emulators don't need to emulate the DAC part of those old chips, but only generate the digital waveform and include modern interpolation algorithm to make it with sufficient resolution to sound nice on modern DACs. I guess MAME core is doing something like that because it really sounds fantastic - I don't even care if it's that accurate when it's so clean and without noise. I doubt I can hear any of the sound accuracy with Nuked due to the noise from my side is almost as loud as the sound.

@jpcima
Copy link
Owner

jpcima commented Dec 31, 2019

@matt713 At which samplerate do you run audio processing?

@jpcima
Copy link
Owner

jpcima commented Dec 31, 2019

DosBOX

That's news, the DOSBox emulator does not have trouble usually, it sounds good and is very fast.

I don't even care if it's that accurate when it's so clean and without noise

By nature of these lo-fi chips, there will be noise. For instance, none of waveform generators are protected against aliasing noise, they are going to produce a lot of it.
At the same time, this noise generation is put to use into drum generation for instance.

It's not such an obvious decision to go into emulation code and remove sources of noise; it may break some patches which depend really on the noise behavior.

With all of this said, your recordings do not strike me as awful like described, as I listened, they are sounding alright on my side.
Is it only live play affected by the noise, as opposed to offline processing? (and which sample rate is it?)

@GudPiggeh
Copy link

It seems that only one of the two nuked options (YM3438 vs YM2612) appears even though they are considered different in libOPNMIDI.

I don't really understand C++, but from what I can tell, it might be because in libOPNMIDI, regardless of which nuked emulator enum (OPNMIDI_EMU_NUKED_YM2612 or OPNMIDI_EMU_NUKED_YM3438) is selected, the resulting NukedOPN2::emulatorName is "Nuked OPN2". When this is turned into a juce key-value property in OPNplug, there is undefined behavior.

To me, it sounds like when "Nuked OPN2" is selected, the ladder effect of YM2612 is present, with no way to remove it, but I don't know.

(Also, the version of Nuked included in libOPNMIDI looks to be a few years out of date at this point.)

@Wohlstand
Copy link

The difference between 2612 and 3438 that first has the ladder effect, because it simulates the real chip accurately, and 3438 doesn't have it as strong as 2612, because 3438 chip has fixed that bug. Anyway, I'll try to verify and if needed, I'll sync my copy with mainstream, thanks for a note.

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

4 participants