musicality 0.11.1 → 0.12.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.coveralls.yml +1 -0
- data/.ruby-version +1 -1
- data/.travis.yml +4 -0
- data/ChangeLog.md +11 -0
- data/README.md +3 -0
- data/Rakefile +11 -3
- data/lib/musicality/composition/model/rhythm.rb +33 -0
- data/lib/musicality/composition/model/rhythm_class.rb +30 -0
- data/lib/musicality/composition/sequencing/drum_machine/drum_kit.rb +18 -0
- data/lib/musicality/composition/sequencing/drum_machine/drum_machine.rb +59 -0
- data/lib/musicality/composition/sequencing/drum_machine/drum_parts.rb +21 -0
- data/lib/musicality/composition/sequencing/drum_machine/drum_pattern.rb +66 -0
- data/lib/musicality/composition/sequencing/drum_machine/drum_patterns/pop_drum_patterns.rb +146 -0
- data/lib/musicality/composition/sequencing/note_array.rb +33 -0
- data/lib/musicality/composition/sequencing/note_fifo.rb +73 -0
- data/lib/musicality/composition/sequencing/sequenceable.rb +9 -0
- data/lib/musicality/composition/sequencing/sequencer.rb +35 -0
- data/lib/musicality/errors.rb +2 -2
- data/lib/musicality/notation/model/dynamics.rb +2 -2
- data/lib/musicality/notation/model/key.rb +42 -91
- data/lib/musicality/notation/model/keys.rb +35 -34
- data/lib/musicality/notation/model/note.rb +31 -9
- data/lib/musicality/notation/model/pitch.rb +2 -2
- data/lib/musicality/notation/parsing/convenience_methods.rb +23 -12
- data/lib/musicality/notation/parsing/duration_parsing.rb +3 -3
- data/lib/musicality/notation/parsing/key_parsing.rb +150 -0
- data/lib/musicality/notation/parsing/key_parsing.treetop +37 -0
- data/lib/musicality/notation/parsing/meter_parsing.rb +3 -3
- data/lib/musicality/notation/parsing/numbers/nonnegative_float_parsing.rb +3 -1
- data/lib/musicality/notation/parsing/numbers/nonnegative_integer_parsing.rb +1 -0
- data/lib/musicality/notation/parsing/numbers/nonnegative_rational_parsing.rb +1 -1
- data/lib/musicality/notation/parsing/numbers/positive_float_parsing.rb +4 -1
- data/lib/musicality/notation/parsing/numbers/positive_rational_parsing.rb +1 -1
- data/lib/musicality/notation/parsing/parseable.rb +13 -17
- data/lib/musicality/notation/parsing/pitch_parsing.rb +7 -0
- data/lib/musicality/notation/parsing/segment_parsing.rb +3 -0
- data/lib/musicality/performance/conversion/note_sequence_extractor.rb +82 -134
- data/lib/musicality/performance/model/note_sequence.rb +22 -3
- data/lib/musicality/performance/supercollider/performer.rb +2 -2
- data/lib/musicality/performance/supercollider/sc_drum_kits.rb +29 -0
- data/lib/musicality/performance/supercollider/synthdefs/bass.rb +211 -0
- data/lib/musicality/performance/supercollider/synthdefs/claps.rb +80 -0
- data/lib/musicality/performance/supercollider/synthdefs/cymbals.rb +57 -0
- data/lib/musicality/performance/supercollider/synthdefs/hihats.rb +67 -0
- data/lib/musicality/performance/supercollider/synthdefs/kicks.rb +158 -0
- data/lib/musicality/performance/supercollider/synthdefs/mario.rb +49 -0
- data/lib/musicality/performance/supercollider/{synthdefs.rb → synthdefs/other.rb} +0 -767
- data/lib/musicality/performance/supercollider/synthdefs/pianos.rb +46 -0
- data/lib/musicality/performance/supercollider/synthdefs/snares.rb +169 -0
- data/lib/musicality/performance/supercollider/synthdefs/toms.rb +25 -0
- data/lib/musicality/performance/supercollider/synthdefs/volume.rb +20 -0
- data/lib/musicality/pitch_class.rb +1 -1
- data/lib/musicality/pitch_classes.rb +3 -5
- data/lib/musicality/version.rb +1 -1
- data/lib/musicality.rb +25 -1
- data/musicality.gemspec +3 -2
- data/spec/composition/convenience_methods_spec.rb +8 -8
- data/spec/composition/generation/random_rhythm_generator_spec.rb +5 -5
- data/spec/composition/model/pitch_class_spec.rb +22 -16
- data/spec/composition/model/pitch_classes_spec.rb +5 -5
- data/spec/composition/model/rhythm_class_spec.rb +42 -0
- data/spec/composition/model/rhythm_spec.rb +43 -0
- data/spec/composition/model/scale_class_spec.rb +26 -26
- data/spec/composition/model/scale_spec.rb +38 -38
- data/spec/composition/sequencing/drum_machine/drum_machine_spec.rb +67 -0
- data/spec/composition/sequencing/drum_machine/drum_pattern_spec.rb +58 -0
- data/spec/composition/sequencing/note_array_spec.rb +94 -0
- data/spec/composition/sequencing/note_fifo_spec.rb +183 -0
- data/spec/composition/sequencing/sequencer_spec.rb +76 -0
- data/spec/composition/util/adding_sequence_spec.rb +33 -33
- data/spec/composition/util/compound_sequence_spec.rb +6 -6
- data/spec/composition/util/note_generation_spec.rb +34 -34
- data/spec/composition/util/probabilities_spec.rb +7 -7
- data/spec/composition/util/random_sampler_spec.rb +3 -3
- data/spec/composition/util/repeating_sequence_spec.rb +28 -28
- data/spec/musicality_spec.rb +1 -1
- data/spec/notation/conversion/change_conversion_spec.rb +87 -87
- data/spec/notation/conversion/note_time_converter_spec.rb +22 -22
- data/spec/notation/conversion/score_conversion_spec.rb +1 -1
- data/spec/notation/conversion/score_converter_spec.rb +31 -31
- data/spec/notation/conversion/tempo_conversion_spec.rb +11 -11
- data/spec/notation/model/change_spec.rb +80 -80
- data/spec/notation/model/key_spec.rb +135 -69
- data/spec/notation/model/link_spec.rb +27 -27
- data/spec/notation/model/meter_spec.rb +28 -28
- data/spec/notation/model/note_spec.rb +68 -47
- data/spec/notation/model/part_spec.rb +19 -19
- data/spec/notation/model/pitch_spec.rb +69 -68
- data/spec/notation/model/score_spec.rb +50 -47
- data/spec/notation/parsing/articulation_parsing_spec.rb +4 -4
- data/spec/notation/parsing/convenience_methods_spec.rb +49 -10
- data/spec/notation/parsing/duration_nodes_spec.rb +13 -13
- data/spec/notation/parsing/duration_parsing_spec.rb +10 -10
- data/spec/notation/parsing/key_parsing_spec.rb +19 -0
- data/spec/notation/parsing/link_nodes_spec.rb +7 -7
- data/spec/notation/parsing/link_parsing_spec.rb +4 -4
- data/spec/notation/parsing/meter_parsing_spec.rb +5 -5
- data/spec/notation/parsing/note_node_spec.rb +19 -19
- data/spec/notation/parsing/note_parsing_spec.rb +4 -4
- data/spec/notation/parsing/numbers/nonnegative_float_spec.rb +8 -8
- data/spec/notation/parsing/numbers/nonnegative_integer_spec.rb +2 -2
- data/spec/notation/parsing/numbers/nonnegative_rational_spec.rb +1 -1
- data/spec/notation/parsing/numbers/positive_float_spec.rb +8 -8
- data/spec/notation/parsing/numbers/positive_integer_spec.rb +6 -6
- data/spec/notation/parsing/numbers/positive_rational_spec.rb +6 -6
- data/spec/notation/parsing/pitch_node_spec.rb +7 -7
- data/spec/notation/parsing/pitch_parsing_spec.rb +2 -2
- data/spec/notation/parsing/segment_parsing_spec.rb +3 -3
- data/spec/notation/util/function_spec.rb +15 -15
- data/spec/notation/util/transition_spec.rb +12 -12
- data/spec/notation/util/value_computer_spec.rb +35 -36
- data/spec/performance/conversion/glissando_converter_spec.rb +24 -24
- data/spec/performance/conversion/note_sequence_extractor_spec.rb +39 -39
- data/spec/performance/conversion/portamento_converter_spec.rb +23 -23
- data/spec/performance/midi/midi_util_spec.rb +41 -41
- data/spec/performance/midi/part_sequencer_spec.rb +10 -10
- data/spec/performance/midi/score_sequencer_spec.rb +15 -15
- data/spec/performance/midi/score_sequencing_spec.rb +2 -2
- data/spec/performance/util/optimization_spec.rb +9 -9
- data/spec/printing/note_engraving_spec.rb +16 -16
- data/spec/printing/score_engraver_spec.rb +5 -5
- data/spec/spec_helper.rb +5 -0
- metadata +85 -30
@@ -0,0 +1,211 @@
|
|
1
|
+
module Musicality
|
2
|
+
module SuperCollider
|
3
|
+
module SynthDefs
|
4
|
+
|
5
|
+
MOOG_BASS = SynthDef.new(name: "moogbass", params: { :out => 0, :freq => 440, :amp => 0.8, :gate => 1,
|
6
|
+
:cutoff => 1000, :gain => 2.0, :lagamount => 0.01, :pan => 0.0 },
|
7
|
+
body: <<-SCLANG,
|
8
|
+
var osc, filter, env, filterenv;
|
9
|
+
|
10
|
+
osc = Mix(VarSaw.ar(freq.lag(lagamount)*[1.0,1.001,2.0],Rand(0.0,1.0)!3,Rand(0.5,0.75)!3,0.33));
|
11
|
+
filterenv = EnvGen.ar(Env.adsr(0.2,0.0,1.0,0.2),gate,doneAction:2);
|
12
|
+
filter = MoogFF.ar(osc,cutoff*(1.0+(0.5*filterenv)),gain);
|
13
|
+
env = EnvGen.ar(Env.adsr(0.001,0.3,0.9,0.2),gate,doneAction:2);
|
14
|
+
|
15
|
+
Out.ar(out,Pan2.ar((0.7*filter+(0.3*filter.distort))*env*amp*1.5,pan));
|
16
|
+
SCLANG
|
17
|
+
credit: <<-EOS,
|
18
|
+
Sound recipes from:
|
19
|
+
Mitchell Sigman (2011) Steal this Sound. Milwaukee, WI: Hal Leonard Books
|
20
|
+
adapted for SuperCollider and elaborated by Nick Collins (http://www.sussex.ac.uk/Users/nc81/index.html)
|
21
|
+
under GNU GPL 3 as per SuperCollider license
|
22
|
+
EOS
|
23
|
+
source: "https://github.com/acarabott/roundhouse-synth-design-course-2014",
|
24
|
+
)
|
25
|
+
|
26
|
+
MOOG_BASS2 = SynthDef.new(name: "moogbass2", params: { :out => 0, :freq => 440, :amp => 0.8, :gate => 1,
|
27
|
+
:attackTime => 0.2, :fenvamount => 0.5, :cutoff => 1000, :gain => 2.0, :pan => 0.0 },
|
28
|
+
body: <<-SCLANG,
|
29
|
+
var osc, filter, env, filterenv;
|
30
|
+
|
31
|
+
//alternative: richer source
|
32
|
+
osc = Mix(Pulse.ar(freq.lag(0.05)*[1.0,1.001,2.0],Rand(0.45,0.5)!3,0.33));
|
33
|
+
filterenv = EnvGen.ar(Env.adsr(attackTime,0.0,1.0,0.2),gate,doneAction:2);
|
34
|
+
filter = MoogFF.ar(osc,cutoff*(1.0+(fenvamount*filterenv)),gain);
|
35
|
+
env = EnvGen.ar(Env.adsr(0.001,0.3,0.9,0.2),gate,doneAction:2);
|
36
|
+
|
37
|
+
Out.ar(out,Pan2.ar((0.7*filter+(0.3*filter.distort))*env*amp,pan));
|
38
|
+
SCLANG
|
39
|
+
credit: <<-EOS,
|
40
|
+
Sound recipes from:
|
41
|
+
Mitchell Sigman (2011) Steal this Sound. Milwaukee, WI: Hal Leonard Books
|
42
|
+
adapted for SuperCollider and elaborated by Nick Collins (http://www.sussex.ac.uk/Users/nc81/index.html)
|
43
|
+
under GNU GPL 3 as per SuperCollider license
|
44
|
+
EOS
|
45
|
+
source: "https://github.com/acarabott/roundhouse-synth-design-course-2014",
|
46
|
+
)
|
47
|
+
|
48
|
+
BASS_FOUNDATION = SynthDef.new(name: "bassfoundation", params: { :out => 0, :freq => 440, :amp => 0.8, :gate => 1,
|
49
|
+
:cutoff => 1000, :rq => 0.5, :pan => 0.0 },
|
50
|
+
body: <<-SCLANG,
|
51
|
+
var osc, filter, env, filterenv;
|
52
|
+
|
53
|
+
osc = Saw.ar(freq);
|
54
|
+
filterenv = EnvGen.ar(Env.adsr(0.0,0.5,0.2,0.2),gate,doneAction:2);
|
55
|
+
filter = RLPF.ar(osc,cutoff*filterenv+100,rq);
|
56
|
+
env = EnvGen.ar(Env.adsr(0.01,0.0,0.9,0.05),gate,doneAction:2);
|
57
|
+
|
58
|
+
Out.ar(out,Pan2.ar(filter*env*amp*2,pan));
|
59
|
+
SCLANG
|
60
|
+
credit: <<-EOS,
|
61
|
+
Sound recipes from:
|
62
|
+
Mitchell Sigman (2011) Steal this Sound. Milwaukee, WI: Hal Leonard Books
|
63
|
+
adapted for SuperCollider and elaborated by Nick Collins (http://www.sussex.ac.uk/Users/nc81/index.html)
|
64
|
+
under GNU GPL 3 as per SuperCollider license
|
65
|
+
EOS
|
66
|
+
source: "https://github.com/acarabott/roundhouse-synth-design-course-2014",
|
67
|
+
)
|
68
|
+
|
69
|
+
BASS_HIGHEND = SynthDef.new(name: "basshighend", params: { :out => 0, :freq => 440, :amp => 0.8, :gate => 1,
|
70
|
+
:cutoff => 3000, :rq => 0.1, :drive => 2.0, :pan => 0.0 },
|
71
|
+
body: <<-SCLANG,
|
72
|
+
var osc, filter, env, filterenv;
|
73
|
+
var ab;
|
74
|
+
|
75
|
+
//osc = Mix(VarSaw.ar(freq*[0.25,1,1.5],Rand(0.0,1.0)!3,0.9,[0.5,0.4,0.1]));
|
76
|
+
osc = Mix(Saw.ar(freq*[0.25,1,1.5],[0.5,0.4,0.1]));
|
77
|
+
//osc = Mix(DPW4Saw.ar(freq*[0.25,1,1.5],[0.5,0.4,0.1]));
|
78
|
+
filterenv = EnvGen.ar(Env.adsr(0.0,0.5,0.2,0.2),gate,doneAction:2);
|
79
|
+
filter = RLPF.ar(osc,cutoff*filterenv+100,rq);
|
80
|
+
|
81
|
+
//distortion
|
82
|
+
//filter = filter.distort.softclip;
|
83
|
+
|
84
|
+
ab = abs(filter);
|
85
|
+
filter = (filter*(ab + drive)/(filter ** 2 + (drive - 1) * ab + 1));
|
86
|
+
|
87
|
+
//remove low end
|
88
|
+
filter = BLowShelf.ar(filter,300,1.0,-12);
|
89
|
+
//dip at 1600Hz
|
90
|
+
filter = BPeakEQ.ar(filter,1600,1.0,-6);
|
91
|
+
|
92
|
+
env = EnvGen.ar(Env.adsr(0.01,0.0,0.9,0.05),gate,doneAction:2);
|
93
|
+
|
94
|
+
Out.ar(out,Pan2.ar(filter*env*amp*2,pan));
|
95
|
+
SCLANG
|
96
|
+
credit: <<-EOS,
|
97
|
+
Sound recipes from:
|
98
|
+
Mitchell Sigman (2011) Steal this Sound. Milwaukee, WI: Hal Leonard Books
|
99
|
+
adapted for SuperCollider and elaborated by Nick Collins (http://www.sussex.ac.uk/Users/nc81/index.html)
|
100
|
+
under GNU GPL 3 as per SuperCollider license
|
101
|
+
EOS
|
102
|
+
source: "https://github.com/acarabott/roundhouse-synth-design-course-2014",
|
103
|
+
)
|
104
|
+
|
105
|
+
FAT_VELOCITY_BASS = SynthDef.new(name: "fatvelocitybass", params: { :out => 0, :freq => 440, :amp => 0.5,
|
106
|
+
:gate => 1, :cutoff => 2000, :rq => 0.15, :lagTime => 0.01, :pan => 0.0 },
|
107
|
+
body: <<-SCLANG,
|
108
|
+
var lfo, osc, filter, env;
|
109
|
+
|
110
|
+
var basefreq = ((freq.lag(lagTime).cpsmidi)+[0,11.95,31.03]).midicps;
|
111
|
+
osc = Saw.ar(basefreq,[0.5,0.4,0.1]); //+PinkNoise.ar(Line.kr(1.0,0,0.03));
|
112
|
+
env = EnvGen.ar(Env.adsr(0.01,1.0,1.0,0.25),gate,doneAction:2);
|
113
|
+
filter = BLowPass4.ar(osc,100+((amp.squared)*(freq+cutoff)),rq);
|
114
|
+
|
115
|
+
Out.ar(out,Pan2.ar(Mix(filter)*env*amp*0.8,pan));
|
116
|
+
SCLANG
|
117
|
+
credit: <<-EOS,
|
118
|
+
Sound recipes from:
|
119
|
+
Mitchell Sigman (2011) Steal this Sound. Milwaukee, WI: Hal Leonard Books
|
120
|
+
adapted for SuperCollider and elaborated by Nick Collins (http://www.sussex.ac.uk/Users/nc81/index.html)
|
121
|
+
under GNU GPL 3 as per SuperCollider license
|
122
|
+
EOS
|
123
|
+
source: "https://github.com/acarabott/roundhouse-synth-design-course-2014",
|
124
|
+
)
|
125
|
+
|
126
|
+
BASS1 = SynthDef.new(name: "bass1", params: { :out => 0, :freq => 440, :gate => 1, :amp => 0.5, :slideTime => 0.17, :ffreq => 1100, :width => 0.15, :detune => 1.005, :preamp => 4 },
|
127
|
+
body: <<-SCLANG,
|
128
|
+
var sig, env;
|
129
|
+
env = Env.adsr(0.01, 0.3, 0.4, 0.1);
|
130
|
+
freq = Lag.kr(freq, slideTime);
|
131
|
+
sig = Mix(VarSaw.ar([freq, freq * detune], 0, width, preamp)).distort;
|
132
|
+
sig = sig * amp * EnvGen.kr(env, gate, doneAction: 2);
|
133
|
+
sig = LPF.ar(sig, ffreq);
|
134
|
+
Out.ar(out, sig ! 2)
|
135
|
+
SCLANG
|
136
|
+
source: "From https://github.com/brunoruviaro/SynthDefs-for-Patterns",
|
137
|
+
)
|
138
|
+
|
139
|
+
CHORD_BASS = SynthDef.new(name: "chord_bass", params: { :out => 0, :amp => 0.5, :sustain => 0.1, :freq => 90, :filtfreq1 => 7000, :filtfreq2 => 1000, :releaseTime => 0.5, :reverb => 0.1,:rq => 0.99 },
|
140
|
+
body: <<-SCLANG,
|
141
|
+
var env, sound;
|
142
|
+
env=EnvGen.ar(Env.perc(releaseTime:releaseTime),doneAction:2);
|
143
|
+
sound=FreeVerb.ar(RLPF.ar(LFSaw.ar(freq,0,amp),Line.kr(filtfreq1, filtfreq2,0.1),rq), reverb, 0.2, 0.5);
|
144
|
+
Out.ar(out,Pan2.ar(sound*env, 0.0))
|
145
|
+
SCLANG
|
146
|
+
source: "https://github.com/willieavendano/SC-SynthDefs/blob/master/DrumMachines",
|
147
|
+
)
|
148
|
+
|
149
|
+
MY_BASS = SynthDef.new(name: "my_bass", params: { :out => 0, :amp => 1, :sustain => 0.3, :freq => 90, :filtfreq1 => 7000, :filtfreq2 => 1000, :releaseTime => 0.5, :reverb => 0.3, :rq => 0.99 },
|
150
|
+
body: <<-SCLANG,
|
151
|
+
var env, sound;
|
152
|
+
env=EnvGen.ar(Env.perc(releaseTime:releaseTime),doneAction:2);
|
153
|
+
sound=FreeVerb.ar(RLPF.ar(LFTri.ar(freq,0,amp*2),Line.kr(filtfreq1, filtfreq2,0.1),rq) ,reverb, 0.2 ,0.5);
|
154
|
+
Out.ar(out,Pan2.ar(sound*env, 0.0))
|
155
|
+
SCLANG
|
156
|
+
source: "https://github.com/willieavendano/SC-SynthDefs/blob/master/DrumMachines",
|
157
|
+
)
|
158
|
+
|
159
|
+
BASS2 = SynthDef.new(name: "bass2", params: { :out => 0, :freq => 440, :gate => 1, :amp => 1.0, :slideTime => 0.17, :ffreq => 1100, :width => 0.15, :detune => 1.005, :preamp => 4, :dur => 0.2, :length => 0.2 },
|
160
|
+
body: <<-SCLANG,
|
161
|
+
var sig,
|
162
|
+
env = Env.adsr(0.01, 0.3, 0.4, 0.1);
|
163
|
+
freq = Lag.kr(freq, slideTime);
|
164
|
+
sig = Mix(VarSaw.ar([freq, freq * detune], 0, width, preamp)).distort * amp
|
165
|
+
* EnvGen.kr(env, gate * dur * length , doneAction: 2);
|
166
|
+
sig = LPF.ar(sig, ffreq);
|
167
|
+
Out.ar(out, sig ! 2)
|
168
|
+
SCLANG
|
169
|
+
source: "https://github.com/mtytel/supersongs/",
|
170
|
+
)
|
171
|
+
|
172
|
+
BASS_303 = SynthDef.new(name: "bass303", params: { :out => 0, :freq => 440, :gate => 1, :lpf => 1000, :res => 0.8, :width => 0.05, :amp => 1, :vol => 0.5 },
|
173
|
+
body: <<-SCLANG,
|
174
|
+
var sig, env;
|
175
|
+
var sig2, env2;
|
176
|
+
|
177
|
+
// ghetto 303
|
178
|
+
env = Env.adsr(0.05, 2, 0, 0.3, 0.8, -12);
|
179
|
+
sig = LFPulse.ar(freq, width: width) + Pulse.ar(freq, width: 0.9);
|
180
|
+
sig = sig * EnvGen.ar(env, gate, amp, doneAction: 2);
|
181
|
+
sig = RLPF.ar(sig, lpf, res);
|
182
|
+
|
183
|
+
env2 = Env.adsr(0.03, 2, 0, 0.3, 0.8, -13);
|
184
|
+
sig2 = LFPulse.ar(freq, width: width) + Pulse.ar(freq, width: 0.9);
|
185
|
+
sig2 = FreqShift.ar(sig2, 3);
|
186
|
+
sig2 = sig2 * EnvGen.ar(env2, gate, amp, doneAction: 2);
|
187
|
+
sig2 = RLPF.ar(sig2, lpf, res);
|
188
|
+
|
189
|
+
|
190
|
+
Out.ar(out, [sig * vol, sig2 * vol]);
|
191
|
+
|
192
|
+
SCLANG
|
193
|
+
source: "https://github.com/mattvears/supercollider-stuff",
|
194
|
+
)
|
195
|
+
|
196
|
+
BASS4 = SynthDef.new(name: "bass4", params: { :out => 0, :gate => 1, :freq => 440 },
|
197
|
+
body: <<-SCLANG,
|
198
|
+
var aEnv, fEnv, osc, flt;
|
199
|
+
aEnv = EnvGen.kr(Env.asr(0, 1, 1), gate, doneAction: 2);
|
200
|
+
fEnv = EnvGen.kr(Env.perc(0, 3), levelScale: 6000);
|
201
|
+
osc = Mix([Saw.ar(freq * [1, 1.005]), Pulse.ar(freq / 2, 0.5)]);
|
202
|
+
flt = LPF.ar(osc, fEnv + 100, aEnv);
|
203
|
+
Out.ar(out, flt);
|
204
|
+
SCLANG
|
205
|
+
credit: "From the Kraftwerk 'Spacelab' example in SuperCollider/examples by jy",
|
206
|
+
source: "https://github.com/acarabott/roundhouse-synth-design-course-2014",
|
207
|
+
)
|
208
|
+
|
209
|
+
end
|
210
|
+
end
|
211
|
+
end
|
@@ -0,0 +1,80 @@
|
|
1
|
+
module Musicality
|
2
|
+
module SuperCollider
|
3
|
+
module SynthDefs
|
4
|
+
|
5
|
+
ONECLAP = SynthDef.new(name: "oneclap", params: { :out => 0, :amp => 0.1, :filterfreq => 100, :rq => 0.1, :pan => 0 },
|
6
|
+
body: <<-SCLANG,
|
7
|
+
var env, signal, attack, noise, hpf1, hpf2;
|
8
|
+
noise = WhiteNoise.ar(1)+SinOsc.ar([filterfreq/2,filterfreq/2+4 ], pi*0.5, XLine.kr(1,0.01,4));
|
9
|
+
//noise = PinkNoise.ar(1)+SinOsc.ar([(filterfreq)*XLine.kr(1,0.01,3), (filterfreq+4)*XLine.kr(1,0.01,3) ], pi*0.5, XLine.kr(1,0.01,4));
|
10
|
+
//signal = signal * SinOsc.ar(1,0.75);
|
11
|
+
hpf1 = RLPF.ar(noise, filterfreq, rq);
|
12
|
+
hpf2 = RHPF.ar(noise, filterfreq/2, rq/4);
|
13
|
+
env = EnvGen.kr(Env.perc(0.003, 0.00035));
|
14
|
+
signal = (hpf1+hpf2) * env;
|
15
|
+
signal = CombC.ar(signal, 0.5, 0.03, 0.031)+CombC.ar(signal, 0.5, 0.03016, 0.06);
|
16
|
+
//signal = Decay2.ar(signal, 0.5);
|
17
|
+
signal = FreeVerb.ar(signal, 0.23, 0.15, 0.2);
|
18
|
+
Out.ar(out, Pan2.ar(signal * amp, pan));
|
19
|
+
DetectSilence.ar(signal, doneAction:2);
|
20
|
+
SCLANG
|
21
|
+
credit: "published on the sc-users list 2009-01-08 by thor",
|
22
|
+
source: "https://github.com/supercollider-quarks/SynthDefPool",
|
23
|
+
)
|
24
|
+
|
25
|
+
CLAP_OTO_309 = SynthDef.new(name: "clap_oto309", params: { :out => 0, :amp => 0.6, :pan => 0 },
|
26
|
+
body: <<-SCLANG,
|
27
|
+
var env1, env2, son, noise1, noise2;
|
28
|
+
|
29
|
+
env1 = EnvGen.ar(Env.new([0, 1, 0, 1, 0, 1, 0, 1, 0], [0.001, 0.013, 0, 0.01, 0, 0.01, 0, 0.03], [0, -3, 0, -3, 0, -3, 0, -4]));
|
30
|
+
env2 = EnvGen.ar(Env.new([0, 1, 0], [0.02, 0.3], [0, -4]), doneAction:2);
|
31
|
+
|
32
|
+
noise1 = WhiteNoise.ar(env1);
|
33
|
+
noise1 = HPF.ar(noise1, 600);
|
34
|
+
noise1 = BPF.ar(noise1, 2000, 3);
|
35
|
+
|
36
|
+
noise2 = WhiteNoise.ar(env2);
|
37
|
+
noise2 = HPF.ar(noise2, 1000);
|
38
|
+
noise2 = BPF.ar(noise2, 1200, 0.7, 0.7);
|
39
|
+
|
40
|
+
son = noise1 + noise2;
|
41
|
+
son = son * 2;
|
42
|
+
son = son.softclip * amp;
|
43
|
+
|
44
|
+
Out.ar(out, Pan2.ar(son, pan));
|
45
|
+
SCLANG
|
46
|
+
credit: "from 08091500Acid309 by_otophilia",
|
47
|
+
source: "https://github.com/supercollider-quarks/SynthDefPool",
|
48
|
+
)
|
49
|
+
|
50
|
+
CLAP1 = SynthDef.new(name: "clap1", params: { :out => 0, :amp => 0.5 },
|
51
|
+
body: <<-SCLANG,
|
52
|
+
var env1, env2, sig, noise1, noise2;
|
53
|
+
|
54
|
+
env1 = EnvGen.ar(Env(
|
55
|
+
[0, 1, 0, 1, 0, 1, 0, 1, 0],
|
56
|
+
[0.001, 0.013, 0, 0.01, 0, 0.01, 0, 0.03],
|
57
|
+
[0, -3, 0, -3, 0, -3, 0, -4]
|
58
|
+
));
|
59
|
+
env2 = EnvGen.ar(Env([0, 1, 0], [0.02, 0.3], [0, -4]), doneAction:2);
|
60
|
+
|
61
|
+
noise1 = WhiteNoise.ar(env1);
|
62
|
+
noise1 = HPF.ar(noise1, 600);
|
63
|
+
noise1 = BPF.ar(noise1, 2000, 3);
|
64
|
+
|
65
|
+
noise2 = WhiteNoise.ar(env2);
|
66
|
+
noise2 = HPF.ar(noise2, 1000);
|
67
|
+
noise2 = BPF.ar(noise2, 1200, 0.7, 0.7);
|
68
|
+
|
69
|
+
sig = noise1 + noise2;
|
70
|
+
sig = sig * 2;
|
71
|
+
sig = sig.softclip * amp;
|
72
|
+
|
73
|
+
Out.ar(out, sig.dup);
|
74
|
+
SCLANG
|
75
|
+
source: "https://github.com/acarabott/roundhouse-synth-design-course-2014",
|
76
|
+
)
|
77
|
+
|
78
|
+
end
|
79
|
+
end
|
80
|
+
end
|
@@ -0,0 +1,57 @@
|
|
1
|
+
module Musicality
|
2
|
+
module SuperCollider
|
3
|
+
module SynthDefs
|
4
|
+
|
5
|
+
CYMBAL_808 = SynthDef.new(name: "cymbal808", params: { :out => 0, :baseFreq => 300, :time => 250, :amp => 0.1 },
|
6
|
+
body: <<-SCLANG,
|
7
|
+
//var freqs = [baseFreq, baseFreq*1.3420, baseFreq*1.2312, baseFreq*1.6532, baseFreq*1.9523, baseFreq*2.1523];
|
8
|
+
//var freqs = [78.6, 140.44, 123.87, 219.4, 787.5, 531.3];
|
9
|
+
//var freqs = [205.35, 254.29, 294.03, 304.41, 369.64, 522.71];
|
10
|
+
var freqs = [205.35, 304.41, 369.64, 522.71, 540.54, 812.21];
|
11
|
+
var signal, pulseEnv;
|
12
|
+
|
13
|
+
pulseEnv = EnvGen.ar(Env.new([1.0, 0.6], [time], [-0.5]), timeScale:(1/1000));
|
14
|
+
signal = Mix.new(LFPulse.ar(freqs * 4.09));
|
15
|
+
signal = (BinaryOpUGen('==', signal, 6.0) * 0.6) + (BinaryOpUGen('==', signal, 2.0) * 0.2) + (BinaryOpUGen('==', signal, 1.0) * 0.9); // XOR
|
16
|
+
signal = (signal * pulseEnv) + (Mix.new(LFPulse.ar(freqs, width:0.55)) * 0.9);
|
17
|
+
signal = RLPF.ar(signal, 7000, 0.6);
|
18
|
+
signal = RHPF.ar(signal, 6800, 1.5);
|
19
|
+
signal = RHPF.ar(signal, 6800, 1.5);
|
20
|
+
signal = RHPF.ar(signal, 1200, 1.5);
|
21
|
+
signal = signal + FreeVerb.ar(signal);
|
22
|
+
signal = signal * EnvGen.ar(Env.new([0, 1, 0.4, 0, 0], [2, time, 50, 500], [0, -0.5, 0, -50]), timeScale:(1/1000), doneAction:2);
|
23
|
+
signal = [signal, DelayN.ar(signal, 0.005, 0.005)];
|
24
|
+
OffsetOut.ar(out, signal*amp ! 2);
|
25
|
+
SCLANG
|
26
|
+
credit: "Published on sc-users 2007-08-25 by Ryan Brown",
|
27
|
+
source: "https://github.com/supercollider-quarks/SynthDefPool",
|
28
|
+
)
|
29
|
+
|
30
|
+
CYMBALIC_MCLD = SynthDef.new(name: "cymbalic_mcld", params: { :out => 0, :pan => 0, :amp => 0.1,
|
31
|
+
:lo_attack => 0.1, :lo_release => 1, :hi_attack => 0.2, :hi_release => 1 },
|
32
|
+
body: <<-SCLANG,
|
33
|
+
var lodriver, locutoffenv, hidriver, hicutoffenv, freqs, res, thwack;
|
34
|
+
|
35
|
+
locutoffenv = EnvGen.ar(Env.perc(lo_attack, lo_release)) * 20000 + 10;
|
36
|
+
lodriver = LPF.ar(WhiteNoise.ar(0.1), locutoffenv);
|
37
|
+
|
38
|
+
hicutoffenv = 10001 - (EnvGen.ar(Env.perc(hi_attack, hi_release)) * 10000);
|
39
|
+
hidriver = HPF.ar(WhiteNoise.ar(0.1), hicutoffenv);
|
40
|
+
hidriver = hidriver * EnvGen.ar(Env.perc(hi_attack, hi_release * 0.75, 0.25));
|
41
|
+
|
42
|
+
thwack = EnvGen.ar(Env.perc(0.001,0.001,0.5));
|
43
|
+
|
44
|
+
// This bit will regenerate new freqs every time you evaluate the SynthDef!
|
45
|
+
freqs = {exprand(300, 20000)}.dup(100);
|
46
|
+
|
47
|
+
res = Ringz.ar(lodriver + hidriver + thwack, freqs).mean;
|
48
|
+
|
49
|
+
Out.ar(out, Pan2.ar(((res * 1) + (lodriver * 2) + thwack) * amp, pan));
|
50
|
+
SCLANG
|
51
|
+
credit: "Based on the example at http://www.mcld.co.uk/cymbalsynthesis/ published 2008 by Dan Stowell",
|
52
|
+
source: "https://github.com/supercollider-quarks/SynthDefPool",
|
53
|
+
)
|
54
|
+
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
@@ -0,0 +1,67 @@
|
|
1
|
+
module Musicality
|
2
|
+
module SuperCollider
|
3
|
+
module SynthDefs
|
4
|
+
|
5
|
+
HIHAT1 = SynthDef.new(name: 'hihat1', params: { :out => 0, :pan => 0, :amp => 1, :release => 0.2 },
|
6
|
+
body: <<-SCLANG,
|
7
|
+
var click, clickAmp;
|
8
|
+
var noise, noiseAmp;
|
9
|
+
var snd;
|
10
|
+
|
11
|
+
// noise -> resonance -> expodec envelope
|
12
|
+
noiseAmp = EnvGen.ar(Env.perc(0.001, release, curve: -8), doneAction: 2);
|
13
|
+
noise = Mix(BPF.ar(ClipNoise.ar, [4010, 4151], [0.15, 0.56], [1.0, 0.6])) * 0.7 * noiseAmp;
|
14
|
+
|
15
|
+
snd = noise;
|
16
|
+
|
17
|
+
Out.ar(out, Pan2.ar(snd, pan, amp));
|
18
|
+
SCLANG
|
19
|
+
source: "http://sccode.org/1-523"
|
20
|
+
)
|
21
|
+
|
22
|
+
HAT808 = SynthDef.new(name: "hat808", params: { :out => 0, :freq => 230, :hpf => 6500, :release => 0.15, :amp => 1, :fxb => 0, :fxv => 0, :bbcb => 0, :bbcv => 0 },
|
23
|
+
body: <<-SCLANG,
|
24
|
+
var pulse, sig, env, freqs;
|
25
|
+
freqs = [freq, freq*1.4471, freq*1.617, freq*1.9265, freq*2.5028, freq*2.6637];
|
26
|
+
pulse = Mix.ar(Pulse.ar(freqs, {0.9.rand}!6, mul: 0.15));
|
27
|
+
sig = RHPF.ar(RHPF.ar(pulse, hpf), hpf);
|
28
|
+
env = EnvGen.kr(Env.perc(0,release),doneAction:2);
|
29
|
+
sig = sig*env;
|
30
|
+
Out.ar(out, Pan2.ar(sig*amp,0));
|
31
|
+
SCLANG
|
32
|
+
credit: "Christoph Kummerer",
|
33
|
+
source: "http://new-supercollider-mailing-lists-forums-use-these.2681727.n2.nabble.com/High-Hats-td4823993.html"
|
34
|
+
)
|
35
|
+
|
36
|
+
CLOSED_HAT = SynthDef.new(name: "closedhat", params: { :out => 0, :lpf => 8000, :hpf => 2400, :amp => 1 },
|
37
|
+
body: <<-SCLANG,
|
38
|
+
var hatosc, hatenv, hatnoise, hatoutput;
|
39
|
+
|
40
|
+
hatnoise = {LPF.ar(WhiteNoise.ar(1),lpf)};
|
41
|
+
hatosc = {HPF.ar(hatnoise,hpf)};
|
42
|
+
hatenv = {Line.ar(1, 0, 0.1)};
|
43
|
+
hatoutput = (hatosc * hatenv);
|
44
|
+
|
45
|
+
Out.ar(out, Pan2.ar(hatoutput*amp, 0));
|
46
|
+
SCLANG
|
47
|
+
source: "https://github.com/willieavendano/SC-SynthDefs/blob/master/DrumMachines",
|
48
|
+
)
|
49
|
+
|
50
|
+
OPEN_HAT = SynthDef.new(name: 'openhat', params: { :out => 0, :lpf => 6000, :hpf => 2000, :amp => 1 },
|
51
|
+
body: <<-SCLANG,
|
52
|
+
var hatosc, hatenv, hatnoise, hatoutput;
|
53
|
+
|
54
|
+
hatnoise = {LPF.ar(WhiteNoise.ar(1),lpf)};
|
55
|
+
hatosc = {HPF.ar(hatnoise,hpf)};
|
56
|
+
hatenv = {Line.ar(1, 0, 0.3)};
|
57
|
+
hatoutput = (hatosc * hatenv);
|
58
|
+
|
59
|
+
Out.ar(out, Pan2.ar(hatoutput*amp, 0));
|
60
|
+
SCLANG
|
61
|
+
credit: "Rumblesan",
|
62
|
+
source: "http://blog.rumblesan.com/post/53271713518/drum-sounds-in-supercollider-part-1"
|
63
|
+
)
|
64
|
+
|
65
|
+
end
|
66
|
+
end
|
67
|
+
end
|
@@ -0,0 +1,158 @@
|
|
1
|
+
module Musicality
|
2
|
+
module SuperCollider
|
3
|
+
module SynthDefs
|
4
|
+
#
|
5
|
+
# KICK808 = SynthDef.new(name: "kick808", params: { :out => 0 },
|
6
|
+
# body: <<-SCLANG,
|
7
|
+
# var sig = LPF.ar(Ringz.ar(Impulse.ar(0), 60, 1), 500);
|
8
|
+
# var cmp = CompanderD.ar(sig, -20.dbamp, 1, 0.3, 0.003, 0.08);
|
9
|
+
#
|
10
|
+
# cmp = cmp * (10.dbamp);
|
11
|
+
# Out.ar(out, cmp.dup);
|
12
|
+
# SCLANG
|
13
|
+
# source: "https://github.com/acarabott/roundhouse-synth-design-course-2014"
|
14
|
+
# )
|
15
|
+
|
16
|
+
|
17
|
+
KICK808 = SynthDef.new(name: "kick808", params: { :out => 0, :freq => 440, :amp => 0.1,
|
18
|
+
:ringTime => 10.0, :releaseTime => 1.0, :distortion => 0.1, :pan => -0.1 },
|
19
|
+
body: <<-SCLANG,
|
20
|
+
var impulse, filter, env;
|
21
|
+
|
22
|
+
impulse = Impulse.ar(0);
|
23
|
+
filter = Ringz.ar(impulse,XLine.ar(freq,60,0.1),ringTime);
|
24
|
+
env = EnvGen.ar(Env.perc(0.001,releaseTime),doneAction:2);
|
25
|
+
filter = (1.0-distortion)*filter + (distortion*(filter.distort));
|
26
|
+
|
27
|
+
Out.ar(out,Pan2.ar(filter*env*amp,pan));
|
28
|
+
SCLANG
|
29
|
+
credit: <<-EOS,
|
30
|
+
Sound recipes from:
|
31
|
+
Mitchell Sigman (2011) Steal this Sound. Milwaukee, WI: Hal Leonard Books
|
32
|
+
adapted for SuperCollider and elaborated by Nick Collins (http://www.sussex.ac.uk/Users/nc81/index.html)
|
33
|
+
under GNU GPL 3 as per SuperCollider license
|
34
|
+
EOS
|
35
|
+
source: "https://github.com/acarabott/roundhouse-synth-design-course-2014",
|
36
|
+
)
|
37
|
+
|
38
|
+
KICK2 = SynthDef.new(name: "kick2", params: { :out => 0, :amp => 0.2 },
|
39
|
+
body: <<-SCLANG,
|
40
|
+
var env0, env1, env1m, sig;
|
41
|
+
|
42
|
+
env0 = EnvGen.ar(
|
43
|
+
Env([0.5, 1, 0.5, 0], [0.005, 0.06, 0.26], [-4, -2, -4]), doneAction:2
|
44
|
+
);
|
45
|
+
env1 = EnvGen.ar(Env([110, 59, 29], [0.005, 0.29], [-4, -5]));
|
46
|
+
env1m = env1.midicps;
|
47
|
+
|
48
|
+
sig = LFPulse.ar(env1m, 0, 0.5, 1, -0.5);
|
49
|
+
sig = sig + WhiteNoise.ar(1);
|
50
|
+
sig = LPF.ar(sig, env1m * 1.5, env0);
|
51
|
+
sig = sig + SinOsc.ar(env1m, 0.5, env0);
|
52
|
+
|
53
|
+
sig = sig * 1.2;
|
54
|
+
sig = sig.clip2(1);
|
55
|
+
|
56
|
+
Out.ar(out, sig.dup * amp);
|
57
|
+
SCLANG
|
58
|
+
credit: "Reformatted for the Roundhouse Synth Design course from 08091500Acid309 by otophilia from SuperCollider/examples folder",
|
59
|
+
source: "https://github.com/acarabott/roundhouse-synth-design-course-2014",
|
60
|
+
)
|
61
|
+
|
62
|
+
KICK3 = SynthDef.new(name: "kick3", params: { :out => 0, :punch => 1, :amp => 1 },
|
63
|
+
body: <<-SCLANG,
|
64
|
+
var freq = EnvGen.kr(Env([400, 66], [0.08], -3)),
|
65
|
+
sig = Normalizer.ar(SinOsc.ar(freq, 0.5pi, punch).distort, 1) * amp
|
66
|
+
* EnvGen.kr(Env([0, 1, 0.8, 0], [0.01, 0.1, 0.2]), doneAction: 2);
|
67
|
+
Out.ar(out, sig ! 2);
|
68
|
+
SCLANG
|
69
|
+
source: "From https://github.com/brunoruviaro/SynthDefs-for-Patterns",
|
70
|
+
)
|
71
|
+
|
72
|
+
RING_KICK = SynthDef.new(name: "ringkick", params: { :out => 0, :freq => 40, :decay => 0.05, :amp => 1 },
|
73
|
+
body: <<-SCLANG,
|
74
|
+
var snd;
|
75
|
+
snd = Ringz.ar(
|
76
|
+
in: LPF.ar(
|
77
|
+
in: Impulse.ar(0),
|
78
|
+
freq: 1000),
|
79
|
+
freq: freq,
|
80
|
+
decaytime: decay,
|
81
|
+
mul: 7 * amp).tanh.sin*2;
|
82
|
+
Out.ar(out, snd!2);
|
83
|
+
SCLANG
|
84
|
+
source: "From https://github.com/brunoruviaro/SynthDefs-for-Patterns",
|
85
|
+
)
|
86
|
+
|
87
|
+
KICK_CHIRP = SynthDef.new(name: "kick_chrp", params: { :out => 0, :amp => 1, :pan => 0 },
|
88
|
+
body: <<-SCLANG,
|
89
|
+
// a kick made using what radio folks would call a "chirp"
|
90
|
+
var ampenv, pitchenv;
|
91
|
+
|
92
|
+
ampenv = EnvGen.ar(Env.perc(0, 0.2, curve: 0), doneAction: 2);
|
93
|
+
pitchenv = EnvGen.ar(Env.perc(0, 0.1, curve: -20).exprange(0, 1000), doneAction: 0);
|
94
|
+
|
95
|
+
Out.ar(out, Pan2.ar(SinOsc.ar(pitchenv) * amp, pan));
|
96
|
+
SCLANG
|
97
|
+
credit: "by dan stowell. public domain",
|
98
|
+
source: "https://github.com/supercollider-quarks/SynthDefPool",
|
99
|
+
)
|
100
|
+
|
101
|
+
KICK_OTO_309 = SynthDef.new(name: "kick_oto309", params: { :out => 0, :amp => 0.1, :pan => 0 },
|
102
|
+
body: <<-SCLANG,
|
103
|
+
var env0, env1, env1m, son;
|
104
|
+
|
105
|
+
env0 = EnvGen.ar(Env.new([0.5, 1, 0.5, 0], [0.005, 0.06, 0.26], [-4, -2, -4]), doneAction:2);
|
106
|
+
env1 = EnvGen.ar(Env.new([110, 59, 29], [0.005, 0.29], [-4, -5]));
|
107
|
+
env1m = env1.midicps;
|
108
|
+
|
109
|
+
son = LFPulse.ar(env1m, 0, 0.5, 1, -0.5);
|
110
|
+
son = son + WhiteNoise.ar(1);
|
111
|
+
son = LPF.ar(son, env1m*1.5, env0);
|
112
|
+
son = son + SinOsc.ar(env1m, 0.5, env0);
|
113
|
+
|
114
|
+
son = son * 1.2;
|
115
|
+
son = son.clip2(1);
|
116
|
+
|
117
|
+
Out.ar(out, Pan2.ar(son * amp));
|
118
|
+
SCLANG
|
119
|
+
credit: "from 08091500Acid309 by_otophilia",
|
120
|
+
source: "https://github.com/supercollider-quarks/SynthDefPool",
|
121
|
+
)
|
122
|
+
|
123
|
+
|
124
|
+
# KIK = SynthDef.new(name: "kik", params: { :out => 0, :basefreq => 50, :ratio => 7, :sweeptime => 0.05, :preamp => 1, :amp => 1, :decay1 => 0.3, :decay1L => 0.8, :decay2 => 0.15 },
|
125
|
+
# body: <<-SCLANG,
|
126
|
+
# var fcurve = EnvGen.kr(Env([basefreq * ratio, basefreq], [sweeptime], \exp)),
|
127
|
+
# env = EnvGen.kr(Env([1, decay1L, 0], [decay1, decay2], -4), doneAction: 2),
|
128
|
+
# sig = SinOsc.ar(fcurve, 0.5pi, preamp).distort * env * amp;
|
129
|
+
# Out.ar(out, sig ! 2)
|
130
|
+
# SCLANG
|
131
|
+
# source: "From https://github.com/brunoruviaro/SynthDefs-for-Patterns",
|
132
|
+
# )
|
133
|
+
|
134
|
+
DRUM_KICK = SynthDef.new(name: "drum_kick", params: { :out => 0, :freq => 440, :gate => 1, :amp => 0.8, :source => nil,:pan => 0.0 },
|
135
|
+
body: <<-SCLANG,
|
136
|
+
var x1, x2, x3;
|
137
|
+
|
138
|
+
x1 = SinOsc.ar(EnvGen.kr(Env.perc(0.0001, 1.5, 1, -200), gate, 1000, 45, doneAction:2), 1, 1);
|
139
|
+
x2 = ((BPF.ar([GrayNoise.ar(6),GrayNoise.ar(6)],EnvGen.kr(Env.perc(0.001, 0.3, 1, -200), gate, 6000, 70), 1.5)).distort * Line.kr(0.3,0,0.1));
|
140
|
+
x3 = EnvGen.kr(Env.perc(0.0001, 0.09, amp, 8));
|
141
|
+
source = Pan2.ar(x1 + x2 * x3, 0);
|
142
|
+
Out.ar(out, source);
|
143
|
+
SCLANG
|
144
|
+
source: "https://github.com/willieavendano/SC-SynthDefs/blob/master/DrumMachines",
|
145
|
+
)
|
146
|
+
|
147
|
+
KICK1 = SynthDef.new(name: "kick", params: { :out => 0, :amp => 1, :dur => 0.05 },
|
148
|
+
body: <<-SCLANG,
|
149
|
+
var tone;
|
150
|
+
tone = SinOsc.ar(XLine.ar(800,2,dur*4, mul: 0.2, doneAction:2));
|
151
|
+
Out.ar(out, amp * tone.dup * XLine.ar(2,1/1000,dur*4));
|
152
|
+
SCLANG
|
153
|
+
source: "https://github.com/bwestergard/supercollider-experiments",
|
154
|
+
)
|
155
|
+
|
156
|
+
end
|
157
|
+
end
|
158
|
+
end
|
@@ -0,0 +1,49 @@
|
|
1
|
+
module Musicality
|
2
|
+
module SuperCollider
|
3
|
+
module SynthDefs
|
4
|
+
|
5
|
+
MARIO = SynthDef.new(name: "mario", params: { :out => 0, :freq => 440, :length => 0.1, :dur => 0.2 },
|
6
|
+
body: <<-SCLANG,
|
7
|
+
var snd, amp;
|
8
|
+
snd = LFPulse.ar(freq)!2;
|
9
|
+
amp = LFTri.ar(freq/50)!2;
|
10
|
+
snd = snd * EnvGen.ar(Env.linen(0.001, length * dur, 0.03), doneAction:2);
|
11
|
+
OffsetOut.ar(out, snd*amp);
|
12
|
+
SCLANG
|
13
|
+
source: "https://github.com/mtytel/supersongs/",
|
14
|
+
)
|
15
|
+
|
16
|
+
MARIO_BASS = SynthDef.new(name: "mariobass", params: { :out => 0, :amp => 1.0, :freq => 440, :length => 0.1, :dur => 0.2 },
|
17
|
+
body: <<-SCLANG,
|
18
|
+
var snd;
|
19
|
+
snd = LFTri.ar(freq)!2;
|
20
|
+
snd = snd * EnvGen.ar(Env.linen(0.001, length * dur, 0.03), doneAction:2);
|
21
|
+
OffsetOut.ar(out, snd*amp);
|
22
|
+
SCLANG
|
23
|
+
source: "https://github.com/mtytel/supersongs/",
|
24
|
+
)
|
25
|
+
|
26
|
+
BEAT = SynthDef.new(name: "beat", params: { :out => 0, :amp => 1.0, :sustain => 0.1, :dur => 0.1 },
|
27
|
+
body: <<-SCLANG,
|
28
|
+
var snd;
|
29
|
+
snd = BrownNoise.ar()!2;
|
30
|
+
snd = HPF.ar(snd, 2000);
|
31
|
+
snd = snd * EnvGen.ar(Env.linen(0.005, dur * sustain, 0.01), doneAction:2);
|
32
|
+
OffsetOut.ar(out, snd*amp);
|
33
|
+
SCLANG
|
34
|
+
source: "https://github.com/mtytel/supersongs/",
|
35
|
+
)
|
36
|
+
|
37
|
+
BOOP = SynthDef.new(name: "boop", params: { :out => 0, :dur => 1.0, :amp => 1.0, :freq => 440 },
|
38
|
+
body: <<-SCLANG,
|
39
|
+
var env, sig;
|
40
|
+
env = EnvGen.ar(Env.new([1, 0.1, 0], [0.06, dur - 0.06]), doneAction: 2);
|
41
|
+
sig = LFTri.ar([freq * 0.995, freq * 1.005], 0, env * amp);
|
42
|
+
Out.ar(out, sig ! 2);
|
43
|
+
SCLANG
|
44
|
+
source: "https://github.com/mtytel/supersongs/",
|
45
|
+
)
|
46
|
+
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|