Skip to main content

MTXT Music Text Format - Python bindings

Project description

MTXT - Music Text Format - Python Bindings

This is a Python binding to the MTXT library. See their readme for more information on the project and format details.

What is MTXT?

MTXT is a human-editable, text-based format for representing musical performance data. It stores events with precise timing, pitch, and expression values in a simple line-based structure that's easy to edit without requiring specialized tools.

The format is designed for cases where exact performance details matter - arbitrary timings, micro-tuning, dynamic changes, and other expressive parameters. MTXT avoids binary encoding, making it suitable for manual and AI-assisted editing.

Usage

import mtxt

# Parse MTXT
file = mtxt.parse("""mtxt 1.0
0 tempo 120
0 note C4 dur=1 vel=0.8
""")
# Or using file I/O
file = mtxt.load("song.mtxt")
file.save("output.mtxt")


# Access properties
print(file.version)           # "1.0"
print(file.duration)          # 0.0 (beats)
print(file.get_meta("title")) # metadata


# MIDI conversion
file.to_midi("output.mid")
file_from_midi = mtxt.MtxtFile.from_midi("output.mid")

# Print as mtxt string
print(file_from_midi)
# Prints: MtxtFile(version=Some("1.0"), records=3, duration=Some(0.0))
print(repr(file_from_midi))

How to build the library

pip install maturin
maturin develop --features python,midi

# run tests
pytest tests/python/

For more details on the MTXT format specification and CLI options, see the main MTXT repository.

License

Original MTXT library: Copyright © 2025 Dani Biró Python bindings: Copyright © 2026 Sven Hollowell

MTXT specification and reference implementation are dual-licensed under the Apache-2.0 license or the MIT license, at your option.

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

mtxt-0.9.0.tar.gz (65.9 kB view details)

Uploaded Source

Built Distribution

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

mtxt-0.9.0-cp310-cp310-macosx_11_0_arm64.whl (379.6 kB view details)

Uploaded CPython 3.10macOS 11.0+ ARM64

File details

Details for the file mtxt-0.9.0.tar.gz.

File metadata

  • Download URL: mtxt-0.9.0.tar.gz
  • Upload date:
  • Size: 65.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: maturin/1.11.5

File hashes

Hashes for mtxt-0.9.0.tar.gz
Algorithm Hash digest
SHA256 f4cef689d749bb6bef639df521502428cffe9072e6a59009838d4ad14cb34723
MD5 fcf357c4b9e85596ac1e38a3f8200208
BLAKE2b-256 2302c5e3728bb298b75e560074f534158c5c08e2a81073c119201a01b98f1ff0

See more details on using hashes here.

File details

Details for the file mtxt-0.9.0-cp310-cp310-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for mtxt-0.9.0-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 e5f671540045d65d69d27712217102dbf25330e04bd68e1302a9faa3cab9336d
MD5 144b6d53d24aec83a0efb28efcc49b15
BLAKE2b-256 5b8b6f9c33336aae0d2fc6d12f91f0e9c6b57491b3a790549ffed765dff37f44

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