I haven't seen this simple algorithm in the forum or in the stash so here it is : Spectral Inversion.
More precisely, it mirrors the frequency, the miror being the Nysquist Frequency (that is to say the sample frequency divided by 2, most of the time : 22050Hz).
A sine at 440 Hz, is now a sine at 22050 - 440 = 21610 Hz (inaudible, I know...)
So beware the dreadful DSP part, here comes the code :
Code:
desc:SpectralInversion
@init
isSecondSample = 0;
@sample
isSecondSample ?
(
spl0 = -spl0;
spl1 = -spl1;
isSecondSample = 0;
)
:
(
isSecondSample = 1;
);
Quite simple, isn't it ? The idea is to swap the sign of every second sample. And thanks to the vodoo of the mathematic in the Zplane, the frequencies are no "inversed".
Now, the bad news. It isn't very musical. Indeed, all the tonal content of the music is lost in the process (except G note (at 44100Hz))... but it is fun to watch with a frequency analyser (like gfxAnalyser for instance or even better schwa schope ) !
As an example, I have used as a "fade out FX", on one of my composition (here is the link :
https://soundcloud.com/matth-1-1/scintillation).