User:Contribution/Chanofreq Project: Difference between revisions
Contribution (talk | contribs) No edit summary |
Contribution (talk | contribs) No edit summary |
||
| (32 intermediate revisions by the same user not shown) | |||
| Line 1: | Line 1: | ||
== WARNING! == | |||
'''WARNING!''' The Chanofreq project has been replaced by the [[User:Contribution/Chanopif Project|Chanopif project]]! | |||
== Chanofreq Project == | == Chanofreq Project == | ||
'''Objective:''' The Chanofreq project seeks to create a standardized file format that allows precise tuning of each note on every MIDI channel to a specific frequency. The aim is to achieve this using a minimalistic data structure that prioritizes efficiency and simplicity. | '''Objective:''' The Chanofreq project seeks to create a standardized file format that allows precise tuning of each note on every MIDI channel to a specific frequency. The aim is to achieve this using a minimalistic data structure that prioritizes efficiency and simplicity. | ||
| Line 19: | Line 22: | ||
* '''Z:''' A decimal number within the range '''minfreq''' ≤ Z < '''maxfreq''', representing the frequency in Hertz. This value is encoded as a positive integer by the parser with a bit depth defined by '''bitfreq''', using the formula: parser_frequency = int(((Z - minfreq) * (2 ** bitfreq) / (maxfreq - minfreq)) + 0.5). Original default settings are set to: minfreq = 0 Hz, maxfreq = 18446.744073709551616 Hz, and bitfreq = 64. Thus, Z has a precision of fifteen decimal places. Parsers designed for 32-bit hardware and software should adopt the alternative default settings: minfreq = 0 Hz, maxfreq = 21474.83648 Hz, and bitfreq = 32. By doing so, the Z frequencies specified by users for the original default mode remain compatible, and maintain a precision of five decimal places with an additional sixth decimal place rounded to either 0 or 5, offering a convenient solution. | * '''Z:''' A decimal number within the range '''minfreq''' ≤ Z < '''maxfreq''', representing the frequency in Hertz. This value is encoded as a positive integer by the parser with a bit depth defined by '''bitfreq''', using the formula: parser_frequency = int(((Z - minfreq) * (2 ** bitfreq) / (maxfreq - minfreq)) + 0.5). Original default settings are set to: minfreq = 0 Hz, maxfreq = 18446.744073709551616 Hz, and bitfreq = 64. Thus, Z has a precision of fifteen decimal places. Parsers designed for 32-bit hardware and software should adopt the alternative default settings: minfreq = 0 Hz, maxfreq = 21474.83648 Hz, and bitfreq = 32. By doing so, the Z frequencies specified by users for the original default mode remain compatible, and maintain a precision of five decimal places with an additional sixth decimal place rounded to either 0 or 5, offering a convenient solution. | ||
{{todo|Simplify|inline=1|comment=Use 64-bit | {{todo|Simplify|inline=1|comment=Use 64-bit floating-point precision as the default standard, and make the bitfreq workaround optional for systems not supporting 64-bit floats.}} | ||
Commands can be separated by a semicolon (';') or a newline. | Commands can be separated by a semicolon (';') or a newline. | ||
| Line 26: | Line 29: | ||
channel X1 note Y1 frequency Z1; channel X2 note Y2 frequency Z2 | channel X1 note Y1 frequency Z1; channel X2 note Y2 frequency Z2 | ||
channel X3 note Y3 frequency Z3 | channel X3 note Y3 frequency Z3 | ||
{{todo|'''Chanofreq Modes Implementation'''|inline=1|comment=Propose offering three distinct modes for chanofreq file structures: | |||
* '''chanofreq mode A''': define the frequencies for each note on every channel individually | |||
* '''chanofreq mode B''': define the frequencies for one channel, and an equave between each channel (a factor defined by a floating-point number) | |||
* '''chanofreq mode C''': define the frequencies for one or more starting notes (referred to as a pattern), a sub-equave between each repetition of the pattern within one channel (a factor defined by a floating-point number), and an equave between each channel (a factor defined by a floating-point number) | |||
'''Calculation:''' | |||
parser_frequency = frequency * (sub-equave ** p) * (equave ** c) | |||
'''Precision Handling:''' | |||
To maintain precision when the parser calculates frequencies using equaves or sub-equaves, implement the following options: | |||
* 64-bit Floating-Point Precision: This option simply sets the parser's frequency calculations to use 64-bit floats. (enough for mode A) | |||
* 128-bit Floating-Point Precision: This option increases calculation precision to 128-bit floats. (mandatory for modes B and C. Otherwise, the error is too big.) | |||
This precision level should be defined in the first line of the file with a specific syntax, for example: | |||
chanofreq version ?.?.? mode ? precision x4 | |||
* 64-bit floating-point precision: Denoted as precision x2 | |||
* 128-bit floating-point precision: Denoted as precision x4 | |||
Note: Even if 128-bit precision is used for internal calculations, the output frequencies can be rounded to 64-bit float for compatibility with software and hardware devices. | |||
'''Question:''' | |||
* Would it be advisable to offer modes B and C, given that significant errors can arise with 64-bit floats when using large exponents? | |||
'''Answer:''' | |||
* It should be fine to use 64-bit float, as long as no rounding is applied, we stay within the human hearing range, and the number of notes remains reasonable. For example, if [[125000edo|125,000-EDO]] is programmed from a base frequency (20 Hz) and a factor (1.000005545192819) with exponents to map the entire multi-channel keyboard, after 10 octaves (20480 Hz), one phase error occurs every 2.04 days between two adjacent 64-bit float factor values. For the [[402653184edo|402,653,184-EDO]] tuning scheme within chanofreq using factor and exponents, the phase precision between 64-bit float steps is only 78.9 seconds: 1/(440*(2**(-69/12))*1.0000000017214499**(402653184*(32/3)) - 440*(2**(-69/12))*1.0000000017214496**(402653184*(32/3))) = 78.9 seconds. | |||
In comparison, the phase precision between 32-bit steps in 402,653,184-EDO is 12.86 hours, as calculated here: 1/(440*2**((127-69)/12)*2**(1/402653184)-440*2**((127-69)/12))/(60*60) = 12.86 hours. | |||
This shows that even with 64-bit floating-point precision, the factor and exponent solution is far less efficient than other tuning methods, but remains practical for moderately sized musical scales up to approximately [[125000edo|125,000-EDO]], a size that still ensure a precision equivalent to 6 decimal places rounding in cents. However, using Mode B or C as a mediator for [[402653184edo|32-bit MIDI tuning]] should be avoided. | |||
'''Open Questions:''' | |||
* Should cents or intervals be allowed as an alternative to frequencies? In this case, a base frequency, base note, and base channel would be required. Refer to the .kbm format for guidance. For chanofreq, only a single file should be used to define the full multi-channel keyboard mapping. | |||
* Should hexadecimal representation of frequencies be allowed as an alternative to decimal? | |||
* Should the bitfreq workaround be maintained, or should the standard align with OddSound’s 64-bit floating-point format? | |||
}} | |||
== Syntax == | == Syntax == | ||