Skip to content

Commit

Permalink
add energy to murmur
Browse files Browse the repository at this point in the history
  • Loading branch information
terribleben committed Aug 12, 2022
1 parent 3b4ea6a commit 03033d0
Show file tree
Hide file tree
Showing 2 changed files with 60 additions and 10 deletions.
63 changes: 56 additions & 7 deletions murmur/lib/Engine_Murmur.sc
Original file line number Diff line number Diff line change
Expand Up @@ -2,48 +2,87 @@ Engine_Murmur : CroneEngine {
var bFx;
var sVox, sSamp, sFx;
var bufSample;
var voxSeq, rVox;
var baseTempo;
var tSeqClock;

*new { arg context, doneCallback;
^super.new(context, doneCallback);
}

alloc {
"Murmur alloc".postln;

baseTempo = 1 / 0.4;
tSeqClock = TempoClock.new(baseTempo);

bFx = Bus.audio(context.server, 2);
bufSample = Buffer.read(context.server, "/home/we/dust/code/bitgraves/samples/20220304-yt-drone-pesticide.wav");

context.server.sync;

voxSeq = Pbind(
\dur, 0.2,
\n, Pn(
Pseq([
Prand([
Pseq([0, 12, 0]),
Pseq([12, 0, 12]),
Pseq([0, 0, 12]),
Pseq([0, 12]),
Pseq([0, 10, 0, 12]),
], 6),
Prand([
Pseq([12 + 5, 0, 12 + 7]),
Pseq([12 + 5, 0, 12 + 5]),
Pseq([0, 0, 12 + 7]),
Pseq([12 + 7, 0, 0]),
Pseq([12 + 5, -2]),
]),
]),
),
).asStream;
rVox = Routine.new({
loop {
var e = voxSeq.next(());
sVox.set(\n, e.n);
e.dur.wait;
}
}).play(tSeqClock);

SynthDef(\mmrVox,
{ arg inBus = 2, outBus = 0, amp = 1, vowel = 0, morphFreq = 5.8, noise = 0.1, trig = 0, harmonic = 1, vowelScale = 0.2;
{ arg inBus = 2, outBus = 0, amp = 1, vowel = 0, morphFreq = 5.8, noise = 0.1, trig = 0, harmonic = 1, vowelScale = 0.206, n = 0;
var in = In.ar(inBus, 1);
var sound = DriveNoise.ar(in, noise, multi: 1.5);

// burst of sound decaying stepwise and changing pan less often.
var vowelHarmonic = TIRand.kr(1, harmonic, Impulse.kr(morphFreq));
// var vowelHarmonic = TIRand.kr(1, harmonic, Impulse.kr(morphFreq));
var v1 = Vowel(\e, \bass);
var v2 = Vowel(\o, \bass);
var v = v1.blend(v2, vowel.fold(0, 1));

var pan = TRand.kr(-1, 1, Impulse.kr(morphFreq / 5.0));
var env = EnvGen.kr(
Env.perc(0.01, 5.0),
Env.asr(0.01, 1.0, 5.0),
gate: trig,
);

sound = (Mix.ar(Resonz.ar(
(sound * 3).clip + WhiteNoise.ar(0.05),
freq: v.freqs * vowelScale.clip(0.2, 1) * vowelHarmonic,
(sound * 3).clip + WhiteNoise.ar(0.1),
freq: v.freqs * vowelScale.clip(0.2, 1) * n.midiratio,
bwr: v.rqs * 0.9,
mul: v.amps
)) * 10).tanh;

// remove some freqs for ENHANCEMENT
sound = Mix.ar(BRF.ar(sound, vowel.linexp(0, 1, 220, 1760) * [1, 1.3, 1.6], 0.8, mul: 0.6));
sound = HPF.ar(sound, 100.0);
sound = HPF.ar(sound, amp.linexp(0, 1, 19000, 200));
sound = Mix.ar([
sound,
MedianTriggered.ar(sound, Impulse.ar(1000)) * noise,
]);

Out.ar(outBus, Pan2.ar(sound, pan) * env * amp);
Out.ar(outBus, Pan2.ar(sound, pan)* env);
}
).add;

Expand Down Expand Up @@ -82,6 +121,9 @@ Engine_Murmur : CroneEngine {
this.addCommand("vowel", "f", {|msg|
sVox.set(\vowel, msg[1]);
});
this.addCommand("noise", "f", {|msg|
sVox.set(\noise, msg[1]);
});
this.addCommand("harmonic", "i", {|msg|
sVox.set(\harmonic, msg[1]);
});
Expand All @@ -101,6 +143,10 @@ Engine_Murmur : CroneEngine {
this.addCommand("noteOn", "i", {|msg|
sVox.set(\trig, 1);
sFx.set(\gate, 1);
tSeqClock.play({
var param = 1 + ((msg[1] - 4) * 0.15);
tSeqClock.tempo = baseTempo * param;
});
});
this.addCommand("noteOff", "i", {|msg|
sVox.set(\trig, 0);
Expand All @@ -114,6 +160,9 @@ Engine_Murmur : CroneEngine {
sSamp.free;
bufSample.free;
bFx.free;
rVox.stop;
voxSeq.free;
tSeqClock.free;
}

}
7 changes: 4 additions & 3 deletions murmur/murmur.lua
Original file line number Diff line number Diff line change
Expand Up @@ -13,18 +13,19 @@ function init()
BGUtil.configureSystemStuff()

BGUtil.addEngineControlParam(params, { id = "vowel" })
BGUtil.addEngineControlParam(params, { id = "noise", min = 0.1, max = 1.0 })
BGUtil.addEngineControlParam(params, {
id = "harmonic",
min = 1,
max = 6,
})
BGUtil.addEngineControlParam(params, {
id = "scale",
min = 0.2,
min = 0.206,
max = 1,
})
BGUtil.addEngineControlParam(params, { id = "amp" })
BGUtil.addEngineControlParam(params, { id = "samp", max = 1 })
BGUtil.addEngineControlParam(params, { id = "samp", warp = 'exp', min = 0.0001, max = 0.6 })
BGUtil.addEngineControlParam(params, {
id = "sampHpf",
min = 60,
Expand All @@ -40,7 +41,7 @@ function init()
MPD218 = BGMidi.newInputMappingMPD218({
[3] = 'vowel',
[9] = 'scale',
[12] = 'harmonic',
[12] = 'noise',
[13] = 'samp',
[14] = 'monitor',
[15] = 'amp',
Expand Down

0 comments on commit 03033d0

Please sign in to comment.