I split out preprocess_audio because scipy/librosa don't run under
pypy and I was hoping that would speed up the encoding, but it does
not for some reason (maybe numpy interactions?)
Anyway, I should be able to vectorize the slow path which will likely
help a lot.
(moved over from rewolf repository).
Using a 13-cycle period neatly divides the 65-cycle 'long cycle'
period of the Apple II which avoids audio transients when playing
'silence'. This also aligns with the horizontal refresh period which
should make it possible to do some interesting visual effects.
TODO
- implement predictive encoding that looks ahead to next N samples and
minimizes average error. This should improve quality
- get page-flipping effects looking nice