I would like to know how one could generate a wavetable out of a wav file for example.
I know a wavetable can be used in web audio api with setPerdiodic wave and I know how to use it.
But what do I need to do to create my own wavetables? I read about inverse FFT, but I did find nearly nothing. I don't need any code just an idea or a formula of how to get the wavetable from an wav file to a Buffer.
There are a few constraints here and I'm not sure how good the result will be.
PeriodicWave
object
only supports arrays up to size 8192 or so. With that taken care of, select a power of two greater than the length of your wave file (not strictly needed, but most FFTs expect powers of two). Zero-pad the wave file if the length is not a power of two. Then compute the the FFT. You'll either get an array of complex numbers or two arrays. Separate these out to real and imaginary arrays and use them for contructing the PeriodicWave.