adding samples and recordings and full script n.2

master
Luka Prinčič 2020-10-03 16:43:43 +02:00
parent 1dbf828aa2
commit 8baca90a40
5 changed files with 117 additions and 0 deletions

View File

@ -0,0 +1,117 @@
// #looptober 2020 02
// by Luka Prinčič <luka@lukaprincic.si>
// free to use, remix, etc under conditions of peer production licence:
// https://wiki.p2pfoundation.net/Peer_Production_License
// please support my work via https://lukaprincic.si/support
( // load samples
var smpPath = PathName(thisProcess.nowExecutingPath.dirname +/+ "samples");
// free all buffers to restart buffer count
~smpBuffers.do(_.free);
// create Dictionary
~smpBuffers = Dictionary();
// load samples
"\n--- load samples: ...".postln;
// iterate over each file in the folder
smpPath.filesDo({ |smpfile,i|
// tell me what you are loading:
postln(" " + i + smpfile.fileName );
// add a sample into a buffer, store object to Dictionary
~smpBuffers.add(smpfile.fileName -> Buffer.readChannel(s,
smpfile.fullPath, channels:[0]));
});
// function to partially match filename for buffers
~getSmp = { |regexp|
~smpBuffers.detect { |buf|
regexp.matchRegexp(buf.path)
}
};
// synthdefs: ///////////////////////////////////////////////////////////////////////
SynthDef(\bgrain, { |out = 0, gate = 1, amp = 0, bufnum, gfreq=90, rate=0.5|
var snd, pan, env, freqdev;
pan = LFNoise1.kr(0.1).range(-1, 1) * LFNoise0.kr(gfreq).range(0.2,1);
env = EnvGen.kr(
Env([0, 1, 0], [1, 1], \sin, 1),
gate,
doneAction: Done.freeSelf);
snd = GrainBuf.ar(
numChannels:2,
trigger:Impulse.kr(LFNoise1.kr(gfreq).range(0.8,1) * gfreq),
dur: 0.2 * LFNoise0.kr(gfreq).range(1,1.2),
sndbuf: bufnum,
rate: [rate * LFNoise1.kr.range(0.99, 1), rate * LFNoise1.kr.range(0.99, 1)],
pos: LFNoise2.kr(0.05).range(0, 1) * LFNoise0.kr(gfreq).range(1,1.02),
//pos: LFTri.kr(0.25),
interp: 2,
pan: pan);
snd = RLPF.ar(snd, freq: LFNoise2.kr(0.1).exprange(400,10000));
snd = snd * LFTri.ar(0.073).range(0.1,1);
snd = snd * env * amp;
Out.ar(out, snd);
}).add;
SynthDef(\verbDelayFX, {
arg inBus, out=0, revWet=0.8, dlyWet=0.8, feedback = 0.5 ;
var snd = In.ar(inBus, 2);
var verb = JPverb.ar(snd);
var delay = Greyhole.ar(snd, feedback: feedback);
snd = snd + (verb * revWet) + (delay * dlyWet) * 0.5;
Out.ar(out, snd);
}).add;
);
// -----------------------------------------------------------------
// create a reverb/delay send bus
~reverBus = Bus.audio(s,2);
// create processing verb/delay plugin/synth
~reverbDelay = Synth(\verbDelayFX, [\inBus, ~reverBus], addAction: \addAfter);
// free them if necessary:
// ~reverbDelay.free
// ~reverBus.free
// -----------------------------------------------------------------
(
// granulation 1
~amygran = Synth(\bgrain,
[\out, ~reverBus, \bufnum, ~getSmp.("amywars"), \amp, 0.5],
addAction: \addToHead);
)
(
// granulation 2
~romantiq = Synth(\bgrain,
[\out, ~reverBus, \bufnum, ~getSmp.("romant"), \amp, 0.05],
addAction: \addToHead);
)
// play with arguments:
~amygran.set(\amp, 0.5)
~romantiq.set(\amp, 0.05)
~romantiq.set(\rate, 1)
// fadeout
~amygran.release(10)
~romantiq.release(10)
// -----------------------------------------------------------------

Binary file not shown.

Binary file not shown.

BIN
samples/amywars.wav Normal file

Binary file not shown.

BIN
samples/romantiq.wav Normal file

Binary file not shown.