I’m emulating a retro Programmable Sound Generator (producing mostly simple square envelopes), running from 1 to 2 Mhz.
The idea was to generate, in real-time using an
AudioSource, the data in chunks, then resample the 1000000Hz signal to 44100Hz (for example) at the end of the
getNextAudioBlock method. The sampling ratio is pretty high, and fractional.
The generation works very fine, but the trouble comes from the resampling. I must highlight the fact that I know nothing about DSP, FFT and stuff like that, so I relied on existing pieces of code.
Basically, I manage to “get it working”, but there are always some problems depending on the generated frequencies. I tried:
ResamplingAudioSourceclass: works but quality isn’t good enough.
- All the interpolators (
CatmullRomInterpolatormostly). Works, but once again the quality isn’t good enough.
R8Brain. The quality is great, but due to the high fractional sampling ratio, I get problems on how the buffer cycles (too much is generated, or not enough, and I can’t manage to fill the gap (seems I’m not the only one, according to this thread)).
- Is my two-passes solution the way to go?
- If no… hmmm, how can I make it work?
Thanks a lot.