Closed johnnovak closed 2 years ago
I'm thinking of introducing HPF at 20Hz by default on every single channel @kcgen. This will get rid of useless rumble and remedy any possible DC offset issues. This would make your DC offset stuff unnecessary, not sure how you feel about that, though
That's even better! any DC offset left in the PC Speaker's signal that persists over time would move the other channels' samples during mixing; so the DC offset sine wind-down (https://github.com/dosbox-staging/dosbox-staging/pull/480) was an attempt to detect and zero it inaudibly on a much shorter time span (about 200ms) versus the prior 10,000 ms step-wise magnitude reduction approach.
The HPF approach is superior and global :π, and that unitasker DC offset code can be fully removed π
There is quite a bit of aliasing in the emulated output, which is very apparent on the highest notes between 00:09-00:11 in the "will" music (compare it carefully to the real hardware recording; the foldback antialiasing is very apparent,
PS/1 is still in need of the same PSG treatment for sub-millisecond IO writes like Tandy now has -- so a lot of that PS/1 code could mostly mirror the Tandy; which I think doing that is orthogonal to the HPF adjustments.
I haven't had much time lately due to some health issues, so please feel free try that Tandy-style use of the SincResampler to the PS/1, as well.
The PS/1 also has a separate DAC channel that, thanks to your excellent description, I now recognize as using a zero-order hold approach to adapt its sampling rate to the mixer's channel rate: I'm not sure if this is what the original PS1 DAC sounded like (but I know, this often is pretty low quality sounding), so if we could ditch those bit shifts in favor or the speex resampling, maybe it would cleanup some aliasing too?
All for you diving into more areas of the audio device code, @johnnovak; Some tasty low hanging fruit awaits! π₯ π₯ (In ref to some awesome mangos we get from Australia here in BC π )
The HPF approach is superior and global :π, and that unitasker DC offset code can be fully removed π
Cool, and now that we have a float mixbuffer, it's enough to high-pass filter the master output just once at the very end (because there's no risk of overloading the master bus into clipping with DC offsets).
I haven't had much time lately due to some health issues, so please feel free try that Tandy-style use of the SincResampler to the PS/1, as well.
Sure, I might pick it up later, but first I'll finish all the planned stuff (reverb, chorus, more filters, etc.) Hope you'll feel better soon!
The PS/1 also has a separate DAC channel that, thanks to your excellent description, I now recognize as using a zero-order hold approach to adapt its sampling rate to the mixer's channel rate: I'm not sure if this is what the original PS1 DAC sounded like (but I know, this often is pretty low quality sounding), so if we could ditch those bit shifts in favor or the speex resampling, maybe it would cleanup some aliasing too?
I don't think many games use the Tandy or PS/1 DAC for music (maybe none? would make sense because sample-based music takes up a lot of disk space compared to synth music). So yes, of course there's aliasing when using the DAC to play sound effect samples too, but that gives the sound that characteristic "crunchines" like in the case of the SB. I think the zero-order-hold upsampling is fine for the PS/1 and Tandy DACs; that's probably what the hardware does, after all, and most likely they just put some cheap lowpass filter at the end, or maybe not even that. Using speex to upsample from 8k, 11k or whatever would apply the brickwall filter, which would get rid of lots of aliasing, but it would also make the audio muffled (like in the case of SB16 with low sample rates), so the crunchiness would be mostly gone.
When generating pure synth tones (e.g. square, sawtooth, etc.) at variable frequencies, that's a different story, aliasing becomes quite ugly and noticeable on the higher notes, hence it's best to get rid of it. Moreover, that sort of fold-back aliasing is not noticeable in the real hardware recordings (it's probably there but it's much quieter, so the apparently did something right with the filters).
Some tasty low hanging fruit awaits! π₯ π₯ (In ref to some awesome mangos we get from Australia here in BC π )
Indeed, it's one of my favourite fruits π It's "winter" here now (18-25 C during the day...), though, so mango season is about 4-5 months away!
@kcgen, these sound examples should make it clear what I was trying to say in that block of text above about my preference of not using the Speex resampler to upsample to the host rate for these old crummy DACs, but rather use the zero-order-hold stuff and apply some fixed filter that lets a fair amount of the aliasing noise through in order to retain the original character of these devices.
Speex applies a hard brickwall LPF at half the sample rate -- at 3.5kHz in case of the Disney which has a fixed 7kHz sample rate. The hardware didn't have such a high-quality filter, so this results in an overly filtered sound, and the characteristic crunchiness of the sound is completely gone. Notice how the brickwall filter gives the audio a very phone-like quality. Only the SB16 and later SB cards had this high-quality, frequency dependent brickwall filter, so I wouldn't use the default speex brickwall mechanism for anything else, it just doesn't sound right.
kq6-disney-35k-brickwall.mp3.zip
It turns out the Disney had some sort of a lowpass filter, and by listening to a few real hardware recordings I got pretty close to it by zero-order-hold upsamling to the host rate, then applying a gentle 6dB/oct LPF set as low as 1kHz (so Speex is effectively turned off in this specific scenario, but that's fine). This results in a subjectively more "present" and intelligible sound, and a lot of that aliased crunchiness is still retained.
It's quite a striking difference, with the second example being much more "period-accurate". The difference in filtering is very apparant when overlaying the two spectra on top of each other:
I get it that we're not chasing 100% accuracy here, but to me the more accurate filtering is superior, it just "feels better", and will probably get people who owned the original hardware in a good nostalgic mood π Plus it was very little effort to come up with this solution (took me an hour of finding some recordings, then listening and tweaking), so I'd say it was definitely worth it.
I just thought you'd be interested in some actual examples, and I enjoy messing around with this stuff π
Cool, and now that we have a float mixbuffer, it's enough to high-pass filter the master output just once at the very end
This will let us eliminate more casting down to 16bit signed on some of the callbacks; sounds we need an add_samples(..) for float
.
Sure, I might pick it up later, but first I'll finish all the planned stuff (reverb, chorus, more filters, etc.) Hope you'll feel better soon!
Thanks for the well wishes! indeed; hopefully soon enough. Fully agree that it makes sense to keep on with the planned stuff; going great.
Thanks for the explanation on the DAC. I fully agree; the baseline/zero hold and your LPF filter are a very nice balance!
I just thought you'd be interested in some actual examples, and I enjoy messing around with this stuff π
I'm a fan, and enjoying the technical progress and the music! π₯³
Ps talking about mangoes.. some our of favorites are the R2E2s. They arrive sporadically year after year; hopefully's a good growing season this year!
talking about mangoes.. some our of favorites are the R2E2s
Yeah, they're definitely the best! π₯ The Calypsos are nice too.
Curious if the latest commit in kc/audio-rendering-1
improves the quality of PS/1 Audio in Colonel's Bequest.
Just to understand, has this been fixed then @kcgen ? Is there no difference now compared to the real recordings? I'll test it myself too sometimes, I thought I'd just ask first π
I've noticed a few differences between the emulated PS/1 audio and real hardware recordings when tuning the new filters using the Colonel's Bequest soundtrack.
First of all, to enable PS1 audio, I needed to install the official Sierra PS1 driver update from here: ftp://ftp.oldskool.org/pub/IBM_PC_BBS/ps1/instdrv.exe
The differences I noticed:
The unfiltered waveform looks quite different than the real hardware recording, but after filtering the steps are gone and the high-pass filter gets rid of the DC offset as well. I think the "steppiness" is not a problem, most likely the output of the real hardware would look the same without the analog lowpass filter at the output
By the way, I'm thinking of introducing HPF at 20Hz by default on every single channel @kcgen. This will get rid of useless rumble and remedy any possible DC offset issues. This would make your DC offset stuff unnecessary, not sure how you feel about that, though π
Recordings
Real hardware
DOSBox Staging