#+TITLE: Scrubber* OverviewAn FFT based in-memory sample scrubber with pitch control.* Tangled Files* FFT procedures, and SoundpipeOne could spend a whole lifetime building FFT algorithms,so an existing FFT implementation is used. For FFT andinverse-FFT operations, the Soundpipe fft utilities areused. So yes, Soundpipe is a hard dependency for thisalgorithm. Or at least, bits of Soundpipe are. The FFTportions can easily be extracted from the Soundpipecodebase.The soundpipe FFT utility is a wrapper around a publicdomain FFT implementation by John Green.* InitializationDone with =sk_scrubber_init=.* CleanupDone with =sk_scrubber_cleanup=. Mainly done for the sakeof the =sp_fft=. Future iterations will try to remove anymandatory use of =malloc= and =free=.* ConstantsScrubber uses a fixed FFT size, which greatly simplifiesthings. The FFT size chosen is 2048, or =2^11=. It's a goodvalue that equal parts effeciency and fidelity.The LOG2 of this FFT size is 11, and this is what is passedinto the soundpipe FFT interface.The hopsize determines how quickly to slide along the FFTwindow. In this case it's 512, or the FFT size divided upinto 4 bits.This divisor is a significant constant that will bestored as a constant as well.* Parameters** PositionSets the current read position of the buffer, in samples.** PlaybackSets the relative playback speed. 1 is normal, 2 is 2xspeed, and 0.5 is 2x slower.* ComputationRead interpolated samples from buffer forward/backwardframes.Take FFT of framesPhase Vocode.Inverse FFT operation.Overlap-add to output frames.Write to output and scale;Update counter and frame position.
#+TITLE: Scrubber
* Overview
An FFT based in-memory sample scrubber with pitch control.
* Tangled Files
* FFT procedures, and Soundpipe
One could spend a whole lifetime building FFT algorithms,
so an existing FFT implementation is used. For FFT and
inverse-FFT operations, the Soundpipe fft utilities are
used. So yes, Soundpipe is a hard dependency for this
algorithm. Or at least, bits of Soundpipe are. The FFT
portions can easily be extracted from the Soundpipe
codebase.
The soundpipe FFT utility is a wrapper around a public
domain FFT implementation by John Green.
* Initialization
Done with =sk_scrubber_init=.
* Cleanup
Done with =sk_scrubber_cleanup=. Mainly done for the sake
of the =sp_fft=. Future iterations will try to remove any
mandatory use of =malloc= and =free=.
* Constants
Scrubber uses a fixed FFT size, which greatly simplifies
things. The FFT size chosen is 2048, or =2^11=. It's a good
value that equal parts effeciency and fidelity.
The LOG2 of this FFT size is 11, and this is what is passed
into the soundpipe FFT interface.
The hopsize determines how quickly to slide along the FFT
window. In this case it's 512, or the FFT size divided up
into 4 bits.
This divisor is a significant constant that will be
stored as a constant as well.
* Parameters
** Position
Sets the current read position of the buffer, in samples.
** Playback
Sets the relative playback speed. 1 is normal, 2 is 2x
speed, and 0.5 is 2x slower.
* Computation
Read interpolated samples from buffer forward/backward
frames.
Take FFT of frames
Phase Vocode.
Inverse FFT operation.
Overlap-add to output frames.
Write to output and scale;
Update counter and frame position.