User:Contribution/Chanopif Project: Difference between revisions
Contribution (talk | contribs) |
Contribution (talk | contribs) No edit summary |
||
| Line 55: | Line 55: | ||
* 7F = pitch part in hex (127 in decimal) | * 7F = pitch part in hex (127 in decimal) | ||
* VVVVV = fractional part in base 32 (33554431 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 === | |||
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. | |||
# Inline comment | |||
Nota bene: YAML metadata only supports inline comment. | |||
=== Tuning control === | |||
As described bellow, use: | |||
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 (or is updated if already active) with its assigned pitch and fractional pitch. 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) / 12 + (fractional_pitch_decimal / 2^25)) | |||
pitch_decimal is the integer portion of the Pitch 7.25 value (0–127 in decimal). | |||
fractional_pitch is the 25-bit fractional portion, represented in base 32 within Chanopif and converted internally to a value between 0 and 2^25 - 1. | |||
== Purpose and Implementation == | == Purpose and Implementation == | ||