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.1.0.tar.gz (16.6 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.1.0-py3-none-any.whl (22.4 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: hyperscore-0.1.0.tar.gz
  • Upload date:
  • Size: 16.6 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.1.0.tar.gz
Algorithm Hash digest
SHA256 7700c4c2b1f08dfd86709bb234925791cf35e2fabcf6198b5a3f35b5c0d10fbd
MD5 6c1e9d40afa9b83f420ad4a1fbc69535
BLAKE2b-256 4f5650b2f585a31ca5f04a031a649c8aa993044283e8d795f7925c370ccec691

See more details on using hashes here.

File details

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

File metadata

  • Download URL: hyperscore-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 22.4 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.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 c7b2391c3646c7cd5b51faa7e056cd47ec60904620df8c47a43da78d0c8fcd71
MD5 8b0dcaaa8c6be6df65b173724adeb164
BLAKE2b-256 66216adab2f11be3198994c2facc7ac69cdcce16b46d7864c54cc744aae59b71

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