Procházet zdrojové kódy

Added neovim config

tags/kitchen
Pete Shadbolt před 3 roky
rodič
revize
79206e0a49
3 změnil soubory, kde provedl 21 přidání a 17 odebrání
  1. +18
    -15
      audio.scd
  2. +1
    -0
      debug.scd
  3. +2
    -2
      radio.py

+ 18
- 15
audio.scd Zobrazit soubor

@@ -1,3 +1,5 @@
// SVNVimStart

s = Server.local;
s.waitForBoot {
var module, msg, modules;
@@ -9,22 +11,25 @@ s.waitForBoot {

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


// Calculate some parameters
frequency = 800 + 500*hue;
qfactor = (1 - saturation)**4;
osc_level = saturation;
noise_level = 1 - osc_level;
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);

// Generate some sounds
// noise = WhiteNoise.ar(1);
noise = Crackle.ar(1.9, 1.0);
noise = Crackle.ar(1.99, 1.0);
filter = BPF.ar(noise, frequency, qfactor) * noise_level;
oscillator = SinOsc.ar(frequency) * osc_level;
//oscillator = SinOsc.ar(frequency) * osc_level;
oscillator = DPW3Tri.ar(frequency) * osc_level;
mixer = Mix.ar([filter, oscillator]);
panner = LinPan2.ar(mixer, 2*pan - 1, value * 0.2);
panner = LinPan2.ar(mixer, pan, 10*HPF.kr(value, 10**(1-octave*2))**2);
Out.ar(0, panner);
});
module.load(s);
@@ -34,23 +39,21 @@ s.waitForBoot {
modules = Array.fill(12,
{
arg index;
var pan;
var pan, octave;
pan = ((index % 4) - 1.5)/1.5;
octave = (index / 4).floor;
"% %\n".postf(pan, octave);
Synth.new(\module,
[\hue, 0.5, \saturation, 0.1, \value, 0.5, pan, 0.5, \gain, 0.9]
[\hue, 0.5, \saturation, 0.1, \value, 0.5, pan, 0.5, \gain, 0.9, \octave, octave]
)
}
);

"%\n".postf(modules[0]);
"%\n".postf(modules[1]);

// Hook up OSC
f = { |msg, time, addr|
if(msg[0] == '/radio') {
"Got data: index: % hue: % sat: % value: % pan: %\n".postf(msg[1], msg[2], msg[3], msg[4], msg[5]);
if(msg[1]<modules.size){
"Applying to module %\n\n".postf(msg[1]);
modules[msg[1]].set(\hue, msg[2]);
modules[msg[1]].set(\saturation, msg[3]);
modules[msg[1]].set(\value, msg[4]);


+ 1
- 0
debug.scd Zobrazit soubor

@@ -0,0 +1 @@
SinOsc.ar(1000).play

+ 2
- 2
radio.py Zobrazit soubor

@@ -24,7 +24,6 @@ def analyze_block(frame, osc, index, sp, ep, send=False):
h, s, v = colorsys.rgb_to_hsv(*average_color)

# Configure the oscillator
# and index == 0:
if send:
print("Sending message", h, s, v)
osc.send_message(
@@ -62,7 +61,7 @@ def analyze(frame, osc):
if time.time() - LAST_MESSAGE_TIME > 0.1:
LAST_MESSAGE_TIME = time.time()
send = True
for index, (x, y) in enumerate(it.product(range(n), range(m))):
for index, (y, x) in enumerate(it.product(range(m), range(n))):
sp = (int(x * dx), int(y * dy))
ep = (int(x * dx + dx), int(y * dy + dy))
frame = draw_rectangle(frame, sp, ep)
@@ -71,6 +70,7 @@ def analyze(frame, osc):


if __name__ == '__main__':
# camera = cv2.VideoCapture("/dev/video2")
camera = cv2.VideoCapture(0)
osc = udp_client.SimpleUDPClient("0.0.0.0", 5005)



Načítá se…
Zrušit
Uložit