I restore Nintendo 64 music into HD and in my attempt to take it to the next level I wrote an offline synthesizer. Being offline it can take as much time to render the final result as necessary and I am fully favoring quality over performance.
I am using this paper as a guide for sample interpolation: http://yehar.com/blog/wp-content/uploads/2009/08/deip-original.pdf
It mentions pinking and pre-emphasis a lot.
I am probably just missing a small part of the puzzle.
#1: For pre-emphasis, it provides a table at the bottom: Table: Polynomial approximations of interpolator passband responses.
Let’s use the very bottom one as an example.
The paper says this table gives me an approximation of the passband response. Let’s say I am using “6po 5o 32: 1 + x^2*-0.00026762900966793.”
It says: Design of the oversampling and pre-emphasis filter(s) has been left for the reader.
To make this job easier, minmax-error polynomial approximations of the passband
magnitude frequency responses of the interpolators are given in the following table, with a maximum error of ±0.001dB. The x variable is the frequency in radians. x = 0 corresponds to 0Hz and x = π to the passband edge frequency, i.e. the
Nyquist frequency of the original sampledata before upsampling by N.
In my example, my original samples are 22050.0 Hz, so Nyquist will be 11025.
Okay…what am I supposed to do with 1 + x^2*-0.00026762900966793? How do I choose x? x will be a normalized frequency (frequency converted to radians), but what frequency? The samples will be 22050Hz, but my final result will be (in this example) 48000Hz. What am I supposed to do to apply pre-emphasis?
I thought I needed to apply a pre-emphasis filter to the 22050 samples before using the “6po 5o 32” interpolator across them for synthesis.
I looked up pre-emphasis: https://dsp.stackexchange.com/questions/7771/how-should-one-select-this-filter-coefficient-for-a-pre-emphasis-filter
This says that pre-emphasis is just a 1-order FIR.
So I looked up a pre-emphasis filter and found this 1-order code: https://librosa.org/doc/main/generated/librosa.effects.preemphasis.html
But since I have no idea how I am supposed to use 1 + x^2*-0.00026762900966793 I have no idea what coefficient I am supposed to plug into that. The things I tried are audibly wrong.
What am I supposed to do to handle pre-emphasis?
#2: For pinking, what to do?
The paper says:
Pink means that the spectrum decreases 3dB per an octave increase
in frequency. To take this into account in interpolator quality evaluation, we filter
the spectral images with a pinking filter, whose magnitude is proportional to √1w,
where w is the angular frequency of the passband frequency that creates the
image. We shall call this process pinking.
…
Pinking emphasizes the importance of stopband attenuation near frequencies a
multiple of 2π. This has proven to be important as some interpolators may have
OK-looking frequency responses, but sound really bad when there are typical
amounts of low frequencies in the input, compared to testing with white noise. Because pinking would be infinitely strong near 0Hz, we choose to keep increasing the pinking gain only down to the frequency corresponding to 5Hz in a 44100Hz
sampling frequency (before oversampling) input signal, and keep the pinking gain at the same level from that point to 0Hz.
I’ve implemented the bi-quad filter here: https://webaudio.github.io/Audio-EQ-Cookbook/audio-eq-cookbook.html
I don’t see a good way using that to create this pinking filter. It would be kind of like an LPF but I need to control the slope, and with these all taking a Q factor…
Is there a filter type that would be best-suited for pinking? Is it appropriate to Jerry-rig an LPF into doing this (by refactoring out Q and using S and dBGain instead) or-?
L. Spiro