Created
November 26, 2016 19:59
-
-
Save tatecarson/dd3f373276d7271cd6877c5cb4200a5f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//make this into class | |
s.boot; | |
b = Buffer.alloc(s, 512,1); | |
d = Buffer.read(s, Platform.resourceDir +/+ "sounds/FW_kick loop_150bpm_3.wav"); | |
SynthDef(\tremolo, {arg inbus=0, outbus=0, freq=1, strength=1, obufnum, | |
bufnum = 0, rate = 1, trigger = 1, startPos = 1, loop = 1; | |
var fx, sig, mod; | |
/*sig = In.ar(inbus, 1);*/ | |
sig = PlayBuf.ar(1, bufnum, BufRateScale.kr(bufnum)*rate, trigger, BufFrames.ir(bufnum)*startPos, loop); | |
mod = Osc.ar(obufnum, freq, 0, strength); | |
fx = sig * mod; | |
Out.ar(outbus, (fx+ sig).dup ) | |
}).add; | |
~tremolo.() | |
//if i use a synthdef how do i start it? try replace out | |
c = Synth(\tremolo, [\bufnum, d.bufnum, \obufnum, b.bufnum]) | |
c.set(\freq, 5, \strength, 1) | |
Tdef(\test, { | |
inf.do({|i| | |
c.set(\freq, rrand(1, 50), \strength, rrand(0, 10), \rate, rrand(0.5, 2.0)); | |
1.wait; | |
}); | |
}).play; | |
Tdef(\test).stop; | |
s.boot; | |
b.sine1(1.0/[1,2,3,4], true, true, true).plot; | |
b.sine1(1.0/Array.series(90,1,1)*2, false, true, true).plot;// a saw wave: | |
b.sine1(Array.fill(50, {1.0.rand}), true, true, true).plot; | |
b.sine2([1.0, 3], [1, 0.5]); | |
( | |
a = Env([0, 1, 0.2, 0.3, 0.0, 0.3, 0], [0.1, 0.1, 0.1, 0.1, 0.1, 0.1], \step).asSignal(512); | |
b.setn(0, a); | |
) | |
a. | |
[neg, sign].asString.choose | |
//add unary operators for color | |
[x, x.neg, x.abs, x.sign, x.squared, x.cubed, | |
x.asin.normalize, x.exp.normalize, x.distort] | |
a = Env.linen(0.0, 1.0, 0.5, 0.5).asSignal(512); b.setn(0, a); | |
a = Env.linen(0.1, 0.2, 0.1, 0.6).asSignal(512); b.setn(0, a); | |
a = Env.linen(1, 2, 3, 0.6).asSignal(512); b.setn(0, a); | |
a = Env.linen(1, 2, 3, 0.6, \sine).asSignal(512); b.setn(0, a); | |
a = Env.linen(1, 2, 3, 0.6, \welch).asSignal(512); b.setn(0, a); | |
a = Env.linen(1, 2, 3, 0.6, -3).asSignal(512); b.setn(0, a); | |
a = Env.triangle(5).asSignal(512); b.setn(0, a); | |
a = Env.sine(1, 1).asSignal(512); b.setn(0, a).plot | |
a = Env.perc(0.05, 1, 1, -4).asSignal(512); b.setn(0, a); | |
a = Env.perc(0.001, 1, 1, -4).asSignal(512); b.setn(0, a); | |
a = Env.perc(0.001, 1, 1, -8).asSignal(512); b.setn(0, a); | |
a = Env.perc(1, 0.01, 1, 4).asSignal(512); b.setn(0, a); | |
a = Env.step([0.2, 0.3, 0.0, 1, 0.5], [0.2, 0.0, 1, 0.0, 0.1].normalizeSum).asSignal(512); b.setn(0, a) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment