A MIDI and music data manipulation library
Project description
S-Coda
Overview
S-Coda is a Python library for handling MIDI files. S-Coda supports a plethora of different MIDI manipulation operations, such as:
- quantisation of notes
- quantisation of note lengths
- splitting sequences into bars
- transposing of sequences
- creating piano-roll visualisations of pieces
- judging the difficulty of pieces
S-Coda was used in our project PAUL-2 to process MIDI files. For information about how to use S-Coda we refer to chapter 5 of the thesis in which S-Coda was introduced.
Installation
We recommend installing S-Coda from PyPI using pip:
pip install scoda
Changelog
See CHANGELOG.md
for a detailed changelog.
Usage
We refer to the aforementioned thesis for a more in-depth guide on how to use S-Coda. We provide a short listing on how to use basic S-Coda functions:
# Load sequence, choose correct track (often first track contains only meta messages)
sequence = Sequence.sequences_load(file_path=RESOURCE_BEETHOVEN)[1]
# Quantise the sequence to thirty-seconds and thirty-second triplets (standard values)
sequence.quantise_and_normalise()
# Split the sequence into bars based on the occurring time signatures
bars = Sequence.sequences_split_bars([sequence], meta_track_index=0)[0]
# Prepare tokeniser and output tokens
tokeniser = StandardNotelikeTokeniser(running_value=True, running_pitch=True, running_time_sig=True)
tokens = []
difficulties = []
# Tokenise all bars in the sequence and calculate their difficulties
for bar in bars:
tokens.extend(tokeniser.tokenise(bar.sequence))
difficulties.append(bar.sequence.difficulty())
# (Conduct ML operations on tokens)
tokens = tokens
# Create sequence from tokens
detokenised_sequence = tokeniser.detokenise(tokens)
# Save sequence
detokenised_sequence.save("out/generated_sequence.mid")
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file scoda-2.1b14.tar.gz
.
File metadata
- Download URL: scoda-2.1b14.tar.gz
- Upload date:
- Size: 40.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7dc9fee12fdcfab252c86a53877a977e5a0e7cfdbaa2e6b52420bd79c4f850fe |
|
MD5 | 0986195e6e20af3eea046e294b65c561 |
|
BLAKE2b-256 | ed0d1abd80375baf3d970c2ecb67bde488cae39b77d2da367639fc390258e950 |
File details
Details for the file scoda-2.1b14-py3-none-any.whl
.
File metadata
- Download URL: scoda-2.1b14-py3-none-any.whl
- Upload date:
- Size: 51.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 694ce1347cb9b11c27d2702875dec4593447a53d8d5aa9f93d7bcb58ce231936 |
|
MD5 | 684e5461df19f023b47069b11754d553 |
|
BLAKE2b-256 | 0c129da9ecb453c6287d0c11e93354f0247ca04c4f94f9dac85f87d1db8d01ac |