I am looking for a simple (pseudo)code that spectrum-inverse a sampled audio signal. Ideally C++
The code should support different sample rates (16/32/48KHz).
Mixing the signal by Fs/2
will swap high frequencies and low frequencies - think of rotating the spectrum around the unit circle by half a turn. You can achieve this rotation by multiplying every other sample by -1.
Mixing by Fs/2
is equivalent to mixing by exp(j*pi*n)
. If x
is the input and y
the output,
y[n] = x[n] * exp(j*pi*n) = x[n] * [cos(pi*n) + j*sin(pi*n)]
This simplifies easily because sin(pi*n)
is 0, and cos(pi*n)
is alternating 1,-1.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With