go-mix / mix

Sequence-based Go-native audio mixer for music apps
https://gopkg.in/mix.v0
MIT License
177 stars 24 forks source link

Audio time-scale/pitch modification #56

Open charneykaye opened 8 years ago

charneykaye commented 8 years ago

From https://en.wikipedia.org/wiki/Audio_time-scale/pitch_modification

Time stretching is the process of changing the speed or duration of an audio signal without affecting its pitch. Pitch scaling or pitch shifting is the opposite: the process of changing the pitch without affecting the speed. Similar methods can change speed, pitch, or both at once, in a time-varying way.

These processes are used, for instance, to match the pitches and tempos of two pre-recorded clips for mixing when the clips cannot be reperformed or resampled. (A drum track containing no pitched instruments could be moderately resampled for tempo without adverse effects, but a pitched track could not). They are also used to create effects such as increasing the range of an instrument (like pitch shifting a guitar down an octave).

pciet commented 8 years ago

Here's a mirror of an LGPL or GPL C++ implementation for this of the SoundTouch lib used in Audacity: https://github.com/alexmarsev/soundtouch/blob/master/source/SoundStretch/main.cpp

Audacity lists a bunch of open source audio libraries it uses: https://github.com/audacity/audacity

glycerine commented 8 years ago

http://stackoverflow.com/questions/9953219/how-does-the-ableton-warp-algorithm-work-exactly

Ableton Live seems to get good effect by slicing at beat boundaries, and then extending or truncating those frames. However the beat detection, at least in early implementations (it's gotten better), was notorious at one point for being off. I think the reason for slicing just before a beat is that the impulse of a beat needs to not be included in the extension; and needs to fall exactly on the new beat (i.e. it must reflect the new beats per minute) in order to sound at all right.

If you think of it as this two stage process, then I'm not sure how a "fully automatic" dilation might work, since the first phase of beat location usually needs manual tweaking. Is fully automatic a requirement?

charneykaye commented 8 years ago

I think that the option of being beat-aware for time stretching is very appealing. As this feature develops (and it will, over the next few months) we'll be sure to consider this.

ljfreelancer88 commented 2 years ago

I really need this. Specially the pitch modification.