diff options
Diffstat (limited to 'client/lib/kalimba.js')
| -rw-r--r-- | client/lib/kalimba.js | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/client/lib/kalimba.js b/client/lib/kalimba.js index d3cafbb..249560f 100644 --- a/client/lib/kalimba.js +++ b/client/lib/kalimba.js @@ -1,10 +1,9 @@ import Tone from 'tone' import { choice } from './util' +import output from './output' const player_count = 4 -const compressor = new Tone.Compressor(-30, 3).toMaster() - const samples = [ { root: 226, fn: 'samples/380737__cabled-mess__sansula-01-a-raw.wav', }, { root: 267, fn: 'samples/380736__cabled-mess__sansula-02-c-raw.wav', }, @@ -28,12 +27,21 @@ samples.forEach((sample) => { retrigger: true, playbackRate: 1, }) - player.connect(compressor) + player.connect(output) sample.players.push(player) } }) function play (freq) { +/* + while (freq < 440) { + freq *= 2 + } + while (freq > 880) { + freq /= 2 + } + freq /= 2 +*/ const best = { sample: choice(samples) } best.sample.index = (best.sample.index + 1) % player_count @@ -41,6 +49,9 @@ function play (freq) { player.playbackRate = freq / best.sample.root player.start() } +function pause () { + // no-op +} -export default { play } +export default { play, pause } |
