-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy path3.- Sound Examples.scd
More file actions
151 lines (123 loc) · 2.88 KB
/
3.- Sound Examples.scd
File metadata and controls
151 lines (123 loc) · 2.88 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
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
/////////////////////////////////////////////////////
// SuperCollider – Simple Sine Wave SynthDef
/////////////////////////////////////////////////////
// Luis Sanz | Aug 2025 | www.luissanz.ch
/////////////////////////////////////////////////////
////////// 1. Simple Sine Wave SynthDef
(
SynthDef(\sineSimple, {
arg freq = 440, amp = 0.2, sustain = 1;
var env, sig;
// Envelope: percussive, can be controlled with \legato if needed
env = EnvGen.kr(Env.perc(0.01, sustain, 1, -4), doneAction:2);
// Sine wave oscillator
sig = SinOsc.ar(freq) * env * amp;
// Stereo output
Out.ar(0, sig ! 2);
}).add;
)
/*
Pbinds below use \degree with \scale to generate pitches
You can use arrays for chords or sequences for arpeggios
*/
// Example 1: Play a Scale
(
Pbind(
\instrument, \sineSimple,
\scale, Scale.major,
\degree, Pseq([0, 1, 2, 3, 4, 5, 6, 7], inf), // scale degrees
\octave, 5,
\dur, 0.25
).play;
)
// Example 2: Play Chords
(
Pbind(
\instrument, \sineSimple,
\scale, Scale.major,
\degree, Pseq([[0,2,4], [1,3,5], [2,4,6]], inf), // chords as arrays
\dur, 0.25
).play;
)
// 7th chords (minor scale example)
(
Pbind(
\instrument, \sineSimple,
\scale, Scale.minor,
\degree, Pseq([[0,2,4,6], [3,5,7,9]], inf),
\octave, 5,
\dur, 0.5
).play;
)
// Example 3: Arpeggios
(
Pbind(
\instrument, \sineSimple,
\scale, Scale.major,
\degree, Pseq([0,2,4,2], inf),
\octave, 5,
\dur, 0.25
).play;
)
// Example 4: Chord and Arpeggio Comparison
// Chord (all notes at once)
(
Pbind(
\instrument, \sineSimple,
\scale, Scale.major,
\degree, Pseq([[0,2,4]], inf),
\dur, 1
).play;
)
// Arpeggio (notes played sequentially)
(
Pbind(
\instrument, \sineSimple,
\scale, Scale.major,
\degree, Pseq([0,2,4], inf),
\dur, 0.25
).play;
)
// Strummed chord
(
Pbind(
\instrument, \sineSimple,
\scale, Scale.major,
\degree, Pseq([[0,2,4]], inf),
\dur, 1,
\strum, 0.08 // delay between chord notes
).play;
)
// Example 5: Legato / Staccato
// Short notes (staccato)
(
Pbind(
\instrument, \sineSimple,
\scale, Scale.major,
\degree, Pseq([0,2,4,5], inf),
\dur, 0.5,
\legato, 0.3 // note length = 30% of duration
).play;
)
// Overlapping notes (smooth legato)
(
Pbind(
\instrument, \sineSimple,
\scale, Scale.major,
\degree, Pseq([0,2,4,5], inf),
\dur, 0.5,
\legato, 1.5 // note length = 150% of duration
).play;
)
////////// Tips
/*
- \degree can be a single number or an array (for chords)
- \scale defines the scale context for degree numbers
- \octave shifts all notes
- \root shifts the scale root
- \dur is note duration in beats
- \dur = 1 → 1 beat (1 second at 60 bpm).
- \dur = 0.5 → half a beat (0.5 seconds at 60 bpm, 0.25 seconds at 120 bpm).
- \legato controls overlap between notes
- \strum adds delay between notes in a chord
*/