User:Contribution/Chanopif Project: Difference between revisions
Contribution (talk | contribs) No edit summary |
Contribution (talk | contribs) No edit summary |
||
| Line 63: | Line 63: | ||
=== File identification and version declaration === | === File identification and version declaration === | ||
The first line of a Chanopif file must declare the format and version to ensure compatibility: | The first line of a Chanopif file must declare the format and version to ensure compatibility: | ||
chanopif version ?.?.? | <code>chanopif version ?.?.?</code> | ||
=== Metadata support === | === 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. | 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> | <code><meta> | ||
YAML content | YAML content | ||
</meta> | </meta></code> | ||
=== Comments === | === Comments === | ||
| Line 75: | Line 75: | ||
Nota bene: YAML metadata only supports inline comment. | Nota bene: YAML metadata only supports inline comment. | ||
# Inline comment | <code># Inline comment</code> | ||
=== Tuning control === | === Tuning control === | ||
As described above: | As described above: | ||
channel_base10 noteNumber_base16 pitch_base16.fractionalPitch_base32 | <code>channel_base10 noteNumber_base16 pitch_base16.fractionalPitch_base32</code> | ||
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. | 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: | To calculate frequencies, the parser uses this formula: | ||
frequency = 440 * 2^(((pitch_decimal - 69) + (fractional_pitch_decimal / (2^25))) / 12) | <code>frequency = 440 * 2^(((pitch_decimal - 69) + (fractional_pitch_decimal / (2^25))) / 12)</code> | ||
* '''pitch_decimal''' is the 7-bit pitch portion, represented in hexadecimal within Chanopif, and converted internally to a value between 0 and 127. | * '''pitch_decimal''' is the 7-bit pitch portion, represented in hexadecimal within Chanopif, and converted internally to a value between 0 and 127. | ||