Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 15 additions & 4 deletions lib/Engine_MxSamples.sc
Original file line number Diff line number Diff line change
Expand Up @@ -67,10 +67,10 @@ Engine_MxSamples : CroneEngine {
arg outDelay,outReverb,bufnum, amp=0.0, t_trig=0,envgate=1,name=1,
attack=0.015,decay=1,release=2,sustain=0.9,
sampleStart=0,sampleEnd=1,rate=1,pan=0,
lpf=20000,hpf=10,delaySend=0,reverbSend=0;
lpf=20000,hpf=10,delaySend=0,reverbSend=0, noiseLevel=0;

// vars
var ender,snd;
var ender,snd, noise;

ender = EnvGen.ar(
Env.new(
Expand All @@ -95,6 +95,16 @@ Engine_MxSamples : CroneEngine {
]);
snd = snd * amp * ender;

// Noise
noise = HPF.ar(in: Mix.new([PinkNoise.ar(0.5), Dust.ar(5,1)]),
freq: 2000,
mul: Amplitude.kr(snd,
attackTime: 0.1,
releaseTime: 0.5,
mul: noiseLevel));

snd = Mix.new([snd, noise]);

// SendTrig.kr(Impulse.kr(1),name,1);
DetectSilence.ar(snd,doneAction:2);
// just in case, release after 1 minute
Expand Down Expand Up @@ -140,7 +150,7 @@ Engine_MxSamples : CroneEngine {
sampleBuffMxSamples[msg[1]] = Buffer.read(context.server,msg[2]);
});

this.addCommand("mxsampleson","iiffffffffffff", { arg msg;
this.addCommand("mxsampleson","iifffffffffffff", { arg msg;
var name=msg[1];
if (mxsamplesVoices.at(name)!=nil,{
if (mxsamplesVoices.at(name).isRunning==true,{
Expand All @@ -166,7 +176,8 @@ Engine_MxSamples : CroneEngine {
\hpf,msg[11],
\delaySend,msg[12],
\reverbSend,msg[13],
\sampleStart,msg[14] ]).onFree({
\sampleStart,msg[14],
\noiseLevel,msg[15] ]).onFree({
("freed "++name).postln;
NetAddr("127.0.0.1", 10111).sendMsg("voice",name,0);
});
Expand Down
10 changes: 8 additions & 2 deletions lib/mx.samples.lua
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ function MxSamples:new(args)
end

-- add parameters
params:add_group("MX.SAMPLES",19)
params:add_group("MX.SAMPLES",20)
local filter_freq=controlspec.new(20,20000,'exp',0,20000,'Hz')
params:add {
type='control',
Expand Down Expand Up @@ -208,6 +208,11 @@ function MxSamples:new(args)
id="mxsamples_sample_start",
name="sample start",
controlspec=controlspec.new(0,1000,'lin',0,0,'ms',1/1000)}
params:add {
type = "control",
id = "mxsamples_noise_level",
name = "noise level",
controlspec = controlspec.new(0, 10, 'lin', 0, 0, 'x', 0.01)}
params:add {
type='control',
id="mxsamples_play_release",
Expand Down Expand Up @@ -428,7 +433,8 @@ function MxSamples:on(d)
d.hpf or params:get("mxsamples_hpf_mxsamples"),
d.delay_send or params:get("mxsamples_delay_send")/100,
d.reverb_send or params:get("mxsamples_reverb_send")/100,
d.sample_start or params:get("mxsamples_sample_start"))
d.sample_start or params:get("mxsamples_sample_start"),
d.noise_level or params:get("mxsamples_noise_level"))
end

-- load sample if not loaded
Expand Down