-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path10_sequence.html
More file actions
74 lines (56 loc) · 2.1 KB
/
Copy path10_sequence.html
File metadata and controls
74 lines (56 loc) · 2.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
<!DOCTYPE html>
<html>
<!--
Composition musicale avec des sons de synthèse et des structures proposées par Tone.js
NexusUI 2.1.6 http://nexus-js.github.io/ui/
Tone.js 14.7.39 https://github.com/Tonejs/Tone.js
Blueprint CSS 3.1.3 https://blueprintcss.dev/docs/grid
10 février 2022 / pierre@lesporteslogiques.net / Debian 9.5 @ kirin
https://github.com/emoc/webaudio_nexusui_tonejs
-->
<head>
<meta charset="utf-8">
<title>séquence</title>
<script src="./Tone.js"></script>
</head>
<body>
<button onclick="start();">START</button>
<button onclick="stop();">STOP</button>
<script>
// *************************** synth ******************************
const synth = new Tone.PolySynth(Tone.AMSynth, {
volume: -10,
}).toDestination();
const pattern = new Tone.Pattern(function(time, note){
synth.triggerAttackRelease(note, "16n");
}, ["C2", "D4", "E5", "A6"], "randomWalk").start(0);
pattern.loop = true;
pattern.interval = "8n";
// *************************** kick *******************************
const kick = new Tone.MembraneSynth({
octaves: 10,
pitchDecay: 0.01
}).toDestination();
const kickPart = new Tone.Loop(((time) => {
kick.triggerAttackRelease("C2", "8n", time);
}), "2n").start(0);
// *************************** bass *******************************
const bass = new Tone.MonoSynth({
volume: -10
}).toDestination();
const bassPart = new Tone.Sequence(((time, note) => {
bass.triggerAttackRelease(note, "16n", time);
}), ["C2", ["C3", ["C3", "D2"]], "E2", ["D2", "A1"]], "4n").start(0);
bassPart.probability = 0.9;
// ******************************************************************
function start() {
Tone.start();
Tone.Transport.bpm.value = 90;
Tone.Transport.start();
}
function stop() {
Tone.Transport.stop();
}
</script>
</body>
</html>