Metadata-Version: 2.4
Name: scoda
Version: 3.0.0
Summary: Deterministic symbolic-music processing for machine-learning workflows
Author-email: Felix Schön <schoen@kr.tuwien.ac.at>
License-Expression: MIT
Project-URL: Homepage, https://github.com/FelixSchoen/S-Coda
Project-URL: Bugtracker, https://github.com/FelixSchoen/S-Coda/issues
Project-URL: Documentation, https://felixschoen.github.io/S-Coda/
Keywords: midi,music,symbolic music,machine learning,tokenisation
Classifier: Development Status :: 5 - Production/Stable
Classifier: Intended Audience :: Science/Research
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: 3.14
Classifier: Typing :: Typed
Requires-Python: >=3.11
Description-Content-Type: text/markdown
License-File: LICENSE.md
Requires-Dist: mido<2,>=1.3.3
Provides-Extra: test
Requires-Dist: pytest<10,>=9; extra == "test"
Requires-Dist: pytest-xdist<4,>=3.8; extra == "test"
Requires-Dist: pytest-cov<8,>=7; extra == "test"
Requires-Dist: coverage<8,>=7; extra == "test"
Requires-Dist: build<2,>=1.4; extra == "test"
Requires-Dist: ruff<1,>=0.15; extra == "test"
Requires-Dist: mypy<2,>=1.18; extra == "test"
Requires-Dist: hypothesis<7,>=6.130; extra == "test"
Requires-Dist: twine<7,>=6.2; extra == "test"
Requires-Dist: pip-audit<3,>=2.10; extra == "test"
Provides-Extra: deploy
Requires-Dist: build<2,>=1.4; extra == "deploy"
Requires-Dist: twine<7,>=6.2; extra == "deploy"
Provides-Extra: docs
Requires-Dist: mkdocs<2,>=1.6; extra == "docs"
Requires-Dist: mkdocs-material<10,>=9.6; extra == "docs"
Requires-Dist: mkdocstrings[python]<1,>=0.30; extra == "docs"
Dynamic: license-file

# S-Coda

[![GitHub Release](https://img.shields.io/github/v/release/FelixSchoen/S-Coda?include_prereleases&label=Latest%20Release)](https://github.com/FelixSchoen/S-Coda/releases)
[![GitHub Actions Workflow Status](https://img.shields.io/github/actions/workflow/status/FelixSchoen/S-Coda/scoda_test.yml?label=Build)](https://github.com/FelixSchoen/S-Coda/actions/workflows/scoda_test.yml)
[![Python Version](https://img.shields.io/badge/Python-3.11--3.14-blue)](https://www.python.org/)

S-Coda is a typed Python library for deterministic symbolic-music processing. It provides immutable musical values,
validated MIDI import and export, sequence transformations, bar splitting, canonical tokenisation, vocabulary
fingerprints, and incremental decoding constraints for machine-learning workflows.

## Installation

Install the current release from [PyPI](https://pypi.org/project/scoda/):

```bash
python -m pip install scoda
```

S-Coda supports Python 3.11 through 3.14 and has one core dependency, Mido.

## Quick start

```python
from scoda import Note, NotelikeConfig, NotelikeTokeniser, Sequence, save_midi

sequence = Sequence(
    notes=(Note(0, 24, 60, 96), Note(24, 48, 64, 88)),
    duration_ticks=96,
    ticks_per_quarter=24,
)
sequence = sequence.quantise_and_normalise((3, 6, 12, 24), (6, 12, 24))

tokeniser = NotelikeTokeniser(NotelikeConfig(note_values=(6, 12, 24), velocity_bins=127))
tokens = tokeniser.tokenise((sequence,))
token_ids = tokeniser.encode(tokens)
assert tokeniser.decode(token_ids) == tokens
assert tokeniser.detokenise(tokens) == (sequence,)

save_midi((sequence,), "output.mid")
```

Transformations return new values and never mutate their input. MIDI repairs are explicit diagnostics, token streams
have a canonical grammar, and each vocabulary has a deterministic manifest and SHA-256 fingerprint.

## Documentation

The complete guide and API reference are available at
[felixschoen.github.io/S-Coda](https://felixschoen.github.io/S-Coda/). It covers:

- immutable sequences and transformations;
- MIDI repair, strict, and lossless import policies;
- bar splitting and carried musical context;
- token framing, metadata, manifests, and constrained decoding;
- reproducible experiment persistence and release benchmarks.

Development and release commands are documented in [the benchmark guide](benchmarks/README.md) and the hosted
documentation. The supported public API consists of names exported directly from `scoda`.

## Citing

If you use S-Coda in research, please cite:

```bibtex
@inproceedings{Schoen.2023,
  author       = {Felix Sch{\"{o}}n and Hans Tompits},
  title        = {{PAUL-2:} An Upgraded Transformer-Based Redesign of the Algorithmic Composer {PAUL}},
  booktitle    = {22nd International Conference of the Italian Association for Artificial Intelligence ({AIxIA 2023})},
  series       = {Lecture Notes in Computer Science},
  volume       = {14318},
  pages        = {278--291},
  publisher    = {Springer},
  year         = {2023},
  doi          = {10.1007/978-3-031-47546-7\_19}
}
```

See [CHANGELOG.md](CHANGELOG.md) for release history.
