I am attempting to develop a similar function as Audacity's Effects>Change Tempo
effect.
Or more specifically: I am in need of a way to create a function in my own project that can modify the length of a .wav file without changing it's pitch or introducing pops/leakage.
I am writing a standalone application (in C#) that already has some functions to create and save .wav files. But I just realized that I must add some processing to allow me to adjust the duration/length of a .wav so I can sync it to be exactly as long as an associated animation (which can not be altered).
I am very interested in knowing if there are any examples that exist which demonstrate concepts on how to change a .wav file's tempo (without noticeable distortion)?
I should specify that I would not need to adjust the length by much more than ±5%.
What I have tried already is to remove slices of data at regular intervals for a given "slice width", which kind of worked but introduced many pops as the sine waves were no longer smooth/continuous.
I have also tried simply adjusting the playback speed at the player by a multiplier to adjust to a desired duration, but this obviously cause the pitch to change (and somewhat noticeably too).
This is something that I am very anxious to understand as my project now seems to be in trouble unless I can somehow synchronize the audio. Could someone please help me figure out if I can write my own function to process this?