Different time stretching modes


BpmDj normally stretches/shrinks audio by addressing the wave using integers. Thus no interpolation takes place. When the same sample is repeated, this leads to a typical 'staircase' effect. Acoustically, it sounds as a metallic ringing at high frequencies. E.g: when time stretching a cello or flute, the effect is particularly audible. Secondly, if a sound is made longer or shorter like this, its pitch will change. Half the speed = 1 octave lower. Double the speed = 1 octave higher.

BpmDj offers two methods to solve these problems. The first is a Farrow resampler. The second is the Zathras time stretcher

Farrow Anti-aliasing

If you turn on the anti-aliasing filter, the sound will be correctly resampled, improving the quality of the mixes. Of course, the processing is fairly expensive. About 56 operations per sample (so literally, we have to look at the same wave 56 times before a sensible interpolation is made).

Resampling solves the staircase effect. It will not solve the pitch changes introduced through tempo changes. In order to solve that you will need ...


"Zathras is used to being beast of burden to other people's needs."

To alter the tempo of audio without affecting its pitch, most tools use some form of overlap and add. That is, they will extract small segments from the audio, and place them at the correct position in the output stream. Each segment will still have a correct pitch, so overlapping multiple of them should result in a non-pitch shifted sound. The problem with this is that transients are literally repeated.

An approach that does not suffer this problem is the phase vocoder. By investigating the spectrum of the input sound, and realigning the phases, such that multiple frames correctly piece together, it is possible to lengthen the sound. The problem with this approach is that none of the lead tones will remain 'in the sound' and that transients will be smeared.

To mediate this problem we resorted to sinusoidal modeling. By correctly analyzing the musical content from the input, and synthesizing it into the output, we can modify the speed of an audio track, without altering its pitch.

The time stretcher is written in native code, so it is about 3% faster than its Java implementation. It has also been optimized up to the point that on an ordinary desktop we can time stretch about 14.2 stereo tracks simultaneously. Yet, phones are no desktop machines and it is not guaranteed that your phone will be fast enough to do even 1 or 2 stereo-tracks simultaneously.

In particular, some hardware does not offer a hard floating point. Other phones have slow memory or bad caching. It is really very hardware dependent.

Zathras-1 or Zathras-2 ?
Zathras-1 Zathras-2
Pitch correct Pitch of melody can be altered up to 1%. Often inaudible. Yes.
Transients Short repeats of transients can be heard with extreme time stretches. Transients are handled slightly better
32 bit support No. Running Zathras-1 on a 32 bit processor might incur a performance penalty. Yes. On 32bit hardware, reduces data transfer and speeds up the algorithm
Memory access Less. Extensive. Use this if you have fast memory.
Computations Many Fewer

In a nutshell, first try Zathras-2. If it works fast enough on your computer, then use that one because it is somewhat better (qualitatively speaking) than Zathras-1. If that doesn't work, try Zathras-1. If that is still too slow, try Zathras-2 and Zathras-1 in Mono mode. (Mono mode is selected in the overall BpmDj settings)

Setting the timestretch mode

Each mix has a default timestretch modes, which can be set by tapping the tempo annotation next the the volume bar.

Furthermore, each song can override the timestretching mode. To set the song speed engine, open the song segment, and tap on the stretch-settings button . On a phone you can reach it by opening the song segment, tapping the white circle left of Fx.