nukeykt / Nuked-SC55

Roland SC-55 series emulation
Other
383 stars 40 forks source link

Emulating the stairstepping of the original DACs #50

Open nikitalita opened 5 months ago

nikitalita commented 5 months ago

This is something that may not be able to be satisfactorily accomplished with a software implementation, and likely not relevant to anyone but the nerdiest of audiophile nerds, but I thought I'd mention it:

The original DACs for these devices (NEC UPD63200 and the NEC UPD6376) did stair-stepping for the output:

image (logic analyzer traces from the DAC on a SC-55mk2; digital PCM input on top, DAC analog output on the bottom)

This is unlike modern DACs, which interpolate between samples for nice smooth waveforms. So, the audio output of a real SC-55 would sound a bit crunchier than the audio output of this emulator going through a modern DAC.

One option that I can think of that might be able to be done in a software implementation to emulate this behavior would be to resample to a much higher sample rate (like 384k) and ensure that the samples are just straight up copied instead of interpolated. Of course, this would only be an option if the user had a sound card that supported high sample rates, and we would still have to deal with the weird sample rate (66.207khz) of the mk2 by interpolating the bare minimum amount of samples to get it to an integer ratio with the higher sample rate. Anyone else have ideas or suggestions on this?

Karmeck commented 4 months ago

There are far too many comments here and you should all stop arguing.

I am curious however. In my and some others' experience, the early SC DACs have a weird aliasing-related behaviour; all the frequencies below 32kHz get reflected above 32kHz. I'm not sure how high they get reflected to but it's easy to see on a 44.1kHz recording. That affects the sound of them, giving a bit of extra brightness, though it's fairly subtle. Could this be emulated? This is probably not a complicated effect to reproduce.

I wonder if this I related to this issue: https://www.vogons.org/viewtopic.php?p=1261758#p1261758

johnnovak commented 4 months ago

all the frequencies below 32kHz get reflected above 32kHz. I'm not sure how high they get reflected to but it's easy to see on a 44.1kHz recording.

Aliasing is when frequencies above half the Nyquist frequency (half the sample rate) get folded back to the audible range, for a variety of reasons. It can happen at the ADC stage, DAC stage, sample interpolation stage, DSP calculations, etc.

In this case, all sorts of junk above 16kHz will get folded back. I tried to find some videos online that illustrate this with a sweep, but couldn't and all textual descriptions are vague...

If you play some SC-55 patch in the high octaves, and you use the pitch wheel, and you examine the output in a spectrum analyser, you'll see the actual note you are playing go up as you bend up, but there will be some junk at much lower frequencies moving in the opposite direction, so downwards!

Yeah aliasing can add some brightness because of added quasi-random freqs, but the problem is those extra freqs are inharmonic, so generally it sounds ugly... especially with pitch bends, vibrato, etc.

But it can sound cool with drums.

markanini commented 4 months ago

Am I the only one who thinks the output of Nuked SC55 sounds punchier and better defined than any analogue capture of a real SC-55? I for one don't miss anything. Just my two cents.

johnnovak commented 4 months ago

Am I the only one who thinks the output of Nuked SC55 sounds punchier and better defined than any analogue capture of a real SC-55? I for one don't miss anything. Just my two cents.

A/B compare the System Shock intro tune with exactly matched volumes, then report back again 😄

markanini commented 4 months ago

A/B compare the System Shock intro tune with exactly matched volumes, then report back again 😄

I did with this as my point of comparison https://www.youtube.com/watch?v=DENSsyd2igY and this for the midi files https://www.systemshock.org/index.php?topic=2285.0 The snare was obviously different so I tried using the capital fallback feature in FSMP and it worked to match the instrument sounds. No matter what I think it's likely better to discuss midi music that doesn't have issues with sounds being changed between different SC55 versions in the first place, a novice might misattribute the differences they hear. (Nuked SC55 sounded better here to me, just my opinion)

johnnovak commented 17 hours ago

Yeah, so that screenshot in the first post must be the DACs output prior to the analog reconstruction filter. You'd need to repeat the measurement with the actual analog output jacks.

https://www.sciencedirect.com/topics/engineering/reconstruction-filter

Relevant quote:

The output from the DAC will be ‘steppy’ because the DAC can only output certain voltage values. For example, an 8-bit DAC will have 256 different output voltage levels going from perhaps −5 V to +5 V. When this quantized output is analysed, frequency components of fs, 2fs, 3fs, 4fs etc. (harmonics of the sampling frequency) are found. The very action of sampling and converting introduces these harmonics of the sampling frequency into the output signal. It is these harmonics which give the output signal its steppy appearance. The reconstruction filter is a lowpass filter having a cut-off frequency of fs/2, and is used to filter out these harmonics and so smooth the output signal.

I'm certain the real final output is not steppy; that would sound like crap...

The output of a DAC is not a continuously varying waveform, but instead a series of DC levels. This output must be passed through a filter to remove the high frequency components and smooth waveform into a more truly analog waveform.

Seems like the original poster is a bit confused about how DACs operate.