Skip to content

Instantly share code, notes, and snippets.

@wware
Last active October 23, 2018 02:55
Show Gist options
  • Save wware/32824164c1a66ef39782cf736c5652a7 to your computer and use it in GitHub Desktop.
Save wware/32824164c1a66ef39782cf736c5652a7 to your computer and use it in GitHub Desktop.
Another stupid electronic musical instrument

Instrument for 2018

Before spending time and money building a lot of electronics, let's prototype the thing in Javascript.

Hmm. Maybe a better idea would be to make up a board that accepts a Teensy 3.6, and provides audio hardware, and a bunch of pushbuttons and a few other controllers. Then you can develop code on a real Teensy with representative hardware support. When you go to the real instrument you're only changing the form factor, and maybe the number of buttons or switching to touch-sensitive or whatever.

Prior art - the Tooba, 2015

More prior art - the Megachordotron, 2016

Lori's ideas

  • Shape it like a hang drum, two spherical sections. Large enough to comfortably fit in your lap.
  • The chord stuff should be make I-IV-V very easy. Put lesser chords around them, maybe.
  • Borrow the strum bar from the QChord.
  • Pentatonic scale? In addition to chords? Instead of chords?

Brilliant JS keyboard and synth

<!DOCTYPE html>
<html>
<head>
<script src="https://tonejs.github.io/build/Tone.min.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script>
var synth = new Tone.Synth().toMaster();
$(document).ready(function(){
var doh = 'C';
var re = 'D';
var mi = 'E';
var so = 'G';
var la = 'A';
$("td").click(function(e){
var x = parseInt(e.target.textContent, 10);
// console.log(x);
var y = [
doh + '3', re + '3', mi + '3', so + '3', la + '3',
doh + '4', re + '4', mi + '4', so + '4', la + '4',
doh + '5', re + '5', mi + '5', so + '5', la + '5'
][x];
synth.triggerAttackRelease(y, '8n');
});
$("button").click(function(e){
var x = parseInt(e.target.textContent, 10);
var y = [
['C', 'D', 'E', 'G', 'A'],
['G', 'A', 'B', 'D', 'E'],
['F', 'G', 'A', 'C', 'D'],
['A', 'B', 'C#', 'E', 'F#'],
['D', 'E', 'F#', 'A', 'B']
][x];
doh = y[0]; re = y[1]; mi = y[2]; so = y[3]; la = y[4];
});
});
</script>
</head>
<body>
<table border="1">
<col width="80px">
<col width="80px">
<col width="80px">
<col width="80px">
<col width="80px">
<tr>
<td height="80px"><div style="display:none;">0</div></td>
<td height="80px"><div style="display:none;">1</div></td>
<td height="80px"><div style="display:none;">2</div></td>
<td height="80px"><div style="display:none;">3</div></td>
<td height="80px"><div style="display:none;">4</div></td>
</tr>
<tr>
<td height="80px"><div style="display:none;">5</div></td>
<td height="80px"><div style="display:none;">6</div></td>
<td height="80px"><div style="display:none;">7</div></td>
<td height="80px"><div style="display:none;">8</div></td>
<td height="80px"><div style="display:none;">9</div></td>
</tr>
<tr>
<td height="80px"><div style="display:none;">10</div></td>
<td height="80px"><div style="display:none;">11</div></td>
<td height="80px"><div style="display:none;">12</div></td>
<td height="80px"><div style="display:none;">13</div></td>
<td height="80px"><div style="display:none;">14</div></td>
</tr>
</table>
<button>0</button>
<button>1</button>
<button>2</button>
<button>3</button>
<button>4</button>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment