A real-time audio time-scale modification library¶
AudioTSM is a python library for real-time audio time-scale modification procedures, i.e. algorithms that change the speed of an audio signal without changing its pitch.
- Source code repository and issue tracker:
- Python Package Index:
- MIT – see the file
Audiotsm should work with python 2.7 and python 3.4+.
You can install the latest version of audiotsm with pip:
pip install audiotsm
You may also need to install the sounddevice library in order to run the
examples or to use a
pip install sounddevice
The audiotsm package implements several time-scale modification procedures:
- OLA (Overlap-Add), which should only be used for percussive audio signals;
- WSOLA (Waveform Similarity-based Overlap-Add), an amelioration of the OLA procedure which should give good results on most inputs.
Below is a basic example showing how to reduce the speed of a wav file by half using the WSOLA procedure:
from audiotsm import wsola from audiotsm.io.wav import WavReader, WavWriter with WavReader(input_filename) as reader: with WavWriter(output_filename, reader.channels, reader.samplerate) as writer: tsm = wsola(reader.channels, speed=0.5) tsm.run(reader, writer)
If you are interested in time-scale modification procedures, I highly recommend reading A Review of Time-Scale Modification of Music Signals by Jonathan Driedger and Meinard Müller.