olofson / audiality2

A realtime scripted modular audio engine for video games and musical applications.
http://audiality.org/
zlib License
79 stars 5 forks source link

Click-free wave loops through frequency space morphing #321

Open olofson opened 7 years ago

olofson commented 7 years ago

The XFADE tool is fast, simple, and straightforward, and works great for many use cases, but it typically has the side effect of introducing a flanger or chorus like effect. This can be an advantage when the whole purpose of using offline rendered waves is to achieve a richer sound, but sometimes, it's just not desirable.

The "correct" solution is to render the sound so that phases and amplitudes of all partials match up at the loop point, typically by calculating frequencies so that every partial completes an integer number of periods over the duration of the loop. Needless to say, this becomes a real pain to get right with anything but trivial additive synthesis with all fixed frequencies.

What we want is a tool that takes an arbitrary input wave, converts it to frequency domain, tweaks/ramps the phases and amplitudes of all components, so they match up at the loop point, and then renders the result into the final wave. Basically the generalized, brute force, after the fact alternative to tweaking the input A2S program until you have a click-free loop.

Suggested method: Windowed overlap add FFT resynthesis.