I am taking sound samples (simple tones) and playing them back on a Gameboy.
This hardware has 32 4-bit samples played back in loop at a frequency chosen by the programmer.
Consequences to this is that I can't fit the entire sample into the buffer. By taking only a portion, I can have higher frequencies represented, due to the increased sample rate, at the cost of lower frequencies no longer fitting in the 32 sample buffer.
Normally, frequencies above the Nyquist frequency "fold over" and affect the sound quality of the played sample. This is fixed with a lowpass filter in software before any conversion/playback that would cause this.
Also, long frequencies that can't be represented in the 32 samples don't fit, so a highpass filter in software seems like a good idea, to eliminate these frequencies and any artifacts they might introduce.
Together, these would form a bandpass filter, done in software, on a given sound/tone sample, to make sure these interferences are eliminated. These two points are tied, from any bottom frequency N to top frequency N*32, due to the size of the buffer.
However, putting this band somewhere where the sample has no frequencies would filter out most of the sound, and highly distort the output.
Is there an algorithm for choosing N to minimize distortion?