ソースを参照

Rename

tags/kitchen
コミット
c6350d3c87
2個のファイルの変更34行の追加99行の削除
  1. +34
    -20
      audio.scd
  2. +0
    -79
      dev.scd

+ 34
- 20
audio.scd ファイルの表示

@@ -12,25 +12,40 @@ s.waitForBoot {
// Create the synth definition and load it
module = SynthDef.new(\module, {
arg hue, saturation, value, pan, gain, octave;
var oscillator, noise, filter, panner, mixer, frequency, qfactor, noise_level, osc_level, lagtime;
var oscillator, noise, filter, panner, mixer, frequency, qfactor, noise_level, osc_level, lagtime, output, dust;

// Dynamic time of the module
lagtime = 100 / (2**octave);

// Calculate some parameters
lagtime = 0.5;
frequency = Lag.kr(200 + 300*hue, lagtime) * (2**octave);
qfactor = Lag.kr((1 - saturation)**4, lagtime);
osc_level = Lag.kr(saturation, lagtime);
noise_level = Lag.kr(1 - osc_level, lagtime);
// Oscillator/filter frequency
frequency = 130 + (hue * 130) * (2 ** octave);
frequency = Lag.kr(frequency, lagtime);
// Filtered saw oscillator
oscillator = SawDPW.ar(frequency);
filter = DFM1.ar(oscillator, frequency*0.5, 0.8, 1.0, 0.0, 0.0006);

// Generate some sounds
// noise = WhiteNoise.ar(1);
// Noise
qfactor = Lag.kr((1 - saturation)**4, lagtime);
noise = Crackle.ar(1.99, 1.0);
filter = BPF.ar(noise, frequency, qfactor) * noise_level;
//oscillator = SinOsc.ar(frequency) * osc_level;
oscillator = DPW3Tri.ar(frequency) * osc_level;
mixer = Mix.ar([filter, oscillator]);
panner = LinPan2.ar(mixer, pan, 10*HPF.kr(value, 10**(1-octave*2))**2);
Out.ar(0, panner);
noise = BPF.ar(noise, frequency, qfactor);

// Mix noise and saw
mixer = Mix.ar([filter * saturation, noise*(1-saturation)]);

// Apply pan
panner = LinPan2.ar(mixer, pan);

// Apply dynamics
output = panner * Lag.kr(HPF.kr(value, 4 * hue / (lagtime)), lagtime);

// Compress
output = Compander.ar(output, output, 0.5, 0.3, 0.3, 0.1, lagtime);

// Crank everything down
output = output * 0.1;

Out.ar(0, output);
});
module.load(s);
s.sync;
@@ -40,11 +55,11 @@ s.waitForBoot {
{
arg index;
var pan, octave;
pan = ((index % 4) - 1.5)/1.5;
octave = (index / 4).floor;
"% %\n".postf(pan, octave);
pan = 0 - ((index % 4) - 1.5)/1.5;
octave = (2 - (index / 4).floor) * 2;
"Module %: Pan %, octave %\n".postf(index, pan.round(1e-1), octave.round(1e-1));
Synth.new(\module,
[\hue, 0.5, \saturation, 0.1, \value, 0.5, pan, 0.5, \gain, 0.9, \octave, octave]
[\hue, 0.5, \saturation, 0.1, \value, 0.5, \pan, pan, \gain, 0.9, \octave, octave]
)
}
);
@@ -57,7 +72,6 @@ s.waitForBoot {
modules[msg[1]].set(\hue, msg[2]);
modules[msg[1]].set(\saturation, msg[3]);
modules[msg[1]].set(\value, msg[4]);
modules[msg[1]].set(\pan, msg[5]);
}
}
};


+ 0
- 79
dev.scd ファイルの表示

@@ -1,79 +0,0 @@
// SVNVimStart

s = Server.local;
s.waitForBoot {
var module, msg, modules;

// Connect to OSC
thisProcess.openUDPPort(5005);
n = NetAddr.new("0.0.0.0", 5005);
o = OSCFunc({ arg msg, time, addr, recvPort; [msg, time, addr, recvPort].postln; }, '/radio', n);

// Create the synth definition and load it
module = SynthDef.new(\module, {
arg hue, saturation, value, pan, gain, octave;
var oscillator, noise, filter, panner, mixer, frequency, qfactor, noise_level, osc_level, lagtime, output, dust;

// Dynamic time of the module
lagtime = 100 / (2**octave);

// Oscillator/filter frequency
frequency = 130 + (hue * 130) * (2 ** octave);
frequency = Lag.kr(frequency, lagtime);
// Filtered saw oscillator
oscillator = SawDPW.ar(frequency);
filter = DFM1.ar(oscillator, frequency*0.5, 0.8, 1.0, 0.0, 0.0006);

// Noise
qfactor = Lag.kr((1 - saturation)**4, lagtime);
noise = Crackle.ar(1.99, 1.0);
noise = BPF.ar(noise, frequency, qfactor);

// Mix noise and saw
mixer = Mix.ar([filter * saturation, noise*(1-saturation)]);

// Apply pan
panner = LinPan2.ar(mixer, pan);

// Apply dynamics
output = panner * Lag.kr(HPF.kr(value, 4 * hue / (lagtime)), lagtime);

// Compress
output = Compander.ar(output, output, 0.5, 0.3, 0.3, 0.1, lagtime);

// Crank everything down
output = output * 0.1;

Out.ar(0, output);
});
module.load(s);
s.sync;

// Create multiple sound generators
modules = Array.fill(12,
{
arg index;
var pan, octave;
pan = 0 - ((index % 4) - 1.5)/1.5;
octave = (2 - (index / 4).floor) * 2;
"Module %: Pan %, octave %\n".postf(index, pan.round(1e-1), octave.round(1e-1));
Synth.new(\module,
[\hue, 0.5, \saturation, 0.1, \value, 0.5, \pan, pan, \gain, 0.9, \octave, octave]
)
}
);


// Hook up OSC
f = { |msg, time, addr|
if(msg[0] == '/radio') {
if(msg[1]<modules.size){
modules[msg[1]].set(\hue, msg[2]);
modules[msg[1]].set(\saturation, msg[3]);
modules[msg[1]].set(\value, msg[4]);
}
}
};
thisProcess.addOSCRecvFunc(f);
};

読み込み中…
キャンセル
保存