pkalogiros / AudioMass

Free full-featured web-based audio & waveform editing tool
1.95k stars 227 forks source link

Integrate WSOLA #44

Open flatmax opened 3 years ago

flatmax commented 3 years ago

Love the editor !

You may be interested in integrating WSOLA into AudioMass ? It is compilable to WASM : https://github.com/flatmax/gtkiostream/blob/master/src/WSOLA.C#L174-L190

You can give timescale (speed) changes in real time and have them alter the speed of the audio waveform without changing the pitch. It works like so :

let N = wsola.getSamplesRequired();// read in N frames of audio data
while (cont){
       // read in N frames of audio data
       for (int n=0; n<N; n++)
           for (int m=0; m<channels; m++)
              wsola.loadInput(n,m,audioData[m][n]);
        // process the audio data
        N=wsola.process(timeScale); // timeScale, is the fraction to speed or slow by, N is the amount of audio frames to read for next time
       // unload the output audio data https://github.com/flatmax/gtkiostream/blob/master/include/WSOLA.H#L255
       for (int n=0; n<wsola.getOutputSize(); n++)
           for (int m=0; m<channels; m++)
               outputAudio[m][n] = wsola.unloadOutput(n,m);
}

In the future loading and unloading will use the WASM heap and vectors ... but for now it is single value load/unload.

flatmax commented 3 years ago

This should already be available in libgtkiostream : https://www.npmjs.com/package/gtkiostream