💾 Archived View for heavysquare.com › noise › 2019-04-01-insects.sc.txt captured on 2023-04-19 at 23:13:58.

View Raw

More Information

⬅️ Previous capture (2021-12-03)

-=-=-=-=-=-=-

/*

Lessons learnt from this session.

(a) RecordBuf loop is default 1, in case you want done, loop:0
(b) saving a buffer is simple
(c) Splay.ar(monosignal) is an easy way to make it stereo (instead of !2)



s.boot
ServerOptions.inDevices
b = Buffer.alloc(s, s.sampleRate * 4.0, 1)
{ RecordBuf.ar(AudioIn.ar(1),b,loop:0,doneAction:2) }.play
b.plot
b.normalize
b.write("/tmp/2019-04-01-base.aiff")

(
SynthDef(\ins,{|out=0,gate=1|
	Out.ar(out,
		EnvGen.kr(Env.asr(),gate,doneAction:2) *
		Splay.ar(
			PitchShift.ar(
				in:TGrains.ar(1,
					trigger:Dust.ar(40),
					bufnum:b,
					rate:Dwhite(1/2,2),
					centerPos:Dwhite(0,BufDur.kr(b)),
					dur:SinOsc.ar(5/7).fold(0.1,0.3),
					amp:0.3,
					interp:1),
				pitchDispersion:Saw.kr(1/2,2).fold(0.1,1),
				pitchRatio:SinOsc.kr(2.1,Saw.kr(1),6)
				.fold(0.6,[6,5,4,3]))))
}).add;
)

Pdef(\pins,Pfindur(30,Pmono(\ins)))
Pdef(\pins).record("/tmp/2019-04-01-insects.wav")