xxxxxxxxxx
83
var synth;
var notes;
synth = new Tone.PolySynth({
"volume": -5,
"envelope": {
"attack": 0.1,
"decay": 0.3,
"release": 2,
}
}).toMaster();
synth.set({
"oscillator" : {
"type" : "triangle"
},
// "filter" : { . //doesn't change anything
// "Q": 20,
// "type": "lowpass",
// "rolloff": -12
// },
})
// // for one Tone.Part event for both lines,
// // but cannot have different durations for different lines
// var chord1 = ["Bb3","A2"];
// var chord2 = ["A3","A2"];
// var chord3 = ["A3","A2"];
// var chord4 = ["G#3","A2"];
// var chord5 = ["G#3","A2"];
// var chord6 = ["F3","A2"];
// var chord7 = ["F3","A2"];
// var chord8 = ["E3","A2"];
Tone.Transport.bpm.value = 40;
var synthPart = new Tone.Part(function(time, notes) {
synth.triggerAttackRelease(notes, "8n", time);
}, [
["0:0:0", "Bb3"],
["0:0:1", "A3"],
["0:0:3", "A3"],
["0:1:0", "G#3"],
["0:1:2", "G#3"],
["0:1:3", "F3"],
["0:2:1", "F3"],
["0:2:2", "E3"],
// ["0:0:0", chord1],
// ["0:0:1", chord2],
// ["0:0:3", chord3],
// ["0:1:0", chord4],
// ["0:1:2", chord5],
// ["0:1:3", chord6],
// ["0:2:1", chord7],
// ["0:2:2", chord8],
]).start();
synthPart.loop = true;
synthPart.loopEnd = "0:3:0";
var dronePart = new Tone.Part(function(time, notes) {
synth.triggerAttackRelease(notes, "8n", time);
}, [
["0:0:0", "A2"],
]).start();
dronePart.loop = true;
dronePart.loopEnd = "16n";
//transpose by half step from 1 half step to an octave
//(n=1; n <= 12; n ++) n controlled by mouseX.
// var transposedNotes = Tone.Frequency(notes).transpose(n);
// synth.triggerAttackRelease(transposedNotes, "16n", "16n", 0.3);
function setup() {
synthPart.start();
dronePart.start();
Tone.Transport.start();
}
function draw() {
background(220);
}