This commit is contained in:
parent
7f9345b6f8
commit
3e04ee0dd7
1 changed files with 17 additions and 2 deletions
|
|
@ -20,16 +20,31 @@
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
// const inputArea = document.querySelector('#input');
|
// const inputArea = document.querySelector('#input');
|
||||||
|
const selectNoteLayout = document.querySelector('#select-note-layout');
|
||||||
const notesDiv = document.querySelector('#notes-held');
|
const notesDiv = document.querySelector('#notes-held');
|
||||||
const ctx = new AudioContext;
|
const ctx = new AudioContext;
|
||||||
const playing = {};
|
const playing = {};
|
||||||
let tone = {};
|
let tone = {};
|
||||||
addEventListener('keydown', onKeydown);
|
addEventListener('keydown', onKeydown);
|
||||||
addEventListener('keyup', onKeyup);
|
addEventListener('keyup', onKeyup);
|
||||||
useIsomorphic(2, 1);
|
useLayout(selectNoteLayout.value);
|
||||||
|
selectNoteLayout.onchange = function(ev) {
|
||||||
|
ev.preventDefault();
|
||||||
|
useLayout(ev.target.value);
|
||||||
|
}
|
||||||
|
|
||||||
|
function useLayout(layout) {
|
||||||
|
if (layout == 'classic') {
|
||||||
|
useClassicPiano();
|
||||||
|
} else if (layout == 'isomorphic-2-1') {
|
||||||
|
useIsomorphic(2, 1);
|
||||||
|
} else if (layout == 'isomorphic-5-2') {
|
||||||
|
useIsomorphic(5, 2);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// arrange notes like on a piano. the second and fourth rows are each a major scale, but the first and third rows have gaps.
|
// arrange notes like on a piano. the second and fourth rows are each a major scale, but the first and third rows have gaps.
|
||||||
function usePianoKeys() {
|
function useClassicPiano() {
|
||||||
tone = {};
|
tone = {};
|
||||||
("zsxdcvgbhnjm,l.;/q2w3e4rt6y7ui9o0p-[]"
|
("zsxdcvgbhnjm,l.;/q2w3e4rt6y7ui9o0p-[]"
|
||||||
.split('')
|
.split('')
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue