64 | 64 |
return note;
|
65 | 65 |
},
|
66 | 66 |
},
|
|
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 |
},
|
67 | 90 |
harmonic: {
|
68 | 91 |
// A = 3
|
69 | 92 |
// B = 7 = y
|
|
137 | 160 |
>
|
138 | 161 |
{range(w).map((_, x) => (
|
139 | 162 |
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;
|
143 | 168 |
return (
|
144 | 169 |
<Hexagon
|
145 | 170 |
key={x + ',' + y}
|
|
150 | 175 |
noteoff={noteoff}
|
151 | 176 |
major={major}
|
152 | 177 |
>
|
153 | |
{labels ? labels[note % 12] : note}
|
|
178 |
{!disabled && (labels ? labels[note % 12] : note)}
|
154 | 179 |
</Hexagon>
|
155 | 180 |
);
|
156 | 181 |
})
|