User:Contribution/Chanofreq Project: Difference between revisions

Contribution (talk | contribs)
Contribution (talk | contribs)
Line 18: Line 18:
* '''X:''' An integer ≥ 1, representing the MIDI channel.
* '''X:''' An integer ≥ 1, representing the MIDI channel.
* '''Y:''' An integer ≥ 0, representing the note number.
* '''Y:''' An integer ≥ 0, representing the note number.
* '''Z:''' A 64-bit floating-point number > 0, representing the frequency in Hertz.
* '''Z:''' A decimal number within the range of '''minfreq''' to '''maxfreq''', representing the frequency in Hertz. This value is encoded by the parser as a positive integer with a bit depth defined by '''bitfreq'''. Each increment of this integer corresponds to a frequency size of (maxfreq - minfreq) / 2^bitfreq.


{{todo|Considerations for Frequency Representation|inline=1|comment=Consider to use a different data type for representing frequencies. Instead of a 64-bit floating-point number, a 32-bit positive integer could be used. Here are two possible approaches:
By default, the parameters are set as follows: minfreq = 0 Hz, maxfreq = 21474.83648 Hz, and bitfreq = 32. This way, Z has a precision of five decimal places with an additional sixth decimal place that must be either 0 or 5. This design is optimized for compatibility with the human hearing range and 32-bit hardware and software systems, while minimizing phase errors across all frequencies. In the worst-case scenario, 1 phase error would occur approximately once every 4.6 days. The default settings are suitable for most common applications, but there is flexibility to modify '''minfreq''', '''maxfreq''', and to utilize larger integer data types with '''bitfreq''' as needed.
* Option 1: The 32-bit positive integer represents the frequency in Hertz multiplied by 10^5. This would provide a frequency range from 0.00000 Hz to 42949.67295 Hz with a precision of exactly five decimal places.
* Option 2: The 32-bit positive integer represents the frequency in Hertz multiplied by 2×10^5. This would cover a frequency range from 0.000000 Hz to 21474.836475 Hz, with a precision of five decimal places and an additional decimal place that must be either 0 or 5.
These alternatives offer more efficient data storage while preserving the necessary precision for frequency values. They result in consistent minimum time for phase error whatever the frequency.
* Option 1: 1 phase error occurs every 2.3 days at worst.
* '''Option 2: 1 phase error occurs every 4.6 days at worst. Better adapted to human hearing range, option 2 is the most efficient.'''}}


Commands can be separated by a semicolon (';') or a newline.
Commands can be separated by a semicolon (';') or a newline.