Repository navigation
Expand file tree
/
Copy pathlesson_4.scd
More file actions
124 lines (85 loc) · 3.58 KB
/
Copy pathlesson_4.scd
File metadata and controls
124 lines (85 loc) · 3.58 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
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
109
110
111
112
113
114
115
116
117
118
119
120
121
122
// Modulation Synthesis
// carrier * modulator
// In modulation synthesis one wave, the carrier, is influenced (modulated) by a second, the modulator.
// Modulation synthesis is easy to implement, providing computationally efficient shortcuts to complex dynamic spectra. The methods have their own unique sounds too, which can be musically useful.
// nick collins
// "http://composerprogrammer.com/teaching/supercollider/sctutorial/2.4 Modulation Synthesis.html"
// ring modulation
// straight forward
(
{
var carrier, modulator, carrfreq, modfreq;
carrfreq = MouseX.kr(440,5000,'exponential');
modfreq = MouseY.kr(1, 5000, 'exponential');
carrier=LFSaw.ar(carrfreq,0,0.5);
modulator=LFSaw.ar(modfreq,0,0.5);
carrier*modulator;
}.scope
)
{SinOsc.ar(440,0,0.5)}.scope //bipolar, -0.5 to 0.5
{SinOsc.ar(440,0,0.5,0.5)}.scope //unipolar, 0 to 1 (0.5 plus or minus 0.5)
(
{
var carrier, modulator, carrfreq, modfreq;
carrfreq= MouseX.kr(440,5000,'exponential');
modfreq= MouseY.kr(1,5000,'exponential');
carrier= LFSaw.ar(carrfreq,0,0.5);
modulator= LFSaw.ar(modfreq,0,0.25, 0.25);
carrier*modulator;
}.scope
)
{LFSaw.ar(MouseX.kr(60,140),0,1)}.scope;
// Frequency Modulation, Yamaha DX7, most commercially sucessful synth of all time
// FM developed by John Chowning
(
var w, carrfreqslider, modfreqslider, moddepthslider, synth;
w=Window("frequency modulation", Rect(100, 400, 400, 300));
w.view.decorator = FlowLayout(w.view.bounds);
synth= {
arg carrfreq=440, modfreq=1, moddepth=0.01;
SinOsc.ar(carrfreq + (moddepth*SinOsc.ar(modfreq)),0,0.25)
}.scope;
carrfreqslider= EZSlider(w, 300@50, "carrfreq", ControlSpec(20, 5000, 'exponential', 10, 440), {|ez| synth.set(\carrfreq, ez.value)});
w.view.decorator.nextLine;
modfreqslider= EZSlider(w, 300@50, "modfreq", ControlSpec(1, 5000, 'exponential', 1, 1), {|ez| synth.set(\modfreq, ez.value)});
w.view.decorator.nextLine;
moddepthslider= EZSlider(w, 300@50, "moddepth", ControlSpec(0.01, 5000, 'exponential', 0.01, 0.01), {|ez| synth.set(\moddepth, ez.value)});
w.front;
)
// frequency modulation via modulation index,
// I = D / M
(
var w, carrfreqslider, modfreqslider, modindexslider, synth;
w=Window("frequency modulation via modulation index", Rect(100, 400, 400, 300));
w.view.decorator = FlowLayout(w.view.bounds);
synth= {arg carrfreq=440, modfreq=1, modindex=0;
LFSaw.ar(carrfreq + (modindex*modfreq*LFSaw.ar(modfreq)),0,0.25)
}.scope;
carrfreqslider= EZSlider(w, 300@50, "carrfreq", ControlSpec(20, 5000, 'exponential', 10, 440), {|ez| synth.set(\carrfreq, ez.value)});
w.view.decorator.nextLine;
modfreqslider= EZSlider(w, 300@50, "modfreq", ControlSpec(1, 5000, 'exponential', 1, 1), {|ez| synth.set(\modfreq, ez.value)});
w.view.decorator.nextLine;
modindexslider= EZSlider(w, 300@50, "modindex", ControlSpec(0.0, 50, 'linear', 0.01, 0.0), {|ez| synth.set(\modindex, ez.value)});
w.front;
)
// simple mouse control version
(
{ var modfreq, modindex;
modfreq=MouseX.kr(1,440,'exponential');
modindex=MouseY.kr(0.0,10.0);
SinOsc.ar(SinOsc.ar(modfreq,0,modfreq*modindex,440),0,0.25);
}.scope
)
// harmonicity ratio, following Moore Elements of Computer Music
(
{
var carrfreq, modfreq, harmonicity, modindex;
//fc is frequency of carrier
//fm is frequency of modulator
carrfreq= 440; //MouseY.kr(330,550);
harmonicity= MouseX.kr(0,10).round(1);
modindex= MouseY.kr(0.0,10.0); //which is really modulation amplitude/modulation frequency, acts as brightness control as energy distribution changed over components
modfreq= carrfreq*harmonicity; //since harmonicity is an integer,
SinOsc.ar(carrfreq+(SinOsc.ar(modfreq)*modfreq*modindex), 0.0,0.1);
}.play
)