Skip to main content

Structural music composition framework

Project description

hyperscore

hyperscore is a structural music composition framework that models music as explicit, composable structure rather than notation or performance.

Time is represented uniformly using immutable time spans, pitch is handled as pitch-class structure independent of register, and rhythm is expressed as relative proportions that are resolved into concrete time only when needed. External formats such as MIDI are treated as lossy boundaries rather than as the source of truth.

hyperscore is designed for experimentation, analysis, and integration with algorithmic systems, rather than for score engraving or DAW-style workflows.


Minimal example

This minimal example demonstrates the core hyperscore workflow: selecting pitch material using theory objects, describing rhythm structurally, generating time-based events, and exporting the result to MIDI.

from hyperscore import CHORDS, Score, parse_rhythm
from hyperscore.core import NoteEvent, bpm_to_ms
from hyperscore.io import MidiExporter
from hyperscore.rhythm import rhythm_ast_to_timespans

# ----------------
# theory
# ----------------
chord = CHORDS["major7"]

pitches = [n for n in range(60, 72) if n % 12 in chord.intervals]
pitch_iter = iter(pitches)

# ----------------
# rhythm
# ----------------
ast = parse_rhythm("1*4")
total = int(bpm_to_ms(120, 1))
spans = rhythm_ast_to_timespans(ast, total=total)

# ----------------
# score
# ----------------
score = Score()

score.add_timespans(
    spans,
    factory=lambda span: NoteEvent(
        pitch=next(pitch_iter),
        velocity=100,
        span=span,
        channel=0,
    ),
)

# ----------------
# output
# ----------------
MidiExporter().export(score, "example.mid")

This example intentionally avoids musical interpretation and focuses on structural composition. Pitch, rhythm, and time are treated as independent layers that are combined explicitly.


What this example demonstrates

  • Rhythm is expressed as structure, not notation
  • Time is handled explicitly via immutable TimeSpan objects
  • Pitch and rhythm are independent layers
  • MIDI is treated as a lossy output format

For more advanced usage, see:

  • examples/
  • tests/test_smoke.py

Optional: ZippedNotes shortcut

For simple sequential note generation without explicit TimeSpan construction, hyperscore provides the ZippedNotes convenience API.

This approach is suitable for basic sketches or quick tests, but offers less control than TimeSpan-based workflows.

from hyperscore import Score
from hyperscore.core import NoteEvent

score = Score()

score.add(
    pitch=[60, 64, 67, 71],  # C major 7 chord tones
    velocity=[100],
    duration=[125],
    channel=[0],
    event_factory=lambda **kw: NoteEvent(
        pitch=kw["pitch"],
        velocity=kw["velocity"],
        span=kw["span"],
        channel=kw["channel"],
    ),
)

For complex timing, transformations, or algorithmic rhythm generation, prefer TimeSpan-based workflows using parse_rhythm, rhythm_ast_to_timespans, and TimeSpanPipeline.


Project status

  • Python >= 3.10
  • Typed (py.typed)
  • Experimental / research-oriented
  • API may evolve between minor versions

hyperscore favors clarity of structure and explicitness of time over completeness or stylistic prescription.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

hyperscore-0.2.0.tar.gz (17.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

hyperscore-0.2.0-py3-none-any.whl (23.5 kB view details)

Uploaded Python 3

File details

Details for the file hyperscore-0.2.0.tar.gz.

File metadata

  • Download URL: hyperscore-0.2.0.tar.gz
  • Upload date:
  • Size: 17.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.21 {"installer":{"name":"uv","version":"0.9.21","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for hyperscore-0.2.0.tar.gz
Algorithm Hash digest
SHA256 65dc0dc600422f7ae7f4eddeb33ab153e7f604ffe16f761b77b9bd4a7a51ecc5
MD5 ae8f86dce0531851c93b3f586c4613ed
BLAKE2b-256 c12a38729727682d61421bbabb6a6304764fb3a24c1a4ba005605ec22eba1f82

See more details on using hashes here.

File details

Details for the file hyperscore-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: hyperscore-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 23.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.21 {"installer":{"name":"uv","version":"0.9.21","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for hyperscore-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 37a8480e6fb429d3401b3a8f5a69fffaa4120409af0efd48e25646b43a0a0393
MD5 77b60e39824ceb7f2894f774921b5e41
BLAKE2b-256 579bd5f244af2c6df103f355c8a6eb811a430a0adfa8770cf7066a3d48f08cdf

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page