-
Notifications
You must be signed in to change notification settings - Fork 0
/
synthdef.js
108 lines (101 loc) · 2.42 KB
/
synthdef.js
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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
var synthriver = flock.synth({
synthDef: {
ugen: "flock.ugen.scope",
// The playBuffer ugen plays back audio buffers loaded from a url or file.
// Currently, Flocking has support for .wav and .aiff files.
source: {
id: "player",
ugen: "flock.ugen.playBuffer",
buffer: {
id: "selectedSound", // The sound file will be loaded into an environment buffer named "selectedSound."
url: "sounds/river.mp3" // The File object selected by the #fileBrowser input element will be read.
},
speed: 1.0,
loop: 1.0
},
options: {
canvas: "#waveform",
styles: {
strokeColor: "#888",
strokeWidth: 5
}
}
}
});
var synthmoldau = flock.synth({
synthDef: {
ugen: "flock.ugen.playBuffer",
buffer: {
url: "sounds/moldau.mp3"
},
speed: 1.0,
loop: 1.0
}
});
var synthbirds = flock.synth({
synthDef: {
ugen: "flock.ugen.playBuffer",
buffer: {
url: "sounds/birds.mp3"
},
speed: 1.0,
loop: 1.0
}
});
var synthstone = flock.synth({
synthDef: {
ugen: "flock.ugen.playBuffer",
buffer: {
id: "chord",
url: "sounds/stone.mp3"
},
trigger: {
ugen: "flock.ugen.mouse.click"
}
}
});
var synthmouse = flock.synth({
synthDef: {
ugen: "flock.ugen.sin",
freq: {
ugen: "flock.ugen.value",
rate: "audio",
value: 1,
add: {
ugen: "flock.ugen.sin",
freq: {
ugen: "flock.ugen.mouse.cursor",
mul: 124,
add: 62,
},
mul: {
ugen: "flock.ugen.mouse.cursor",
mul: 50,
add: 50,
options: {
axis: "y"
}
}
}
},
mul: 0.3
}
});
var synthmic = flock.synth({
synthDef: {
ugen: "flock.ugen.granulator",
delayDur: 1,
numGrains: {
ugen: "flock.ugen.lfNoise",
freq: 0.5,
mul: 10,
add: 10,
options: {
interpolation: "linear"
}
},
source: {
ugen: "flock.ugen.audioIn"
}
}
});