Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 30 additions & 7 deletions .github/workflows/pypi_publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest]
os: [ubuntu-latest, macos-latest, windows-latest]

steps:
- uses: actions/checkout@v3
Expand All @@ -27,11 +27,11 @@ jobs:
run: python -m cibuildwheel
env:
CIBW_BUILD: "cp310-* cp311-* cp312-* cp313-*"
CIBW_ARCHS: "x86_64"
CIBW_ARCHS_LINUX: "x86_64"
CIBW_ARCHS_MACOS: "x86_64 arm64"
CIBW_BEFORE_BUILD: |
pip install --upgrade pip
pip install "numpy>=2.0,<3.0" "cython>=3.0.10,<4.0"
CIBW_ARCHS_WINDOWS: "AMD64"
# One line: on Windows this runs in cmd, which does not take a script.
CIBW_BEFORE_BUILD: pip install "numpy>=2.0,<3.0" "cython>=3.0.10,<4.0"
CIBW_BUILD_VERBOSITY: 1

- name: Upload artifact
Expand All @@ -40,17 +40,40 @@ jobs:
name: wheels-${{ matrix.os }}
path: ./wheelhouse/*.whl

# The source distribution, for platforms without a wheel (pip builds it
# there, which needs a C compiler).
build_sdist:
name: Build sdist
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.12"

- name: Build sdist
run: |
python -m pip install build
python -m build --sdist

- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: sdist
path: ./dist/*.tar.gz

publish:
if: github.event.release.prerelease == false
needs: build_wheels
needs: [build_wheels, build_sdist]
runs-on: ubuntu-latest
permissions:
id-token: write
steps:
- name: Download artifacts
uses: actions/download-artifact@v4
with:
pattern: wheels-*
path: dist
merge-multiple: true

Expand Down
37 changes: 30 additions & 7 deletions .github/workflows/test_pypi_publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest]
os: [ubuntu-latest, macos-latest, windows-latest]

steps:
- uses: actions/checkout@v3
Expand All @@ -27,11 +27,11 @@ jobs:
run: python -m cibuildwheel
env:
CIBW_BUILD: "cp310-* cp311-* cp312-* cp313-*"
CIBW_ARCHS: "x86_64"
CIBW_ARCHS_LINUX: "x86_64"
CIBW_ARCHS_MACOS: "x86_64 arm64"
CIBW_BEFORE_BUILD: |
pip install --upgrade pip
pip install "numpy>=2.0,<3.0" "cython>=3.0.10,<4.0"
CIBW_ARCHS_WINDOWS: "AMD64"
# One line: on Windows this runs in cmd, which does not take a script.
CIBW_BEFORE_BUILD: pip install "numpy>=2.0,<3.0" "cython>=3.0.10,<4.0"
CIBW_BUILD_VERBOSITY: 1

- name: Upload artifact
Expand All @@ -40,17 +40,40 @@ jobs:
name: wheels-${{ matrix.os }}
path: ./wheelhouse/*.whl

# The source distribution, for platforms without a wheel (pip builds it
# there, which needs a C compiler).
build_sdist:
name: Build sdist
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.12"

- name: Build sdist
run: |
python -m pip install build
python -m build --sdist

- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: sdist
path: ./dist/*.tar.gz

publish:
if: startsWith(github.ref, 'refs/tags/')
needs: build_wheels
needs: [build_wheels, build_sdist]
runs-on: ubuntu-latest
permissions:
id-token: write
steps:
- name: Download artifacts
uses: actions/download-artifact@v4
with:
pattern: wheels-*
path: dist
merge-multiple: true

Expand Down
24 changes: 21 additions & 3 deletions .github/workflows/unittest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,11 @@ jobs:
strategy:
fail-fast: false
matrix:
platform: [ubuntu-latest, macos-latest]
platform: [ubuntu-latest, macos-latest, windows-latest]
python-version: ["3.10", "3.11", "3.12", "3.13"]

runs-on: ${{ matrix.platform }}
timeout-minutes: 30
steps:
- uses: actions/checkout@v3

Expand All @@ -22,17 +23,34 @@ jobs:
with:
python-version: ${{ matrix.python-version }}

# A slow package mirror can stall apt for half an hour or more: retry
# dropped downloads, and fail after 10 minutes so the job can be re-run.
# No recommended packages: that skips qsynth, a Qt GUI for FluidSynth.
# libfluidsynth3 still pulls in a soundfont, though matchmaker synthesizes
# with partitura's bundled one. PyAudio is built by pip from
# portaudio19-dev, not taken from the system Python.
- name: Install system dependencies (Ubuntu)
if: matrix.platform == 'ubuntu-latest'
timeout-minutes: 10
run: |
sudo apt-get update
sudo apt-get install -y portaudio19-dev python3-pyaudio fluidsynth
sudo apt-get update -o Acquire::Retries=3
sudo apt-get install -y --no-install-recommends -o Acquire::Retries=3 \
portaudio19-dev fluidsynth

- name: Install system dependencies (macOS)
if: matrix.platform == 'macos-latest'
timeout-minutes: 10
run: |
brew install portaudio fluidsynth

# PyAudio's Windows wheels bundle PortAudio, so only FluidSynth is needed.
- name: Install system dependencies (Windows)
if: matrix.platform == 'windows-latest'
timeout-minutes: 10
run: |
choco install fluidsynth -y --no-progress
echo "C:\tools\fluidsynth\bin" >> $env:GITHUB_PATH

- name: Install dependencies
run: |
python -m pip install --upgrade pip
Expand Down
13 changes: 13 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,18 @@
# Changes

## Version 0.5.0

### Added

- Bloch and Dannenberg's dynamic-programming follower for MIDI (`method="dannenberg"`).
- Windows wheels and a source distribution on PyPI.

### Changed

- SPARC resamples the position path at 3 kHz (`SPARC_SAMPLE_RATE`) instead of 50 Hz, so every audio frame interval (25, 30, 50, 62.5 Hz) spans a whole number of samples and closely spaced MIDI updates stay apart. `smoothness` values therefore differ from 0.4.0; pass `fs=50` to `compute_sparc` to reproduce them.
- SPARC windows are computed from the sparse speed of the held path and only the bins up to `fc`, giving the same values as before without a full FFT per window (a 5-minute piece takes seconds at 3 kHz instead of about a minute and a half).
- `arzt_multi_fold` builds only the first repeat unfoldings it uses instead of every repeat path, so scores with many repeats no longer stall. The hypotheses and their order are unchanged.

## Version 0.4.0

New score followers, a method registry, and a standardized evaluation output. Not backwards compatible with 0.3.
Expand Down
3 changes: 3 additions & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Cython sources for building from the sdist. setuptools picks up the .pyx
# files from setup.py, but not the .pxd declarations next to them.
recursive-include matchmaker *.pyx *.pxd
45 changes: 30 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ Supports **simulation mode**: run online alignment against recorded audio or MID
> ```bash
> conda install -c conda-forge fluidsynth
> ```
>
> conda-forge has no Fluidsynth package for Windows; see [Installing Fluidsynth on Windows](#installing-fluidsynth-on-windows).

### Option 2: Live device support

Expand All @@ -51,6 +53,8 @@ Adds [PyAudio](https://pypi.org/project/PyAudio/) and [python-rtmidi](https://py
> ```bash
> conda install -c conda-forge fluidsynth portaudio
> ```
>
> On Windows, the `pyaudio` wheels already include PortAudio, so only Fluidsynth is needed.

### Option 3: Development install (from source)

Expand All @@ -65,31 +69,42 @@ cd matchmaker
conda create -n matchmaker python=3.12
conda activate matchmaker

# Install system dependencies
# Install system dependencies (Linux and macOS; on Windows, see below)
conda install -c conda-forge gcc=12.1.0 glib fluidsynth portaudio

# Install matchmaker in editable mode with all dev dependencies (includes [devices])
pip install -e ".[dev]"
```

On Windows, skip the system dependencies step: conda-forge has neither `gcc=12.1.0` nor Fluidsynth for Windows, and none of these packages are needed there. Instead, install the [Visual C++ build tools](#missing-visual-c-build-tools-on-windows) to compile the Cython extensions and [install Fluidsynth from its release ZIP](#installing-fluidsynth-on-windows). The rest of the steps are the same, in a conda environment or a plain `venv`.

> **Note:** `partitura` will download `MuseScore_General.sf3` (a free soundfont) on first use. This may take a moment.

### Known Setup Issues

#### Missing Visual C++ build tools (on Windows)

Download `vs_BuildTools.exe` from <https://visualstudio.microsoft.com/visual-cpp-build-tools/> and run:
Building from source (`pip install -e .`, or the sdist) fails with `Microsoft Visual C++ 14.0 or greater is required` if no C++ compiler is installed. Having Visual Studio installed is not enough; it also needs the C++ workload. Install the build tools with winget:

```bash
winget install --id Microsoft.VisualStudio.2022.BuildTools --override "--quiet --wait --norestart --add Microsoft.VisualStudio.Workload.VCTools --includeRecommended"
```

Or download `vs_BuildTools.exe` from <https://visualstudio.microsoft.com/visual-cpp-build-tools/> and run:

```bash
vs_buildtools.exe --norestart --passive --downloadThenInstall --includeRecommended --add Microsoft.VisualStudio.Workload.NativeDesktop --add Microsoft.VisualStudio.Workload.VCTools --add Microsoft.VisualStudio.Workload.MSBuildTools
```

#### Issues with Fluidsynth and pyfluidsynth on Windows
#### Installing Fluidsynth on Windows

Without Fluidsynth, `import fluidsynth` raises `ImportError("Couldn't find the FluidSynth library.")`. pyfluidsynth looks for `libfluidsynth-3.dll` in `C:\tools\fluidsynth\bin` and on `PATH`:

On Windows, pyfluidsynth expects `fluidsynth.exe` to be located in `C:\tools\bin` (some users report `C:\tools\fluidsynth\bin`):
1. Download the ZIP for your architecture (e.g. `fluidsynth-v2.6.1-win10-x64-cpp11.zip`) from <https://github.com/FluidSynth/fluidsynth/releases/latest>.
2. Extract it and rename the extracted folder (e.g. `fluidsynth-v2.6.1-win10-x64-cpp11`) to `C:\tools\fluidsynth`, so that the DLL is at `C:\tools\fluidsynth\bin\libfluidsynth-3.dll`. Alternatively, put the folder anywhere and add its `bin` directory to `PATH`.
3. Check with `python -c "import fluidsynth"`.

1. Download the ZIP for your Windows version from <https://github.com/FluidSynth/fluidsynth/releases/latest>
2. Extract the contents to `C:\tools` (or wherever pyfluidsynth expects the executable).
With [Chocolatey](https://chocolatey.org/), `choco install fluidsynth` installs it to `C:\tools\fluidsynth` as well.

#### Using Fluidsynth installed from Homebrew on macOS

Expand Down Expand Up @@ -362,7 +377,7 @@ Default method: `"arzt"`

| Method | Description |
|---|---|
| `"arzt"` | On-line time warping adapted from Brazier and Widmer (2020) |
| `"arzt"` | On-line time warping by Arzt et al. (2008), extending Dixon (2005) |
| `"dixon"` | On-line time warping by Dixon (2005) |
| `"outerhmm"` | Two-level HMM with repeats and skips by Nakamura et al. (2016) |
| `"skf"` | Switching Kalman Filter with hidden tempo by Jiang and Raphael (2020) |
Expand All @@ -376,16 +391,16 @@ Default method: `"pthmm"`

| Method | Description |
|---|---|
| `"arzt"` | On-line time warping adapted from Brazier and Widmer (2020) |
| `"arzt"` | On-line time warping by Arzt et al. (2008), extending Dixon (2005) |
| `"dixon"` | On-line time warping by Dixon (2005) |
| `"outerhmm"` | Outer-product HMM score follower by Nakamura (2014) |
| `"outerhmm"` | Outer-product HMM score follower by Nakamura et al. (2014) |
| `"hmm"` | HMM score follower by Cancino-Chacón et al. (2023) |
| `"pthmm"` | Pitch-based HMM score follower |
| `"pfkorz"` | Particle filter score follower by Korzeniowski et al. (2013) |
| `"SL_OLTW"` | Symbolic-level OLTW note matcher from [parangonar](https://github.com/sildater/parangonar) |
| `"SLT_OLTW"` | Symbolic-level OLTW note matcher with tempo, from parangonar |
| `"OTM"` | Online transformer note matcher from parangonar |
| `"OPTM"` | Online pure-transformer note matcher from parangonar |
| `"SL_OLTW"` | Symbolic-level OLTW note matcher from [parangonar](https://github.com/sildater/parangonar) (Peter et al., 2025) |
| `"SLT_OLTW"` | Symbolic-level OLTW note matcher with tempo, from parangonar (Peter et al., 2025) |
| `"OTM"` | Online transformer note matcher from parangonar (Peter, 2023) |
| `"OPTM"` | Online pure-transformer note matcher from parangonar (Peter, 2023) |

The parangonar methods match one performed note at a time, so they always run
event-based (no MIDI polling).
Expand All @@ -404,7 +419,7 @@ Default processor: `"chroma"`. Some methods default to their own processor
| `"cqt"` | Constant-Q transform |
| `"mel"` | Mel-spectrogram |
| `"lse"` | Log-spectral energy features used in Dixon (2005) |
| `"cqt_spectral_flux"` | CQT-based spectral flux used in Nakamura (2014) |
| `"cqt_spectral_flux"` | CQT-based spectral flux used in Nakamura et al. (2016) |
| `"raw_spectrum"` | Raw power spectrum used in Jiang and Raphael (2020) |
| `"korzeniowski"` | Spectral observations for the Korzeniowski et al. (2013) particle filter |

Expand Down Expand Up @@ -475,7 +490,7 @@ If you find Matchmaker useful, we would appreciate if you could cite us!

## Acknowledgments

This work has been supported by the Austrian Science Fund (FWF), grant agreement PAT 8820923 ("*Rach3: A Computational Approach to Study Piano Rehearsals*"). Additionally, this work was supported by the National Research Foundation of Korea (NRF) grant funded by the Korea government (MSIT) (No. NRF-2023R1A2C3007605).
This work has been supported by the Austrian Science Fund (FWF), grant agreement PAT 8820923 (Rach3: A Computational Approach to Study Piano Rehearsals) and PIN 1347924 (AURA: Augmenting musical interaction via EVAs), as well as by the European Research Council (ERC) under the EU’s Horizon 2020 research & innovation programme, grant agreement No.101019375 (Whither Music?), and by the National Research Foundation of Korea (NRF) grant funded by the Korea government (MSIT) under Grant RS-2023-NR077289.

## License

Expand Down
2 changes: 1 addition & 1 deletion docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
project = "pymatchmaker"
copyright = "2024, matchmaker development team"
author = "matchmaker development team"
release = "0.4.0"
release = "0.5.0"

# -- General configuration ---------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration
Expand Down
2 changes: 1 addition & 1 deletion matchmaker/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
try:
__version__ = version("pymatchmaker")
except PackageNotFoundError: # pragma: no cover
__version__ = "0.4.0"
__version__ = "0.5.0"

ASSETS_DIR = Path(__file__).parent / "assets"

Expand Down
1 change: 1 addition & 0 deletions matchmaker/dp/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
- Event: onset-level features (MIDI)
"""

from .dannenberg import DPDannenberg
from .oltw_arzt import (
OnlineTimeWarpingArzt,
OnlineTimeWarpingArztEvent,
Expand Down
Loading