Parse an Ableton ASD clip file (warp markers and more) in Python
MIT License
Parse an Ableton ASD clip file and its warp markers in Python. This module has been tested with .asd
files saved with Ableton 9 and Ableton 10.
pip install abletonparsing
Clip class:
WarpMarker class:
If loop_on
is false, then loop_start
will equal the start_marker
, and loop_end
will equal the end_marker
.
import abletonparsing
import librosa
import soundfile as sf
import pyrubberband as pyrb
bpm = 130.
audio_path = 'drums.wav'
clip_path = audio_path + '.asd'
audio_data, sr = librosa.load(audio_path, sr=None, mono=False)
num_samples = audio_data.shape[1]
clip = abletonparsing.Clip(clip_path, sr, num_samples)
time_map = clip.get_time_map(bpm)
# Time-stretch the audio to the requested bpm.
output_audio = pyrb.timemap_stretch(audio_data.transpose(), sr, time_map)
with sf.SoundFile('output.wav', 'w', sr, 2, 'PCM_24') as f:
f.write(output_audio)