I suggest adding another input and another output to oscillator_bank(). The new argument would contain the initial phases of the oscillators. The new output would contain the final phases at the end of the generated waveform.
To avoid roundoff error that grows with time, the returned phases should always be wrapped to the interval $[0, 2\pi]$.
Motivation, pitch
I want to use TorchAudio for real time synthesis. In this context, you generate just a small amount of audio at a time, perhaps a few milliseconds. You do this repeatedly, varying the synthesis parameters based on actions by the user, to create a live performance.
This requires the phases of the oscillators to be continuous across multiple calls to oscillator_bank(). Otherwise you get a discontinuity in the waveform.
An alternative would be to create an OscillatorBank object that would internally store the phases, guaranteeing continuity across multiple calls. In that case the code might look like
🚀 The feature
I suggest adding another input and another output to
oscillator_bank()
. The new argument would contain the initial phases of the oscillators. The new output would contain the final phases at the end of the generated waveform.To avoid roundoff error that grows with time, the returned phases should always be wrapped to the interval $[0, 2\pi]$.
Motivation, pitch
I want to use TorchAudio for real time synthesis. In this context, you generate just a small amount of audio at a time, perhaps a few milliseconds. You do this repeatedly, varying the synthesis parameters based on actions by the user, to create a live performance.
This requires the phases of the oscillators to be continuous across multiple calls to
oscillator_bank()
. Otherwise you get a discontinuity in the waveform.Code to use it would look something like this.
Alternatives
An alternative would be to create an
OscillatorBank
object that would internally store the phases, guaranteeing continuity across multiple calls. In that case the code might look likeAdditional context
No response