VASTDynamics / Vaporizer2

Vaporizer2 hybrid wavetable additive / subtractive VST / AU / AAX synthesizer / sampler workstation plugin
https://www.vast-dynamics.com/?q=products
GNU General Public License v3.0
408 stars 24 forks source link

Support host sample rate instead of fixed 44.1? #84

Closed rktic closed 4 months ago

rktic commented 4 months ago

Hello,

first things first: Thank you for the huge user experience improvements as of late!

Is there any chance for supporting the hosts' native sampling rate, as opposed to running fixed at 44100? Including export of cycles and wavetables?

Cheers Ronny

VASTDynamics commented 4 months ago

Hi, Vaporizer2 should run with all common sample rates. What makes you think that this is not the case? Is there a specific bug? The structure of wavetable files is not related to sample rates. It is the commonly used format to have 2048 samples per cycle. But this is independent from the sample rate. With double sample rate you will just run twice as fast through the table ...

rktic commented 4 months ago

To add further differentiation: I understand that Vaporizer works at all sampling rates. Yet, I assumed its wavetable engine is internally locked to 44.1khz. Due to the exported files being restricted to that. As well as loading a wavetable containing 64 cycles of 2048 samples at 48khz into the sampler, then resampling the .wav as wavetable, results in 62-63 detected cycles.

Since I didn't find solid information, I was only able to make an assumption.

With double sample rate you will just run twice as fast through the table

Cheers for that! I need to ponder this 😄 Curious question: What happens to the partials above 22050hz when importing eg a 96khz wavetable using 2048 cycles into Vaporizer? (Something tells me it's a dumb question...)

VASTDynamics commented 4 months ago

Cheers for that! I need to ponder this 😄 Curious question: What happens to the partials above 22050hz when importing eg a 96khz wavetable using 2048 cycles into Vaporizer? (Something tells me it's a dumb question...)

Not a dumb question at all. Actually it touches the "heart" of the engine: how to avoid aliasing above the Nyquist frequency. The answer is complex. But in a nutshell: the Vaporizer2 engine is not generating the output directly from the "naive" wavetable. Instead it uses iFFT to create bandlimited wavetables (two per octave), they are so to say hard low-pass-filtered at nyquist. This is also why playing a c9 or so is actually basically a sine wave, independent of the wavetable. This process of course depends on the samplerate as Nyquist is samplerate/2.

But there is not such a thing as a 96khz wavetable. Wavetables are sets of 2048 samples. Without a rate. Technically they are WAV files but this is just to have a handy container ...

rktic commented 4 months ago

Thank you very much for shedding some light on its inner workings! As a user, it's impossible to know for sure. Especially since every synth does things differently. And devs often being disclosed about their products.

But there is not such a thing as a 96khz wavetable. Wavetables are sets of 2048 samples. Without a rate. Technically they are WAV files but this is just to have a handy container ...

Makes perfect sense — I haven't thought about it like that, yet! Consider my request as closed 😃

VASTDynamics commented 4 months ago

You can find all the magic here: https://github.com/VASTDynamics/Vaporizer2/blob/main/VASTvaporizer/Source/Engine/Oscillator/VASTWaveTable.cpp :-)

rktic commented 4 months ago

I'm as good at reading code as egypt hierglyphs :)