diff --git a/.DS_Store b/.DS_Store new file mode 100644 index 0000000..d88aa39 Binary files /dev/null and b/.DS_Store differ diff --git a/apl.scd b/apl.scd new file mode 100644 index 0000000..3f5bb65 --- /dev/null +++ b/apl.scd @@ -0,0 +1,9 @@ +( +SynthDef(\apl, { + var sig; + + sig = SinOsc.ar(\freq.ar(440)); + + Out.ar(0, sig); +}).add; +) \ No newline at end of file diff --git a/clipping_with_amnt.scd b/clipping_with_amnt.scd new file mode 100644 index 0000000..8fd84c3 --- /dev/null +++ b/clipping_with_amnt.scd @@ -0,0 +1,15 @@ +{ + var drive = 2; // change this to see effect + var x = Line.kr(-1, 1, 0.01); // simulate signal range + tanh(x * drive) / tanh(drive) +}.play; + + +( +{ + var drive = 20; // Try values like 1, 5, 10, etc. + var sig = SinOsc.ar(220); // Your basic oscillator + var shaped = tanh(sig * drive) / tanh(drive); // Dividing normalizes it for some reason I don't understand + shaped * 0.1 // scale output to prevent clipping +}.plot; +) \ No newline at end of file diff --git a/fm envs test.scd b/fm envs test.scd new file mode 100644 index 0000000..44e535b --- /dev/null +++ b/fm envs test.scd @@ -0,0 +1,27 @@ +( +{ + var modEnv = EnvGen.kr(Env.adsr(1, 0.5, 0.1, 0.5), doneAction: 2); + var modulator = SinOsc.ar(50) * 500 * modEnv; + var carrier = SinOsc.ar(200 + modulator) * 0.1; + carrier +}.play; +) + + +( +{ + var dur = 1.5; + var gaussEnv = EnvGen.kr( + Env.new( + levels: [30, 60, 0], + times: [1, 3, 4], + curves: [-4, -20] // Negative curves for smoother, bell-shaped fade in/out + ), + doneAction: 2 + ); + + var modulator = SinOsc.ar(10) * 500 * gaussEnv; + var carrier = SinOsc.ar(10 + modulator) * 0.1; + carrier = RLPF.ar(carrier, 1e4, 0.1); +}.play; +) diff --git a/fm pulsar wave terrain.scd b/fm pulsar wave terrain.scd index 6b7596d..3530a3f 100644 --- a/fm pulsar wave terrain.scd +++ b/fm pulsar wave terrain.scd @@ -1,7 +1,11 @@ +~terrain = Buffer.alloc(s, 1024, 1); +~terrain.sine1([1, 0.5, 0.3, 0.2, 0.1], true); // You can sculpt this more chaotically +~terrain.postln; + ( // Generate a terrain table ~terrain = Buffer.alloc(s, 1024, 1); -~terrain.sine1([1, 0.5, 0.3, 0.2, 0.1], true); // You can sculpt this more chaotically +~terrain.sine1([1, 0.3, 0.3, 0.2, 0.1], true); // You can sculpt this more chaotically SynthDef("fm_pulsar_terrain", { arg a, e, f, d; @@ -38,7 +42,9 @@ SynthDef("fm_pulsar_terrain", { a = Mix([ SinOsc.ar(f), - GrainBuf.ar(1, t, d, ~terrain, tblPos, carfreq, 0, 2) + // GrainBuf.ar(1, t, d, ~terrain, tblPos, carfreq, 0, 2) + GrainBuf.ar(1, t, d, ~terrain, tblPos, carfreq); + // GrainBuf.ar(numChannels:1, trigger:0, dur:1, ~terrain, rate:1, pos:0, interp:2) ]); a = LeakDC.ar(a * e); @@ -48,9 +54,10 @@ SynthDef("fm_pulsar_terrain", { Out.ar(\outBus.kr(0), a.dup * \gain.kr(0.1)); }).add; -) + Synth(\fm_pulsar_terrain); +) diff --git a/hard sync.scd b/hard sync.scd new file mode 100644 index 0000000..7dc483b --- /dev/null +++ b/hard sync.scd @@ -0,0 +1,11 @@ +{(SinOsc.ar(440) + SinOsc.ar(140)).dup * 0.1}.play; +{ (SinOsc.ar(440, 0) + SinOsc.ar(140, 0)).dup * 0.1 }.play; + +( +{ + var phasor = Phasor.ar(0, 40 / SampleRate.ir, 0, 1); // base phase + var sig = SinOsc.ar(0, phasor * 2pi) + SinOsc.ar(0, phasor * 2pi * (SinOsc.ar(640))); + sig.dup * 0.1 +}.play; + +) \ No newline at end of file diff --git a/mark_fell_kinda.scd b/mark_fell_kinda.scd new file mode 100644 index 0000000..c56a97d --- /dev/null +++ b/mark_fell_kinda.scd @@ -0,0 +1,41 @@ +// A SynthDef without samples, using oscillators and generative modulation +( +SynthDef(\fellGenerative, { |out = 0, amp = 0.3, dur = 1, freq = 440| + var sig, env, osc1, osc2, noise, mod, freqMod, pan; + + // Base oscillators + osc1 = SinOsc.ar(freq, 0, 0.5); // Sine wave oscillator 1 + osc2 = Saw.ar(freq * 2, 0.3); // Saw wave oscillator 2 + + // Generate white noise + noise = WhiteNoise.ar(0.1); + + // Frequency modulation with LFNoise1 + freqMod = LFNoise1.kr(0.1).range(0.9, 1.1); + osc1 = osc1 * freqMod; // Modulate osc1's frequency slightly over time + + // Envelope for smooth start and end of each sound + env = EnvGen.kr(Env.perc(0.01, dur), doneAction: 2); + + // Pan modulation + pan = LFNoise1.kr(0.2).range(-1, 1); // Slow panning for stereo movement + + // Combine the oscillators and noise into a timbre + sig = osc1 + osc2 + noise; + sig = sig * env * amp; // Apply amplitude envelope + + // Output the sound with pan control + Out.ar(out, Pan2.ar(sqig, pan)); +}).add; +) + +// Generate a complex evolving pattern with rhythmic cycles and modulation +( +Pbind( + \instrument, \fellGenerative, + \amp, Pwhite(0.2, 0.6, inf), // Random amplitude + \freq, Pwhite(100, 1000, inf), // Random base frequencies + \dur, Pseq([0.3, 0.5, 1, 0.7], inf), // Rhythmic durations + \mod, Pwhite(0.2, 1.5, inf) // Random modulation depth for oscillators +).play; +) diff --git a/midi for something.scd b/midi for something.scd index 65836bb..9861ba4 100644 --- a/midi for something.scd +++ b/midi for something.scd @@ -1,6 +1,6 @@ MIDIIn.connectAll; -~pulsar = 8388608; +~pulsar = 1056899563; ~mellotron = 8388611; ( @@ -17,7 +17,7 @@ MIDIdef.noteOn(\noteOnTest_device1, { if (src == ~pulsar, { // Create a new synth for device 1 ~notes[nn] = Synth.new( - \wtable_vosc_dual_clean, [ + \convolv, [ \freq, nn.midicps, \amp, vel.linexp(1,127,0.01,0.3), ] diff --git a/primes.scd b/primes.scd new file mode 100644 index 0000000..645d7c7 --- /dev/null +++ b/primes.scd @@ -0,0 +1,33 @@ +( +{ + var primes, interval, seq; + // Define a list of prime numbers + primes = [2, 3, 5, 7, 11, 13, 17, 19]; + + // Use primes to define a rhythmic pattern + seq = Pseq(primes, inf); // Repeat indefinitely + + // Trigger a note every prime number of beats + Pbind( + \freq, 60.midicps, + \dur, seq, + \amp, 0.1 + ).play; +}.fork; +) + + +( +{ + var primes, pitchSeq, sig; + primes = [2, 3, 5, 7, 11]; // List of primes + pitchSeq = Pseq(primes, inf).collect { |prime| 60 + prime }; // Map primes to pitch offsets + + // Create a sequence of pitches based on the primes + Pbind( + \freq, pitchSeq.midicps, + \dur, 0.5, + \amp, 0.1 + ).play; +}.fork; +) diff --git a/pv_repeat.scd b/pv_repeat.scd new file mode 100644 index 0000000..60895c6 --- /dev/null +++ b/pv_repeat.scd @@ -0,0 +1,28 @@ + +~track = "/Users/lcoogan/Music/Musicians/Xiu Xiu/01-xiu_xiu-sad_pony_guerilla_girl-sge.opus".standardizePath; ~bpm=116.6; +~track = "/Users/lcoogan/Music/Musicians/Broadcast/broadcast - tender buttons (2005)/05 - Tears in the Typing Pool.opus".standardizePath; ~bpm=145.1; +~looplen = 480/~bpm; + + +b = Buffer.cueSoundFile(s, ~track, 0, 2); +x = { DiskIn.ar(2, b) }.play; + +// Now the thing that will attempt to separate them out again (inc a buffer for it to use): +~loopbuf = Buffer.alloc(s, 1000, 513); +( +y = { |which=1, active=1, thresh=1| + var son = In.ar(0); + var chain = FFT(LocalBuf(1024), son); + chain = PV_ExtractRepeat(chain, ~loopbuf, ~looplen, memorytime:30, which:which, thresh:thresh); + ReplaceOut.ar(0, Select.ar(active, [son, IFFT(chain)]).dup); +}.play(x, addAction: \addAfter); +) +y.set(\which, 0) // focus on the nonrepeating bit +y.set(\which, 1) // focus on the repeating bit +y.set(\active, 0) // back to normal +y.set(\active, 1) // filter it again +y.set(\which, 0, \thresh, 1.5) // trying a higher threshold + +y.free; +x.free; +b.close \ No newline at end of file diff --git a/pv_shoegaze.scd b/pv_shoegaze.scd new file mode 100644 index 0000000..21ab771 --- /dev/null +++ b/pv_shoegaze.scd @@ -0,0 +1,39 @@ +~track = "/Users/lcoogan/Music/Musicians/Xiu Xiu/01-xiu_xiu-sad_pony_guerilla_girl-sge.opus".standardizePath; + +~track = "/Users/lcoogan/Music/Musicians/Suicide/1977 - Suicide [1998 Reissue]/01 Ghost Rider.opus".standardizePath; +~bpm = 191; + +~track = "/Users/lcoogan/Music/Musicians/My Bloody Valentine/Loveless/05 When You Sleep.opus".standardizePath; +~bpm = 90; + +~bpm = 116.6; +~looplen = 480 / ~bpm; + +~track = "/Users/lcoogan/Music/Musicians/Broadcast/broadcast - tender buttons (2005)/05 - Tears in the Typing Pool.opus".standardizePath; ~bpm=145.1; + + + +b = Buffer.cueSoundFile(s, ~track, 0, 2); +x = { DiskIn.ar(2, b) }.play; + +~loopbuf = Buffer.alloc(s, 1000, 513); // Make sure loopbuf is allocated + +( +y = { |which=1, active=1, thresh=1| + var son = In.ar(0); + var chain = FFT(LocalBuf(1024), son); + chain.postln; // Debug: Check the FFT output + chain = PV_ExtractRepeat(chain, ~loopbuf, ~looplen, memorytime:30, which:which, thresh:thresh); + ReplaceOut.ar(0, Select.ar(active, [son, IFFT(chain)]).dup); +}.play(x, addAction: \addAfter); +) + +y.set(\which, 0) // Focus on non-repeating part +y.set(\which, 1) // Focus on repeating part +y.set(\active, 0) // Switch back to original signal +y.set(\active, 1) // Apply filter +y.set(\which, 0, \thresh, 1.5) // Try a higher threshold + +y.free; +x.free; +b.close; diff --git a/spectral_generative_using_lfo_and_dust.scd b/spectral_generative_using_lfo_and_dust.scd new file mode 100644 index 0000000..f40ccf8 --- /dev/null +++ b/spectral_generative_using_lfo_and_dust.scd @@ -0,0 +1,31 @@ +( +SynthDef(\voiceEvolving, { + arg out=0, bufnum, amp=0.5, windowSize=1024; + var in, chain, sig; + var smearAmt, shiftAmt, wipeTrig; + + in = PlayBuf.ar(1, bufnum, BufRateScale.kr(bufnum), loop: 1); + + // FFT processing + chain = FFT(LocalBuf(windowSize), in); + + // Slowly changing modulation sources + smearAmt = LFNoise1.kr(0.1).range(5, 50); // how smeared the spectrum is + shiftAmt = LFNoise1.kr(0.07).range(-30, 30); // shifting bins in pitch space + wipeTrig = Dust.kr(0.3); // occasional spectral dropouts + + // PV mutations + chain = PV_MagSmear(chain, smearAmt); + chain = PV_BinShift(chain, shiftAmt); + chain = PV_RandWipe(chain, wipeTrig); + + sig = IFFT(chain) * amp; + + // Optional: gentle filtering + sig = LPF.ar(sig, 1000); + + Out.ar(out, sig.dup); +}).add; +) + +Synth(\voiceEvolving, [\bufnum, b, \amp, 0.4]); diff --git a/wavetables.scd b/wavetables.scd index eb36db8..0136c10 100644 --- a/wavetables.scd +++ b/wavetables.scd @@ -2,7 +2,7 @@ // Run once to convert and resample wavetable files var paths, file, data, n, newData, outFile; -paths = PathName("/home/lcoogan/snd/wtables/AKWF").deepFiles.select { |f| +paths = PathName("/Users/lcoogan/snd/wtables/AKWF").deepFiles.select { |f| f.extension == "wav" };