research, and more learning
							parent
							
								
									074982afc4
								
							
						
					
					
						commit
						f49064448b
					
				
							
								
								
									
										126
									
								
								ark_d.scd
								
								
								
								
							
							
						
						
									
										126
									
								
								ark_d.scd
								
								
								
								
							| 
						 | 
					@ -10,13 +10,14 @@ Server.default.waitForBoot {
 | 
				
			||||||
	var smpPath = PathName(thisProcess.nowExecutingPath.dirname +/+ "smp");
 | 
						var smpPath = PathName(thisProcess.nowExecutingPath.dirname +/+ "smp");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	// load samples //
 | 
						// load samples //
 | 
				
			||||||
 | 
						"\n--- load samples: ...".postln;
 | 
				
			||||||
	
 | 
						
 | 
				
			||||||
	~smpBuffers.do(_.free); //- free all buffers so we don't accumulate?
 | 
						~smpBuffers.do(_.free); //- free all buffers so we don't accumulate?
 | 
				
			||||||
	~smpBuffers = List();
 | 
						~smpBuffers = List();
 | 
				
			||||||
	
 | 
						
 | 
				
			||||||
	smpPath.filesDo({ |smpfile|
 | 
						smpPath.filesDo({ |smpfile,i|
 | 
				
			||||||
		// tell me what you are loading:
 | 
							// tell me what you are loading:
 | 
				
			||||||
		postln("~~~ loading >" + smpfile.fileName + "<");
 | 
							postln("   " + i + smpfile.fileName );
 | 
				
			||||||
		
 | 
							
 | 
				
			||||||
		// add a sample into a buffer, store object to List
 | 
							// add a sample into a buffer, store object to List
 | 
				
			||||||
		~smpBuffers.add(Buffer.readChannel(s, smpfile.fullPath, channels:[0]));
 | 
							~smpBuffers.add(Buffer.readChannel(s, smpfile.fullPath, channels:[0]));
 | 
				
			||||||
| 
						 | 
					@ -24,11 +25,12 @@ Server.default.waitForBoot {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	// load libs //
 | 
						// load libs //
 | 
				
			||||||
 | 
						"\n--- load libs: ...".postln;
 | 
				
			||||||
	
 | 
						
 | 
				
			||||||
	// for each files in that lib folder 
 | 
						// for each files in that lib folder 
 | 
				
			||||||
	libPath.filesDo({|afile|
 | 
						libPath.filesDo({|afile|
 | 
				
			||||||
		// tell me what you're executing:
 | 
							// tell me what you're executing:
 | 
				
			||||||
		postln("   ." + afile.fileName);
 | 
							postln("    ." + afile.fileName);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		// execute it:
 | 
							// execute it:
 | 
				
			||||||
		this.executeFile(afile.fullPath);	
 | 
							this.executeFile(afile.fullPath);	
 | 
				
			||||||
| 
						 | 
					@ -55,41 +57,84 @@ y.set(\gate, 0)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
z = Synth(\bufPlayer, [\bufnum, ~smpBuffers.at(0)])
 | 
					z = Synth(\bufPlayer, [\bufnum, ~smpBuffers.at(0)])
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
///////////////////////////////////////////////////////////////////////////////////////////
 | 
					///////////////////////////////////////////////////////////////////////////////////////////
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					~smpBuffers[1].plot
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
(
 | 
					(
 | 
				
			||||||
SynthDef(\sinPulz, {
 | 
					Ndef(\bosc, {
 | 
				
			||||||
	arg gate = 1, freq, out=0, amp = 1, attackTime=0.01, releaseTime=1, oscDetune=0.05, cutoff=1;
 | 
						var buffer = ~smpBuffers[2], freq = 30, oscDetune = 1.01, amp = 0.2;
 | 
				
			||||||
	var snd, env;
 | 
						BufRd.ar(1, bufnum:buffer, phase: LFSaw.ar([freq,freq*oscDetune]) * BufFrames.ir(buffer)) * amp
 | 
				
			||||||
 | 
						//+ SinOsc.ar(60.2) * 0.5;
 | 
				
			||||||
	oscDetune = oscDetune * 0.1 + 1;
 | 
					} );
 | 
				
			||||||
 | 
					 | 
				
			||||||
	env = Linen.kr(gate, attackTime:attackTime, releaseTime:releaseTime, doneAction:2);
 | 
					 | 
				
			||||||
	
 | 
					 | 
				
			||||||
	snd = SinOsc.ar([freq, freq*oscDetune]) ;
 | 
					 | 
				
			||||||
	snd = snd + SinOsc.ar([freq*2, freq*oscDetune*2]) ;
 | 
					 | 
				
			||||||
	snd = snd + Pulse.ar([freq/2,(freq/2)*oscDetune]) * LFNoise1.kr(0.5).exprange(2,40);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	snd = snd.softclip;
 | 
					 | 
				
			||||||
	snd = RLPF.ar(snd, freq:
 | 
					 | 
				
			||||||
		//LFNoise1.kr(0.01).exprange(4000,300),
 | 
					 | 
				
			||||||
		freq * cutoff,
 | 
					 | 
				
			||||||
		rq:0.4);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	snd = snd * env * amp * 0.4;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	Out.ar(out, snd);
 | 
					 | 
				
			||||||
}).add;
 | 
					 | 
				
			||||||
)
 | 
					)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// add a delay/reverb bus here?
 | 
					Ndef(\bosc).play
 | 
				
			||||||
 | 
					Ndef(\bosc).fadeTime=2;
 | 
				
			||||||
 | 
					Ndef(\bosc).clear
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// first press play :)
 | 
					///////////////////////////////////////////////////////////////////////////////////////////////
 | 
				
			||||||
Ndef(\ba).play
 | 
					// creating buffers and filling them with weird waveforms
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					a = Harmonics.new(16);    // just returns an instance of Harmonics with size
 | 
				
			||||||
 | 
					b = Buffer.alloc(s, 512, 1);
 | 
				
			||||||
 | 
					(
 | 
				
			||||||
 | 
					z = SynthDef("help-Osc",{ arg out=0,bufnum=0;
 | 
				
			||||||
 | 
					    Out.ar(out,
 | 
				
			||||||
 | 
					        LeakDC.ar(
 | 
				
			||||||
 | 
								Osc.ar(bufnum, [50,50.22], 0, 0.5)
 | 
				
			||||||
 | 
							)
 | 
				
			||||||
 | 
					    )
 | 
				
			||||||
 | 
					});
 | 
				
			||||||
 | 
					)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					a.ramp(1.0, 2.0);   
 | 
				
			||||||
 | 
					a.ramp(0.5, -0.025)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					(
 | 
				
			||||||
 | 
					b.sine2(
 | 
				
			||||||
 | 
						freqs: a.ramp(1,1).postln,
 | 
				
			||||||
 | 
						amps: a.ramp(0, 0.01).postln,
 | 
				
			||||||
 | 
						amps: [0.8,0,0.1,0,0,0.1,0,0,0.01,0,0.01,0,0.02,0,0,0].postln,
 | 
				
			||||||
 | 
						normalize:false, asWavetable:true, clearFirst:true);
 | 
				
			||||||
 | 
					)
 | 
				
			||||||
 | 
					b.plot
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					a.formant(6, 4);
 | 
				
			||||||
 | 
					(
 | 
				
			||||||
 | 
					b.sine2(
 | 
				
			||||||
 | 
						freqs: a.ramp(0,0.1).postln,
 | 
				
			||||||
 | 
						amps: a.ramp(1,0),
 | 
				
			||||||
 | 
						normalize:true, asWavetable:true, clearFirst:true).plot;
 | 
				
			||||||
 | 
					)
 | 
				
			||||||
 | 
					b.sine2(a.ramp(1.0,0.1).postln, a.geom(1.2), true, true, true);
 | 
				
			||||||
 | 
					c = b.plot;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					y = z.play(s,[\out, 0, \bufnum, b]);
 | 
				
			||||||
 | 
					y.free;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					{SinOsc.ar()}.play
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					///////////////////////////////////////////////////////////////////////////////////////////
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					~reverBus = Bus.audio(s,2);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					Ndef(\ba).play(~reverBus, addAction: \addToHead)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					~reverbDelay = Synth(\verbDelayFX, [\inBus, ~reverBus, \outBus, 0], addAction: \addAfter);
 | 
				
			||||||
 | 
					~reverbDelay.set(\revWet, 0);
 | 
				
			||||||
 | 
					~reverbDelay.set(\dlyWet, 1);
 | 
				
			||||||
 | 
					~reverbDelay.free
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					Ndef(\ba).fadeTime=0.01; // for Patterns we don't want crossfade, but quantization
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// set default quant
 | 
					// set default quant
 | 
				
			||||||
Ndef(\ba).proxyspace.quant = 5;
 | 
					Ndef(\ba).proxyspace.quant = 2;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
(
 | 
					(
 | 
				
			||||||
Ndef(\ba, 
 | 
					Ndef(\ba, 
 | 
				
			||||||
| 
						 | 
					@ -98,29 +143,30 @@ Ndef(\ba,
 | 
				
			||||||
			Pbind(
 | 
								Pbind(
 | 
				
			||||||
				\octave, [4,5,7],
 | 
									\octave, [4,5,7],
 | 
				
			||||||
				\amp, [0.1,0.2,0.005], 
 | 
									\amp, [0.1,0.2,0.005], 
 | 
				
			||||||
				\degree, Pseq([0,3,4,2,6], inf),
 | 
									\degree, Pseq([0,3,4,2,6,Prand([3,4,2,6])], inf),
 | 
				
			||||||
				\dur, Prand([1,0.5,2], inf),
 | 
									\dur, Prand([1,0.5,2], 50),
 | 
				
			||||||
			),		
 | 
								),		
 | 
				
			||||||
			Pbind(
 | 
								Pbind(
 | 
				
			||||||
				\octave, [3,6],
 | 
									\octave, [3,6],
 | 
				
			||||||
				\degree, Pseq([[0,-3],4,6,3,2], inf),
 | 
									\degree, Pseq([[0,-3],4,6,3,2], inf),
 | 
				
			||||||
				\dur, 3.5,
 | 
									\dur, Pseq([3.5,5], 10),
 | 
				
			||||||
				\amp, 0.2,
 | 
									\amp, 0.05,
 | 
				
			||||||
				\legato, 0.6,
 | 
									\legato, 0.6,
 | 
				
			||||||
				\attackTime, 2,
 | 
									\attackTime, 2,
 | 
				
			||||||
				\releaseTime, 2,
 | 
									\releaseTime, 2,
 | 
				
			||||||
			)]),
 | 
								)]),
 | 
				
			||||||
		// common parameters
 | 
							// common parameters
 | 
				
			||||||
		\instrument, \sinPulz,
 | 
							\instrument, \sinPulz,
 | 
				
			||||||
		\oscDetune, Prand([1,3,7]*0.01, inf),
 | 
							\oscDetune, Prand([1,3,5,7]*0.01, inf),
 | 
				
			||||||
		\scale, Scale.minor.tuning_(\just),
 | 
							\scale, Scale.minor.tuning_(\just),
 | 
				
			||||||
		\cutoff, Prand([1,2,3,4,5,6], inf)
 | 
							\cutoff, Prand([0.5,1,1.5], inf),
 | 
				
			||||||
		
 | 
							\out, ~reverBus
 | 
				
			||||||
	)
 | 
						))
 | 
				
			||||||
	
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
)
 | 
					 | 
				
			||||||
)
 | 
					)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					Ndef(\ba).stop(1);
 | 
				
			||||||
 | 
					Ndef(\ba).clear;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
////////////////////////////////////////////////////////////////////////////////////////////
 | 
					////////////////////////////////////////////////////////////////////////////////////////////
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue