Accompanying Python Notebooks for From Hard to Soft Alignments: A Tutorial on Soft Dynamic Time Warping for Music Processing
© Meinard Müller and Johannes Zeitler 2026.
These notebooks provide a hands-on introduction to Soft Dynamic Time Warping (SDTW) for music processing. They combine compact explanations, visualizations, and exercises with small Python examples, moving from differentiable minimum functions to training a multipitch estimation model from weakly aligned data. The material is intended for students familiar with signal processing and basic Python/PyTorch. No prior knowledge of SDTW is required. All examples run on a standard CPU.
Start with the course overview. The five units build on one another:
- Differentiable Approximations of Minimum Functions: Explore function values, gradients, and the role of the temperature parameter.
- Soft Alignments and the SDTW Gradient: Interpret soft alignments and compare the global formulation with dynamic programming.
- Training with Strong Targets: Introduce the dataset, CNN and sigmoid, frame-wise BCE, and precision, recall, and F-measure.
- Training with Weak Targets: Basic: Train SDTW with unfolded weak targets; study batching, modified targets, and temperature scheduling.
- Training with Weak Targets: Advanced: Train SDTW with compact targets; investigate step sizes and weights, loss offsets, and temporal shifts.
If you use these notebooks for your work, please cite the accompanying article:
@article{MuellerZ27_eduSDTW_TISMIR,
author = {Meinard M{\"u}ller and Johannes Zeitler},
title = {From Hard to Soft Alignments: A Tutorial on Soft Dynamic Time Warping for Music Processing},
year = {2027},
journal = {Transactions of the International Society for Music Information Retrieval},
note = {Under Review}
}
Create and activate a Conda environment, then install the dDTW package:
conda create -n edu_sdtw python=3.12 pip
conda activate edu_sdtw
python -m pip install "ddtw[benchmark,notebook]" scipyThe [benchmark,notebook] options install all needed additional dependencies. See the dDTW docu for details about a cuda-compatible installation.
The following section provides useful links to alignment-related software packages and accompanying code for experiments on SDTW from different publications. For users interested in applying SDTW and its variants, we primarily refer to the dDTW Toolbox.
- dDTW: A Unified and Efficient Toolbox for Differentiable Sequence Alignment [Github]
- PyTorch CTC loss [API docu]
- Sync Toolbox: Reference implementations for offline DTW [Github]
- J. Zeitler and M. Müller: A Unified Perspective on CTC and SDTW using Differentiable DTW [GitHub]
- J. Zeitler and M. Müller: Subsequence Soft Dynamic Time Warping [Github]
- J. Zeitler, M. Krause, and M. Müller: Soft Dynamic Time Warping With Variable Step Weights [GitHub]
- J. Zeitler, S. Deniffel, M. Krause, and M. Müller: Stabilizing Training With Soft Dynamic Time Warping [GitHub]
- J. Zeitler and M. Müller: Reformulating Soft Dynamic Time Warping: Insights Into Target Artifacts and Prediction Quality [Website]
This project is licensed under the MIT License.
This work was funded by the Deutsche Forschungsgemeinschaft (DFG, German Research Foundation) under Grant No. 500643750 (MU 2686/15-1) and Grant No. 521420645 (MU 2686/17-1). The authors are with the International Audio Laboratories Erlangen, a joint institution of the Friedrich-Alexander-Universität Erlangen-Nürnberg (FAU) and Fraunhofer Institute for Integrated Circuits IIS.