Skip to main content

harte-rs

CI PyPI

Harte chord notation, C:maj7/3, Bb:(b3,5,b7,9), F:sus4(*3,9), N, read into music21-rs chords. it is a replacement for harte-library: it is imported as harte, has the same modules and names, and builds the chord harte-library builds for every label in that library's coverage set. the label is read by the harte Rust crate, and the chord is a music21-rs Chord, so neither music21 nor lark is needed.

pip install harte-rs

harte-rs and harte-library both install the harte package, so uninstall harte-library first.

from harte.harte import Harte
from harte.interval import HarteInterval
from harte.utils import convert_interval

chord = Harte("Bb:min7/b3")
chord.pitches         # (<music21.pitch.Pitch B-4>, <music21.pitch.Pitch D-3>, <music21.pitch.Pitch F5>, <music21.pitch.Pitch A-5>)
chord.bass()          # <music21.pitch.Pitch D-3>
chord.commonName      # 'minor seventh chord'
chord.get_root()      # 'Bb'
chord.get_shorthand() # 'min7'
chord.get_bass()      # 'b3'

Harte("C:(b3,5)").prettify()            # 'C:min'
Harte("G:7").get_midi_pitches()         # [67, 71, 74, 77]
Harte("G:7").multi_hot_encoding()       # [0, 0, 1, 0, 0, 1, 0, 1, 0, 0, 0, 1]
Harte("F:sus4(*5,9)").unwrap_shorthand() # ['1', '4', '9']

HarteInterval("b6").name                # 'm6'
convert_interval("#11")                 # 'A4'

Harte is a music21-rs Chord and HarteInterval a music21-rs Interval, so every member those have works on them. with music21 installed and music21_rs.install_into_music21() called before harte is imported, a Harte is a music21 Chord too, and goes in music21's streams as harte-library's does.

differences from harte-library

  • a label that is not Harte notation raises music21-rs's ChordException, where harte-library raises lark's parse errors. harte.parse_harte, the lark grammar, is not included.
  • str() and repr() give the label in its canonical spelling, Harte(C:maj7(9)/3). harte-library's raise TypeError for every label but N.
  • two labels are equal when they sound the same chord: C:maj equals C:(3,5). harte-library's compares the degrees as written.
  • bass_is_root() answers whether the bass is the root. harte-library's compares the root's name with the bass degree, and answers False for every chord.
  • N and X have no shorthand: get_shorthand() is None and contains_shorthand() is False.

development

harte-rs lives in the music21-rs repository, in harte/python, and is released with the music21-rs wheel at the same version. it builds on that wheel's _HarteLabel, so it needs the wheel built from the same checkout:

maturin build --release --manifest-path python/Cargo.toml --out target/wheels
pip install target/wheels/music21_rs-*.whl ./harte/python pytest
python -m pytest harte/python/tests

the tests check every label in harte-library's coverage set against harte/data/harte_expectations.toml, which records what harte-library makes of each.

credits

harte-rs is released under the AGPL-3.0. it is a port of harte-library by Andrea Poltronieri, licensed MIT; its licence is included as LICENSE-harte-library.

Metadata

Release files for harte-rs 0.21.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for harte-rs 0.21.0
File Size Uploaded Provenance Actions
harte_rs-0.21.0.tar.gz 7.8 kB With provenance Details for harte_rs-0.21.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for harte-rs 0.21.0
File Interpreter ABI Platform Actions
harte_rs-0.21.0-py3-none-any.whl Python 3 none any Details for harte_rs-0.21.0-py3-none-any.whl

Total release size: 14.9 kB

Release files / harte_rs-0.21.0.tar.gz

Download URL harte_rs-0.21.0.tar.gz
Size 7.8 kB
Tags Source
SHA-256 checksum
How to use checksums
03106bb0497cd7d65b0b29bf3f60d142b8edc43ddaef3c08a58772c6c733d8ea
BLAKE2b-256 checksum
How to use checksums
0abe9b803dcc5e2a654f878ecbdd66661386a75f452d331f42d397e840952945
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 20, 2026.

Transparency log

Release files / harte_rs-0.21.0-py3-none-any.whl

Download URL harte_rs-0.21.0-py3-none-any.whl
Size 7.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
db6e8cadaad964036bc897490d798f4ac3d1e106fded3f41ac5e9baa07cb3cde
BLAKE2b-256 checksum
How to use checksums
5b881c48d7e109fa1e244ed2793892b51ef59e67d9c2bc26ddb52d6a16489122
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 20, 2026.

Transparency log

Security for harte-rs 0.21.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for harte_rs-0.21.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 20, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page