From ad81e1d3deb0393275827b268511def7706a6269 Mon Sep 17 00:00:00 2001 From: Eric Rosenbaum Date: Tue, 10 Jan 2017 18:05:29 -0500 Subject: [PATCH] load and play drum sounds from drumplayer --- src/DrumPlayer.js | 40 +++++++++++++++++++++++++++++++++++----- src/index.js | 2 +- 2 files changed, 36 insertions(+), 6 deletions(-) diff --git a/src/DrumPlayer.js b/src/DrumPlayer.js index a7ea552..ff23bf8 100644 --- a/src/DrumPlayer.js +++ b/src/DrumPlayer.js @@ -4,13 +4,43 @@ var Tone = require('tone'); function DrumPlayer (outputNode) { this.outputNode = outputNode; - this.snare = new SoundPlayer(this.outputNode); - var snareUrl = 'https://raw.githubusercontent.com/LLK/scratch-audio/develop/sound-files/drums/SnareDrum(1)_22k.wav'; - this.snare.setBuffer(new Tone.Buffer(snareUrl)); + var baseUrl = 'https://raw.githubusercontent.com/LLK/scratch-audio/develop/sound-files/drums/'; + var fileNames = [ + 'SnareDrum(1)', + 'BassDrum(1b)', + 'SideStick(1)', + 'Crash(2)', + 'HiHatOpen(2)', + 'HiHatClosed(1)', + 'Tambourine(3)', + 'Clap(1)', + 'Claves(1)', + 'WoodBlock(1)', + 'Cowbell(3)', + 'Triangle(1)', + 'Bongo', + 'Conga(1)', + 'Cabasa(1)', + 'GuiroLong(1)', + 'Vibraslap(1)', + 'Cuica(2)' + ]; + + this.drumSounds = []; + + for (var i=0; i