@@ -18,7 +18,9 @@ Introduction
1818 :target: https://github.com/psf/black
1919 :alt: Code Style: Black
2020
21- A collection of helpers for processing MIDI notes and Control Change codes.
21+ A CircuitPython method collection for processing MIDI notes and Control Change codes. It currently consists of seven
22+ helpers for converting MIDI note values to and from frequency values and note name representations, and to provide
23+ descriptions of MIDI Control Change (CC) controller codes.
2224
2325
2426Dependencies
@@ -61,12 +63,12 @@ Usage Example
6163
6264``note_or_name(note) ``
6365
64- Bidirectionally translates a MIDI sequential note value to a note name or a note
65- name to a MIDI sequential note value. Note values are of integer type in the
66- range of 0 to 127 (inclusive). Note names are character strings expressed
67- in the NoteOctave format, such as 'C4' or 'G#7'. Note names can range from
68- 'C-1' (note value 0) to 'F#9' (note value 127). If the input value is outside
69- of the note value or name range, the value of ``None `` is returned.
66+ Bidirectionally translates a MIDI sequential note value to a note name
67+ or a note name to a MIDI sequential note value. Note values are integers in
68+ the range of 0 to 127 (inclusive). Note names are character strings
69+ expressed in the format NoteOctave such as 'C4' or 'G#7'. Note names range
70+ from 'C-1' (note value 0) to 'F#9' (note value 127). If the input value is
71+ outside the note value or name range, the value of ``None `` is returned.
7072
7173.. code-block :: python
7274
@@ -79,7 +81,7 @@ of the note value or name range, the value of ``None`` is returned.
7981 ``note_to_name(note) `` and ``name_to_note(name) ``
8082
8183Translates a MIDI sequential note value to a note name or note name to a note
82- value. Note values are of integer type in the range of 0 to 127 (inclusive).
84+ value. Note values are integers in the range of 0 to 127 (inclusive).
8385Note names are strings expressed in the NoteOctave format, such as 'C4' or
8486'G#7'. Note names can range from 'C-1' (note value 0) to 'F#9' (note value 127).
8587If the input value is outside the range, the value of ``None `` is returned.
@@ -95,8 +97,8 @@ If the input value is outside the range, the value of ``None`` is returned.
9597 ``note_to_frequency(note) `` and ``frequency_to_note(frequency) ``
9698
9799Translates a MIDI sequential note value to its corresponding frequency in
98- Hertz (Hz) or a frequency to its nearest note value. Note values are of integer
99- type in the range of 0 to 127 (inclusive). Frequency values are floating point.
100+ Hertz (Hz) or a frequency to a MIDI note value. Note values integers
101+ in the range of 0 to 127 (inclusive). Frequency values are floating point.
100102If the input is outside of the range, the value ``None `` is returned.
101103Ref: MIDI Tuning Standard formula: https://en.wikipedia.org/wiki/MIDI_tuning_standard
102104
@@ -108,6 +110,18 @@ Ref: MIDI Tuning Standard formula: https://en.wikipedia.org/wiki/MIDI_tuning_sta
108110 >> > frequency_to_note(261.63 )
109111 60
110112
113+ ``frequency_to_note_cents(frequency) ``
114+
115+ Translates a frequency in Hertz (Hz) to a MIDI sequential note value and
116+ positive offset in cents. Frequency values are floating point. Note values
117+ are integers in the range of 0 to 127 (inclusive). Cent values range from
118+ 0 to +100 cents. If the input frequency is less than the corresponding
119+ frequency for note 0 or greater than note 127, the note value cannot be
120+ determined and ``None `` is returned. Ref: MIDI Tuning Standard and cent
121+ formulae:
122+ https://en.wikipedia.org/wiki/MIDI_tuning_standard
123+ https://en.wikipedia.org/wiki/Cent_(music)
124+
111125``cc_code_to_description(cc_code) ``
112126
113127Provides a controller description decoded from a Control Change controller code
0 commit comments