NotSo Fatso bandlimited synth?

This is an archive of a topic from NESdev BBS, taken in mid-October 2019 before a server upgrade.
View original topic
NotSo Fatso bandlimited synth?
by on (#17806)
Is anyone gonna come out with a Bandlimited version of NotSo Fatso or at least add its stereo panning ability to foo_gep? It would be awesome either way. Also, I noticed some audio plugins (mostly for MSX) use an RC (Resistor/Capacitor?) Filter instead of Highpass and lowpass, are they the same thing?

by on (#17807)
High pass and low pass are RC filters. By defining the component values, you're defining the bandwidth/frequency response.

by on (#17810)
I'll try bothering Kode54 to provide a front-end to channel panning. The Game_Music_Emu library itself allows independent handling of every channel, so it's just a matter of getting the front-end written. Anything beyond panning that you're interested in?

I know Disch has re-implemented his APU and other sound chips for Schpune using my band-limited algorithm (but his own code), so he'd be in the best position to port these back to NotSoFatso. Or he could post the source to his latest version of Schpune so someone else could do it.

An R/C filter is one possible way to implement a filter in an electronic circuit. High-pass and low-pass refer to what portion of frequencies are passed by the filter, without regard to how it achieves this. In software, filtering is achieved by adding attenuated, delayed versions of the signal to itself.

by on (#17816)
Oh joy, I can't wait to steal the panning configuration dialog template and code from NotSo Fatso and shove it in my preferences somewhere in a lame attempt to avoid designing yet another dialog and writing the backend code for it. Wait, scratch that, I can write the code, I just hate designing dialogs.

Scratch that again, I just don't feel like adding things I won't use myself, like VGM tempo control. And I suppose that panning control will be expected per format as well. And fully configurable echo/reverb like Game_Music_Emu already supports. Also per format no doubt.

by on (#17841)
Quote:
In software, filtering is achieved by adding attenuated, delayed versions of the signal to itself.

Well, I've always asked myself how it was possible to implement a digital filter algorithm. What you describe sounds more like echo than filter, and I've trouble seeing how it works. Is that a lowpass or highpass filter ? I think it would be a highpass filter, because if you substract a shortly delayed version, all frequencies that match the delay will be attenuated, but that would only work for one precise frequency and it will only attenuate or distortion other frequencies.
Totally out of topic, but I'm curious.

by on (#17853)
Think of how quickly a wave is changing. If you output the current and previous samples added together, this will result in more cancellation for quickly changing waves than slowly changing waves. This results in a low-pass filter. If you output the difference between the current and previous, you get the opposite effect, a high-pass filter, since quickly changing waves have larger differences between each sample. More complex filters are built by adding several recent input samples together, each attenuated (multiplied) by a different amount.

One thing I wanted to mention regarding band-limited synthesis and filtering is that they are similar things but serve different purposes. The NES effectively has a 1790 kHz sampling rate, much higher than the typical 48 kHz rate of a PC. Band-limited synthesis has its bandwidth sharply limited to a certain maximum (i.e. it's a low-pass filter) in order to fit within the limit of the sampling rate the host PC is using; without the limiting, frequencies would go above the limit and "fold over" into aliasing distortion. This is an artifact of the way modern sound works, unrelated to NES sound. Low-pass filtering and high-pass filtering are done to match the what the NES audio circuitry does. A lack of this wouldn't result in aliasing, but would result in a sound that has more bass and is more crisp than a NES sounds. Finally, for efficiency a digital signal processing algorithm can combine the bandwidth limiting and NES low-pass filtering into one step due to the way the mathematics work.

by on (#17875)
This introduction to digital signal processing shouldn't "bore" you.

by on (#17882)
How much high-pass filtering does the NES have (i.e., approximate cutoff frequency and slope)?

by on (#17897)
Thanks for the link tepples.

by on (#17912)
I understand that for good quality emulated audio, one would either have to compute the sound output at the clock rate (1.7 MHz or so for the NES), then resample/low-pass-filter to 48 kHz (or whatever), or compute the band-limited output directly. The first approach makes the computation code extremely straightforward, the second approach however is a lot faster.

How would one speed up the emulation of sound channels whose output is directly controlled by the program, like direct DAC writes, or for example the speaker in the Apple II, without artifacts?

by on (#17916)
Start with an amplitude step sampled at say 441 kHz. Low-pass filter this with a roll-off around 20 kHz. Now you have a band-limited step that you can take every 10th sample of to get an alias-free 44.1 kHz step from. By altering which sample you start with, you can adjust the step's fractional position in tenths. Scale and add one of these steps every time your emulated amplitude changes. This shows the waveforms you'd get if you has four fractional positions rather than ten as above:

Band-limited sound synthesis: implementation

This works and is extremely efficient, and allows for a high-level interface where you specify the time index and change in amplitude, in any order. Blip_Buffer implements this in a C and C++ library.

ALSO this animation of a band-limited step being sampled at different phases pretty much sums up everything:

Image

This is what you get at the edges of a square wave on the NES that is sampled on a PC as the exact time of the transition slowly moves between the points that the PC takes samples.

by on (#41850)
blargg, do you still have this animation ?