Merge remote-tracking branch 'refs/remotes/origin/master'
commit
712f08ed2e
Binary file not shown.
@ -0,0 +1,173 @@
|
||||
// TODO: connect MIDI CC knobs to an array of defined pos, also connect amp, possibly rate though probably not
|
||||
|
||||
|
||||
(
|
||||
b = Buffer.read(s, "/home/lcoogan/snd/live/2025-04-26.Basic_City_Brewery/granular/Cantorial/Cantor_Samuel_Malavsky_Zechor.wav");
|
||||
|
||||
(
|
||||
SynthDef(\cantorial_tremolo, { |out, pan = 0, dur = 0.1, atk=0.3, dec=0.4, sus=0.1, rel=0, amp=1, crf=1100|
|
||||
var sig, rate, env, filter;
|
||||
|
||||
env = EnvGen.ar(
|
||||
Env.new(
|
||||
[0, 1, 1, 0],
|
||||
[atk, dec, sus, rel],
|
||||
),
|
||||
gate: 1,
|
||||
doneAction: 2
|
||||
);
|
||||
|
||||
sig = GrainBuf.ar(
|
||||
numChannels: 2,
|
||||
trigger: Impulse.kr(10),
|
||||
dur: dur,
|
||||
sndbuf: b,
|
||||
rate: 1,
|
||||
pos: 0.1,
|
||||
interp: 2,
|
||||
pan: pan,
|
||||
envbufnum: -1,
|
||||
maxGrains: 512
|
||||
);
|
||||
|
||||
sig = sig * env * amp;
|
||||
|
||||
filter = MoogVCF.ar(sig, crf, 0.3);
|
||||
|
||||
Out.ar(out, filter);
|
||||
}).add;
|
||||
)
|
||||
)
|
||||
|
||||
(
|
||||
Ppar([
|
||||
Pbind(
|
||||
\instrument, \cantorial_trill,
|
||||
\dur, 1, // Adjust as needed
|
||||
// \amp, 1, // Amplitude (adjust as needed)
|
||||
\pan, 0, // Pan position
|
||||
),
|
||||
Pbind(
|
||||
\instrument, \cantorial_tremolo,
|
||||
\dur, 0.2, // Adjust as needed
|
||||
// \amp, 1, // Amplitude (adjust as needed)
|
||||
\pan, 0, // Pan position for the second synth (can be changed)
|
||||
)
|
||||
]).play;
|
||||
)
|
||||
|
||||
|
||||
|
||||
|
||||
(
|
||||
// Becoming satisfactory granular synth
|
||||
|
||||
b = Buffer.read(s, "/home/lcoogan/snd/live/2025-04-26.Basic_City_Brewery/granular/Cantorial/Cantor_Samuel_Malavsky_Zechor.wav");
|
||||
|
||||
(
|
||||
SynthDef(\cantorial_trill, { |out, pan = 0, dur = 0.5, atk=0.3, dec=0.4, sus=0.1, rel=0, amp=1, crf=1000, grainRate=5|
|
||||
var sig, rate, env, filt;
|
||||
|
||||
env = EnvGen.ar(
|
||||
Env.new(
|
||||
[0, 1, 1, 0],
|
||||
[atk, dec, sus, rel],
|
||||
),
|
||||
gate: 1,
|
||||
doneAction: 2
|
||||
);
|
||||
|
||||
sig = GrainBuf.ar(
|
||||
numChannels: 2,
|
||||
trigger: Impulse.kr(grainRate),
|
||||
dur: dur,
|
||||
sndbuf: b,
|
||||
rate: 1,
|
||||
pos: 0.01,
|
||||
interp: 2,
|
||||
pan: pan,
|
||||
envbufnum: -1,
|
||||
maxGrains: 512
|
||||
);
|
||||
|
||||
sig = sig * env * amp;
|
||||
|
||||
sig = LPF.ar(sig, crf);
|
||||
|
||||
Out.ar(out, sig);
|
||||
}).play;
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
(
|
||||
// IMPORTANT!
|
||||
|
||||
b = Buffer.read(s, "/home/lcoogan/snd/live/2025-04-26.Basic_City_Brewery/granular/Cantorial/Acheinu_Kol_Beit_Israel.wav");
|
||||
|
||||
b = Buffer.readChannel(s, "/Users/eli/Sounds/scaudio/loops/5_128-170/135evrythngCHILL-8.aiff", channels:[0]);
|
||||
)
|
||||
|
||||
(
|
||||
s.newBusAllocators;
|
||||
~posbus = Bus.control(s, 1).value_(0.25);
|
||||
~grainbus = Bus.audio(s, 2);
|
||||
|
||||
SynthDef(\cantorial_reed ,
|
||||
{
|
||||
arg amp = 0.3, pan = 0, posin = 0, out = 0;
|
||||
var sig, pos;
|
||||
pos = In.kr(posin, 1);
|
||||
sig = GrainBuf.ar(
|
||||
numChannels: 2,
|
||||
trigger: Dust.ar(40),
|
||||
dur: 0.8,
|
||||
sndbuf: b,
|
||||
rate: 1,
|
||||
pos: pos, // 1.25, 1.20
|
||||
interp: 2,
|
||||
pan: pan,
|
||||
envbufnum: -1,
|
||||
maxGrains: 512
|
||||
);
|
||||
|
||||
sig = sig * amp;
|
||||
Out.ar(out, sig);
|
||||
}).add;
|
||||
|
||||
MIDIdef.cc(\pos, {
|
||||
arg val, num;
|
||||
var posval = [0.25, 0.2, 0.7], index, out;
|
||||
index = val.linlin(0, 128, 0, posval.size).floor.asInteger;
|
||||
out = posval[index].postln;
|
||||
~posbus.value_(out);
|
||||
}, [95]);
|
||||
)
|
||||
|
||||
x = Synth(\cantorial_reed, [amp: 0.1, posin: ~posbus, out: ~grainbus]);
|
||||
|
||||
x.set(\pos, 0.6)
|
||||
|
||||
x.free
|
||||
|
||||
(
|
||||
s.newBusAllocators;
|
||||
~grainbus = Bus.audio(s, 2);
|
||||
~tr808bus = Bus.audio(s, 2);
|
||||
~padbus = Bus.audio(s, 2);
|
||||
SynthDef(\master, {
|
||||
arg grainamp = 1, tr808amp = 1, padamp = 1, out = 0;
|
||||
var grainsig, tr808sig, padsig, sig;
|
||||
grainsig = In.ar(\grainbus.ir(~grainbus), 2) * grainamp;
|
||||
tr808sig = In.ar(\tr808bus.ir(~tr808bus), 2) * tr808amp;
|
||||
padsig = In.ar(\padbus.ir(~padbus), 2) * padamp;
|
||||
sig = [grainsig, tr808sig, padsig].sum;
|
||||
Out.ar(out, sig);
|
||||
}).add;
|
||||
)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@ -0,0 +1,18 @@
|
||||
(
|
||||
{
|
||||
var sig, nn = 39.6, seq;
|
||||
seq = Demand.kr(
|
||||
trig: Impulse.kr(0.21) + Impulse.kr(0.105, 5/8),
|
||||
reset: 0,
|
||||
demandUGens: Dseq([[0, 12, 16, 19], [2, 14, 18, 21], [-3, 13, 16, 21]], inf);
|
||||
);
|
||||
nn = nn * LFDNoise3.kr(LFNoise0.kr(8).exprange(1, 4)).bipolar(0.06).midiratio;
|
||||
sig = Saw.ar((seq + nn).midicps);
|
||||
sig = LPF.ar(sig, (nn.midicps * XLine.kr(2, 10, 16)).clip(20, 20000));
|
||||
sig = BLowShelf.ar(sig, 300, 0.5, 9);
|
||||
sig = Splay.ar(sig.scramble, 0.5);
|
||||
sig = sig * LFDNoise0.kr(LFNoise2.kr(8).exprange(1, 30)).exprange(0.6, 1).lag(0.1);
|
||||
sig = sig.blend(GVerb.ar(sig.sum, 299, 4), 0.15);
|
||||
sig = sig * 0.15;
|
||||
}.play;
|
||||
)
|
||||
@ -0,0 +1,22 @@
|
||||
s.boot;
|
||||
|
||||
(
|
||||
x = {
|
||||
var sig, freq = \freq.kr([54, 57, 61, 66].midicps, 0.2);
|
||||
sig = VarSaw.ar(freq *.x {Rand(-0.08, 0.08).midiratio}.dup(5), {Rand(0, 1.0)}.dup(5));
|
||||
sig = (sig * MouseX.kr(1, 100, 1).poll).softclip;
|
||||
sig = LPF.ar(sig, freq);
|
||||
sig = Splay.ar(sig) * 0.2;
|
||||
sig = sig.blend(LPF.ar(GVerb.ar(sig.sum, 299, 4), 1200), 0.5);
|
||||
sig.postln;
|
||||
}.play(fadeTime: 5)
|
||||
)
|
||||
|
||||
x.set(\freq, [52, 56, 61, 64].midicps);
|
||||
x.set(\freq, [50, 54, 59, 62].midicps);
|
||||
x.set(\freq, [49, 54, 57, 61].midicps);
|
||||
x.set(\freq, [47, 52, 56, 59].midicps);
|
||||
x.set(\freq, [54, 57, 61, 66].midicps);
|
||||
x.set(\freq, [54, 59, 62, 66].midicps);
|
||||
|
||||
x.release(5)
|
||||
@ -0,0 +1,40 @@
|
||||
(
|
||||
// global variables
|
||||
~out = 0;
|
||||
|
||||
// allocate busses
|
||||
s.newBusAllocators;
|
||||
~grainbus = Bus.audio(s, 2);
|
||||
~grainampbus = Bus.control(s, 1);
|
||||
|
||||
MIDIIn.connectAll;
|
||||
|
||||
MIDIdef.cc(\name0, { arg vel, num; });
|
||||
MIDIdef.cc(\name1, { arg vel, num; });
|
||||
MIDIdef.cc(\name2, { arg vel, num; });
|
||||
|
||||
s.waitForBoot({
|
||||
|
||||
SynthDef(\name, {
|
||||
// code goes here
|
||||
}).add;
|
||||
SynthDef(\name, {
|
||||
// code goes here
|
||||
}).add;
|
||||
SynthDef(\name, {
|
||||
// code goes here
|
||||
}).add;
|
||||
|
||||
Buffer.read(s, "path0.wav");
|
||||
Buffer.read(s, "path1.wav");
|
||||
Buffer.read(s, "path2.wav");
|
||||
|
||||
s.sync;
|
||||
|
||||
// initial groups and synths go here
|
||||
Synth(\reverb, [dec: 4]);
|
||||
|
||||
|
||||
|
||||
});
|
||||
)
|
||||
@ -0,0 +1,150 @@
|
||||
MIDIClient.init;
|
||||
MIDIIn.connectAll;
|
||||
|
||||
MIDIdef.noteOn(\noteOnTest, {"key down".postln});
|
||||
|
||||
|
||||
// Print MIDI debug info
|
||||
|
||||
(
|
||||
MIDIdef.noteOn(\noteOnTest, {
|
||||
arg nn, chan, src;
|
||||
[nn, chan, src].postln;
|
||||
});
|
||||
|
||||
|
||||
MIDIdef.cc(\ccTest, {
|
||||
arg val, num, chan, src;
|
||||
["CC:", num, "Value:", val, "Channel:", chan, "Source:", src].postln;
|
||||
});
|
||||
)
|
||||
|
||||
|
||||
// Load samples
|
||||
|
||||
(
|
||||
~sampleDir = PathName("/Users/eli/Desktop/2025-04-26.Basic_City_Brewery (Copy)/trax/01-borrowed flesh/seq/808/").fullPath;
|
||||
|
||||
~samples = Dictionary.newFrom(
|
||||
(
|
||||
42: "ch.wav", 46: "oh.wav", 39: "cp.wav", 38: "sd.wav", 36: "bd.wav"
|
||||
).collect { |file, key|
|
||||
key -> Buffer.read(s, ~sampleDir +/+ file)
|
||||
}
|
||||
);
|
||||
)
|
||||
|
||||
~samples.class
|
||||
~samples[39].class
|
||||
|
||||
(
|
||||
~sampleDir = PathName("/Users/eli/Desktop/2025-04-26.Basic_City_Brewery (Copy)/trax/01-borrowed flesh/seq/808/");
|
||||
~sample = ();
|
||||
~sampleDir.entries.do({ |pn|
|
||||
var sym;
|
||||
sym = pn.fileNameWithoutExtension.asSymbol;
|
||||
~sample[sym] = Buffer.read(s, pn.fullPath);
|
||||
});
|
||||
)
|
||||
|
||||
(
|
||||
// Define the Synth for sample triggering (if not defined already)
|
||||
SynthDef(\sampleTrigger, { |buf, ampin = 0|
|
||||
var sound, amp;
|
||||
amp = In.kr(ampin, 1).lag(0.01);
|
||||
sound = PlayBuf.ar(1, buf, BufRateScale.ir(buf), doneAction: 2); // doneAction: 2 will free the synth when it's done
|
||||
sound = sound * amp;
|
||||
Out.ar(0, sound); // Send to audio output
|
||||
}).add;
|
||||
)
|
||||
|
||||
(
|
||||
s.newBusAllocators;
|
||||
~bdampbus = Bus.control(s, 1).value_(0.5);
|
||||
~sdampbus = Bus.control(s, 1).value_(0.5);
|
||||
~cpampbus = Bus.control(s, 1).value_(0.5);
|
||||
~champbus = Bus.control(s, 1).value_(0.5);
|
||||
~ohampbus = Bus.control(s, 1).value_(0.5);
|
||||
MIDIIn.connectAll;
|
||||
MIDIdef.noteOn('808trig', { |vel, nn|
|
||||
nn.postln;
|
||||
switch(nn)
|
||||
{36} {
|
||||
Synth(\sampleTrigger, [buf: ~sample.bd, ampin: ~bdampbus]);
|
||||
}
|
||||
{38} {
|
||||
Synth(\sampleTrigger, [buf: ~sample.sd, ampin: ~sdampbus]);
|
||||
}
|
||||
{39} {
|
||||
Synth(\sampleTrigger, [buf: ~sample.cp, ampin: ~cpampbus]);
|
||||
}
|
||||
{42} {
|
||||
Synth(\sampleTrigger, [buf: ~sample.ch, ampin: ~champbus]);
|
||||
}
|
||||
{46} {
|
||||
Synth(\sampleTrigger, [buf: ~sample.oh, ampin: ~ohampbus]);
|
||||
}
|
||||
}, noteNum: [36, 38, 39, 42, 46], chan: [0]);
|
||||
|
||||
MIDIdef.cc('808amp', { |val, num|
|
||||
switch(num)
|
||||
{22} {~bdampbus.value = val / 127}
|
||||
{23} {~sdampbus.value = val / 127}
|
||||
{61} {~cpampbus.value = val / 127}
|
||||
{24} {~champbus.value = val / 127}
|
||||
{26} {~ohampbus.value = val / 127};
|
||||
|
||||
}, ccNum: [22, 23, 61, 24, 26], chan: [0]);
|
||||
)
|
||||
MIDIFunc.trace(false)
|
||||
|
||||
s.scope;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// Testing ~samples
|
||||
|
||||
|
||||
|
||||
(
|
||||
// For some reason, nn and vel are swapped on the tr-08 MIDIIn
|
||||
// if vel isn't in the enclosure, then nn doesn't work
|
||||
// still figuring out how to do polyphony
|
||||
// set it to if == 9 when everything else is working
|
||||
MIDIdef.noteOn(\noteOnTest, {|vel, nn|
|
||||
[nn].postln;
|
||||
|
||||
Synth(\sampleTrigger, [\buf, ~samples[nn]]);
|
||||
});
|
||||
)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
(
|
||||
// Define the Synth for sample triggering (if not defined already)
|
||||
SynthDef(\sampleTrigger, { |buf|
|
||||
var sound;
|
||||
sound = PlayBuf.ar(1, buf, doneAction: 2); // doneAction: 2 will free the synth when it's done
|
||||
Out.ar(0, sound); // Send to audio output
|
||||
}).add;
|
||||
)
|
||||
|
||||
|
||||
|
||||
// Manually trigger a sample for note number 42
|
||||
(
|
||||
var noteNumber = 39; // The MIDI note number to play
|
||||
if (~samples.includesKey(noteNumber), {
|
||||
("Triggering sample for note: " + noteNumber).postln;
|
||||
Synth(\sampleTrigger, [\buf, ~samples[noteNumber]]);
|
||||
}, {
|
||||
("No sample found for note: " + noteNumber).postln;
|
||||
});
|
||||
)
|
||||
Loading…
Reference in New Issue