git.s-ol.nu isomorphic-kb-explorer / 5fabb4b
add Janko and traditional Piano layout s-ol 9 months ago
2 changed file(s) with 31 addition(s) and 4 deletion(s). Raw diff Collapse all Expand all
6464 return note;
6565 },
6666 },
67 janko: {
68 major: 'row',
69 map: ([x, y], [w, h]) => {
70 let note = 5 + 2 * x;
71 if (y % 2 == 0) note += 1;
72 return note;
73 },
74 },
75 trad_piano: {
76 major: 'row',
77 map: ([x, y], [w, h]) => {
78 const pitches = [0, 1, 2, 3, 4, -1, 5, 6, 7, 8, 9, 10, 11, -1];
79
80 let i = 2 * x;
81 if (y % 2 == 1) i -= 1;
82
83 const pitch = pitches[i % 14];
84 if (pitch < 0) return pitch;
85
86 const oct = Math.floor(i / 14) + Math.floor(y / 2);
87 return 10 + pitch + 12 * oct;
88 },
89 },
6790 harmonic: {
6891 // A = 3
6992 // B = 7 = y
137160 >
138161 {range(w).map((_, x) => (
139162 range(h).map((_, y) => {
140 const note = map([x, y], [w, h]) + transpose;
141 const onCore = scale && scale.notes.indexOf(note) >= 0;
142 const onScale = scale && scale.modulo.indexOf(note % 12) >= 0;
163 const rawNote = map([x, y], [w, h]);
164 const disabled = rawNote < 0;
165 const note = disabled ? -1 : rawNote + transpose;
166 const onCore = !disabled && scale && scale.notes.indexOf(note) >= 0;
167 const onScale = !disabled && scale && scale.modulo.indexOf(note % 12) >= 0;
143168 return (
144169 <Hexagon
145170 key={x + ',' + y}
150175 noteoff={noteoff}
151176 major={major}
152177 >
153 {labels ? labels[note % 12] : note}
178 {!disabled && (labels ? labels[note % 12] : note)}
154179 </Hexagon>
155180 );
156181 })
103103 <option value="wicki_hayden">Wicki-Hayden</option>
104104 <option value="harmonic">Harmonic Table</option>
105105 <option value="gerhard">Gerhard</option>
106 <option value="janko">Jankó</option>
107 <option value="trad_piano">Traditional Piano</option>
106108 </select>
107109 </div>
108110 <div className="group">