Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //create a synth and connect it to the master output (your speakers)
- var synth = new Tone.Synth().toMaster();
- //Thank you W3.org
- function dotin(note, time, when) {
- return synth.triggerAttackRelease(note, time, when);
- }
- function rythm(beat, repeat) {
- count = 0;
- num = 7;
- tune = "" + num + "n";
- if(beat == null){
- bits = 1;
- }
- do{
- dotin("G4", tune, 1.2 + count * beat);
- dotin("C3", tune, 2 + count * beat);
- dotin("A3", tune, 2.3 + count * beat);
- dotin("G3", tune, 3 + count * beat);
- count = count + 1;
- } while (count < repeat);
- }
- // rythm();
- // beat repeats a note, rythme, or sound a number of times.
- function beat(beats, beat) {
- bit = 1;
- do {
- bit = bit + bit;
- rythm(beats, beat);
- }
- while (bit < beats);
- }
- beat(3, 5);
Add Comment
Please, Sign In to add comment