User:Contribution/Chanopif Project

From Xenharmonic Wiki
Jump to navigation Jump to search

Chanopif (short for Channel-Note-Pitch-Fractional pitch) is a proposed file format and specification designed to enable precise microtonal tuning for electronic and software-based musical instruments under the MIDI 2.0 standard. The format uses the .cnpf file extension and leverages the 7.25 pitch attribute (Registered Per-Note Controller #3) defined in MIDI 2.0 to achieve extremely fine pitch resolution—specifically 402,653,184 subdivisions per octave (402,653,184-EDO).

Etymology

The name Chanopif is derived from its four core elements:

  1. Cha-: Channel
  2. -no-: Note
  3. -pi-: Pitch
  4. -f: Fractional pitch

These components underscore the file format’s focus on assigning precise pitch data to specific MIDI channels and note numbers.

Background: MIDI 2.0 Pitch 7.25

In MIDI 2.0, Registered Per-Note Controller #3: Pitch 7.25 provides a high-resolution method for defining pitch beyond standard 12-tone equal temperament (12-EDO). The 32-bit data field for Pitch 7.25 is split into:

  • 7 bits for the integer part (the “traditional” note number in semitones).
  • 25 bits for the fractional part of a semitone.

This gives 2^7 = 128 distinct note values (as in MIDI 1.0), each further divided into 2^25 microsteps, resulting in a total of 402,653,184 equal divisions per octave (12 semitones × 2^25). This extreme resolution allows for microtonal tunings with a precision of 1.49 × 10^-6 cents.

File Format

A Chanopif (.cnpf) file is a plain-text file containing a series of lines. Each line follows the pattern:

channel_base10  noteNumber_base16  pitch_base16.fractionalPitch_base32

Where:

channel_base10

  • MIDI channel index, ranging from 1 to 256 in MIDI 2.0 (or 1 to 16 in MIDI 1.0).

noteNumber_base16

  • The MIDI note number expressed in hexadecimal, ranging from 00 to 7F.

pitch_base16

  • The 7-bit integer part (in hexadecimal) for semitone pitch, ranging from 00 to 7F.

fractionalPitch_base32

  • A 25-bit fractional part for microtonal precision, expressed in base 32 using the characters 0–9 and A–V. This base-32 representation spans values from 00000 (zero fraction) up to a maximum of VVVVV, that encodes all 2^25 subdivisions of a semitone. Each of the five characters encodes a 5-bit segment of the 25-bit word, with the total being 5×5=25 bits.

Exemple

An example line might be:

16 7F 7F.VVVVV

16 = MIDI channel 16

7F = MIDI note number in hex (127 in decimal)

7F.VVVVV :

  • 7F = pitch part in hex (127 in decimal)
  • VVVVV = fractional part in base 32 (33554431 in decimal)

Syntax

File identification and version declaration

The first line of a Chanopif file must declare the format and version to ensure compatibility:

chanopif version ?.?.?

Metadata support

Metadata is optional but, if included, should appear on the second line for quick identification without needing to scan the entire file. YAML is used, and fields are open-ended.

<meta>
YAML content
</meta>

Comments

Use # to insert a comment. Comments are ignored by the parser and do not affect the file's execution. They can be used to provide explanations or annotations within the file.

Nota bene: YAML metadata only supports inline comment.

# Inline comment

Tuning control

As described above:

channel_base10  noteNumber_base16  pitch_base16.fractionalPitch_base32

Upon loading a Chanopif file, all notes start in an inactive state. As each line is read, the specified note on the given channel becomes active with its assigned pitch and fractional pitch, or is updated if already active. After the entire file is processed, any notes that have not been defined remain inactive.

To calculate frequencies, the parser uses this formula:

frequency = 440 * 2^(((pitch_decimal - 69) + (fractional_pitch_decimal / (2^25))) / 12)
  • pitch_decimal is the 7-bit pitch portion, represented in hexadecimal within Chanopif, and converted internally to a value between 0 and 127.
  • fractional_pitch_decimal is the 25-bit fractional portion, represented in base 32 within Chanopif, and converted internally to a value between 0 and 2^25 - 1.

Examples

Examples of Chanopif files coding for a variety of tunings
Scale Equave steps (channel shift) Range File link
Carlos Alpha 9 (3/2) F0-F8 (8 octaves)
3\68 (Quartkeenlig) 23 (pseudo 2/1) F0-F8 (8 octaves)
127zpi (31-EDO Zeta stretch) 31 (pseudo 2/1) F0-F8 (8 octaves)
96-ED5/1 96 (5/1) F0-F8 (8 octaves)
380zpi (72-EDO Zeta stretch) 72 (pseudo 2/1) F0-F8 (8 octaves)
270-EDO 90, 180, 270 (1\3, 2\3, 2/1) F0-F8 (8 octaves)
311-EDO 128, 256, 311 F0-F8 (8 octaves)
Orwell[5], Orwell[9], Orwell[13], Orwell[22], Orwell[31], Orwell[53] Parallel tunings (1\1) Various
Icon-Todo.png Todo: Generate the eight files
Upload the files and insert their respective links here.

Implementation

Purpose

Chanopif’s primary objective is to facilitate unambiguous, universal microtonal tunings within the MIDI 2.0 ecosystem. By standardizing on 402,653,184-EDO and tuning per channel, Chanopif ensures that any note pitch, any tuning, can be represented consistently in .cnpf files. Key goals and benefits include:

  • Overcoming 128-Note Limitations: By combining multiple channels (up to 256 in MIDI 2.0), each with fully customized tuning for every note, composers can effectively bypass the traditional 128-note limitation of MIDI. This is especially beneficial for large-scale works requiring extensive microtonal ranges.
  • Flexibility: By assigning independant tuning configurations per channel, it becomes possible to create scales that do not rely on octave equivalence.
  • High Precision: At around 1.49 × 10^-6 cents per step, the resolution far exceeds what the human ear can typically discern, making it suitable for studio recording, live performance, or any scenario requiring advanced microtonal control. At 20,000 Hz, the maximum phase deviation caused by Chanopif’s rounding occurs only once every 16 hours.
  • Data Efficiency: By using the most concise syntax possible, compressing 7-bit words in hexadecimal and 25-bit words into 5 letters of 5-bit (base 32), it ensures optimal space savings in storage and transmission.
  • Compatibility: The format complies with the MIDI 2.0 standard, fully supporting the 7.25 pitch attribute for enhanced musical expression and precision.

Significance

  • Standardized Microtonal Implementation: By adopting a consistent 402,653,184-EDO approach, Chanopif eliminates ambiguity over how fractional pitches are interpreted.
  • Widespread Applications: Chanopif can be used to compose music that extends beyond the standard 128-note limit, allowing for large tuning systems, such as a full eight-octave 72-EDO scale (576 notes required) with optimal Riemann Zeta stretch. It also enables the development of new instruments, encourages experimentation with alternative scales, and supports hyper-accurate tuning for classical, jazz, electronic, and many other musical styles.
  • Future-Proof: Chanopif is designed to scale with evolving MIDI technology, leveraging the expanded channel range (up to 256) and high-definition capabilities of MIDI 2.0.

Simple Chanopif generator, validator, and parser in Python

Below is a minimal example demonstrating how to create, parse, and validate Chanopif (.cnpf) files using Python. It’s not intended as a complete or professional-grade solution—the author doesn’t have much time and isn’t a full-time developer. However, this sample code can serve as a helpful starting point for those who wish to explore Chanopif or refine it into a more robust implementation.

Icon-Todo.png Todo: Implement a basic Chanopif generator, validator, and parser in Python
Share the completed code here.

Roadmap

Build and Grow the Chanopif Community

  • Complete this Article: Provide a variety of Chanopif file examples to help users understand the format, and offer a basic Python-based generator, validator, and parser as an initial toolkit. This will serve as a practical foundation for anyone who wishes to explore, customize, or contribute to Chanopif.
  • Publish this Article: Make the current article widely available, showcasing the Chanopif format and inviting readers to join or start development efforts. By engaging passionate developers, students, and hobbyists worldwide, Chanopif can evolve into a fully-realized standard without requiring the originator to singlehandedly manage its technical progress.
  • Establish a Public Repository: Create a GitHub (or GitLab) organization for Chanopif to host reference implementations, issue tracking, and collaboration.
  • Set Up Communication Channels: Launch a dedicated forum, Discord server, or Discord forum channel where developers, composers, and enthusiasts can discuss ideas, share feedback, and coordinate efforts.
  • Encourage Contributions: Label starter issues or provide small, well-defined tasks for new contributors. Offer guidance to foster a welcoming environment for learners and seasoned coders alike.
  • Host Community Events: Organize virtual meetups, hackathons, or discussion sessions, enabling live collaboration on new features, bug fixes, or creative applications of Chanopif.
  • Seek Partnerships: Reach out to existing open-source projects, educational institutions, and commercial partners, inviting them to support or integrate Chanopif into their products and curricula.

Open-Source Development

  • Open-Source Libraries and Community Involvement: Since the primary initiator of Chanopif may lack the time and expertise to manage every aspect of development, the project relies on volunteer contributors for core coding tasks. An open-source Python library would be ideal, allowing the community to generate and manipulate Chanopif files. Contributors can create examples for tasks like building .cnpf files, and tools to generate 7.25 multi-channel tunings, ensuring the format’s long-term growth and maintenance.
  • Generator: Create a well-documented Python library that allows users to generate and manipulate Chanopif files with minimal effort. This library should be free to use, encourage community contributions, and include examples demonstrating common tasks like creating new .cnpf files and adjusting note pitches.
  • Validator: A validator ensures correctness of .cnpf files and data consistency, validates each line against the Chanopif format, reports errors or warnings, and helps maintain interoperability across various implementations. Community contributors can maintain and improve these tools, checking for valid channel ranges, note numbers, and fractional pitch values.
  • Parser: Develop a parser capable of reading .cnpf files and extracting tuning data for each MIDI channel and note. The parser should process the data to create a table that lists all frequency information associated with each MIDI channel and note as 64-bit floating-point values.
  • Multi-Language Expansion: In the future, volunteers might create libraries or wrappers in additional languages (C++, Rust, Java, etc.) to extend Chanopif’s reach. Different expertise levels can contribute, ensuring a broader user base and more robust integrations.
  • Continuous Integration and Testing: Relying on community input, the project can implement automated testing to maintain reliability and compatibility as the codebase grows. This includes unit tests and integration tests to verify core functionality and stability.
  • Roadmap and Milestones: A flexible roadmap would clarify and prioritize goals while welcoming contributions from diverse skill sets. Key milestones could include: completing and documenting a basic Python MVP ; supporting advanced features (real-time .cnpf creation, editing, GUI tools) ; collaborating with open-source communities and commercial developers to broaden adoption.

Adoption

  • Integration into Open-Source Virtual Synthesizers: To promote broad accessibility, Chanopif aims for direct support in open-source and free virtual synthesizers such as Surge XT. This would allow users worldwide to experiment with advanced tunings in a no-cost, community-driven environment.
  • Implementation in Free Tuning Generation Platforms: Encouraging tools like Scale Workshop to incorporate Chanopif would enable users to create, edit, and export complex tuning files effortlessly. By making this functionality available in a freely accessible platform, the community can explore and share custom scales more readily.
  • Collaboration with Oddsound: Working with Oddsound to include Chanopif compatibility in both the free MTS-ESP Mini plugin and the premium MTS-ESP Suite would significantly expand the format’s reach. Musicians could load Chanopif files directly into Oddsound’s microtuning ecosystem, fostering seamless integration across diverse digital audio workstations.
  • Adoption by Commercial Virtual Instrument Developers: Proprietary software synthesizers and samplers are a significant part of the modern music production landscape. Inviting commercial developers to adopt Chanopif in their products would bring multi-channel high-resolution microtonal flexibility to a wide audience, ensuring robust industry support and consistent user experiences.
  • Promotion through Official MIDI Organizations: Collaborate directly with the MIDI Association and other standardization bodies to advocate the inclusion of Chanopif specifications in official MIDI documentation. By partnering with recognized industry groups, the format can gain greater visibility, formal support, and ultimately become a seamless part of the evolving MIDI ecosystem.
  • Partnerships with Hardware Manufacturers: Finally, collaborating with companies that produce MIDI controllers and synthesizer hardware would open the door to advanced, real-time microtonal control. By incorporating Chanopif into hardware devices, musicians can harness ultra-precise tunings and extended note ranges in both studio and live performance contexts.

Education

  • Video Tutorials: Develop a series of in-depth YouTube videos to guide users through every aspect of Chanopif. These tutorials could range from basic introductions—covering the format’s structure and how to load .cnpf files—up to advanced sessions on microtonal composition and precision tuning.
  • Online Documentation and Guides: Provide well-structured web pages or a wiki dedicated to Chanopif, offering clear, step-by-step explanations on file creation, parsing, and integration into popular DAWs and virtual instruments. This resource would serve as a central hub for both beginners and experienced users.
  • Educational Outreach: Collaborate with music schools, universities, and audio engineering programs to include Chanopif in their curricula. By integrating .cnpf format instruction into music technology courses, students and future professionals gain hands-on experience in cutting-edge tuning techniques.
  • Artistic Outreach: Encourage musicians—whether they have large or modest followings—to experiment with Chanopif in their compositions, performances, or online content. Their demonstrations can help educate wider audiences, spark curiosity, and inspire fellow artists to explore microtonal possibilities via Chanopif files.
  • Workshops and Webinars: Host virtual and in-person events, such as webinars or local workshops, where participants can learn about Chanopif from experts. These interactive sessions would allow direct engagement, Q&A discussions, and real-time demonstrations.
  • Community Engagement: Encourage community-driven projects and user groups to explore Chanopif’s potential. Through forums, social media channels, and collaborative spaces, musicians, developers, and audio enthusiasts can share files, exchange tips, and push the boundaries of microtonal music creation.

See Also

MIDI 2.0 Specification – Official documentation covering new controllers, higher resolution, and enhanced expressiveness.

MIDI Tuning Standard (MTS) – Precursor to Pitch 7.25, offering microtuning capabilities in MIDI 1.0.

MTS-ESP – A C/C++ library that coordinates microtuning across multiple audio plugins, enabling a single master plugin to dynamically retune any connected client plugins in real time.

Disclaimer : Chanopif is a proposed format. Implementation details may vary based on hardware and software support for MIDI 2.0 Pitch 7.25. For the most accurate and up-to-date technical specifications, consult official MIDI 2.0 documentation.