View source: R/cps_functions.R
keyboard_map | R Documentation |
Creates a keyboard map
keyboard_map(scale_table, middle_c_octave = 4)
scale_table |
a scale table from |
middle_c_octave |
octave number for middle C. There are varying conventions for the octave number for middle C. The default for this function is 4, but other software can use 3 or even some other number |
The function is currently hard-coded to compute the map so that
middle C with frequency .FREQ_MIDDLE_C
is mapped to MIDI note number
.NN_MIDDLE_C
and scale degree 0. With the current constants this is the
same as it is on 12EDO with A440 on note 69. This note is 6000 cents above
MIDI note number 0 in 12EDO.
Normally you would only use this to remap a keyboard to a scale with more than 12 notes per octave. For scales with 12 or fewer notes to the octave, it's easier to remap all octaves using the offsets computed with offset_matrix!
the keyboard map. This is a data.table with eight columns:
note_number
: the MIDI note number from .NN_MIN
through .NN_MAX
name_12edo
: note name of the key in 12EDO. This is the key you'd
normally press to play this note number
octave_12edo
: the octave the key normally plays
note_name
: the note name from the scale table
ratio_frac
: ratio for the note as a vulgar fraction. Note that for
equal tempered scales this is usually an approximation to an irrational
number. The algorithm used appears to give six decimal places of accuracy.
degree
: the scale degree of the note
octave
: the octave number of the note
freq
: the frequency in Hz
cents
: cents above lowest MIDI note .NN_MIN
, which has frequency
.FREQ_MIN
.
ref_keyname
: some synthesizers, including the Korg Minilogue XD,
let you retune a key as an offset in cents from another reference key.
This column is the name of that reference key.
ref_octave
: the octave number of the reference key
ref_offset
: the offset in cents from the reference key
# make sure we can print a whole keyboard map
options(max.print = 2000)
eikosany <- cps_scale_table(root_divisor = 33)
print(eikosany_keyboard_map <- keyboard_map(eikosany), nrows = 128)
# 12-EDO for sanity check
print(vanilla_keyboard_map <- keyboard_map(et_scale_table()), nrows = 128)
# check middle C setting
print(
eikosany_keyboard_map_c3 <-
keyboard_map(cps_scale_table(root_divisor = 33), middle_c_octave = 3), nrows = 128)
# Bohlen-Pierce (13 equal divisions of a perfect twelfth aka "tritave")
bohlen_pierce_et_scale <- et_scale_table(bohlen_pierce_et_names, period = 3)
print(bohlen_pierce_et_map <-
keyboard_map(bohlen_pierce_et_scale), nrows = 128)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.