Skip to content

Instantly share code, notes, and snippets.

@furenku
Created April 4, 2016 02:28
Show Gist options
  • Save furenku/5d5a097d5afbde721d8ac59854adb222 to your computer and use it in GitHub Desktop.
Save furenku/5d5a097d5afbde721d8ac59854adb222 to your computer and use it in GitHub Desktop.
// la id llega como símbolo desde OSC
~id = \1;
// convertir a Int
~id = ~id.asInteger;
SynthDef(\test,{
|x=500,y=300,gate=1|
// ruido filtrado:
// utilizar los valores de x, y para controlar frecuencia y ancho de banda
var freq = ( x ) + 100;
var q = abs((( 1 - ( y / 600 ) ))) / 100 + 0.001;
var amp = 0.5;
~z = Resonz.ar( WhiteNoise.ar, freq, q );
~z = ~z * EnvGen.kr(Env.asr,gate,doneAction:2);
Out.ar( 0, Pan2.ar( ~z / amp ) );
}).store;
~synths = Dictionary.new;
// crear el sintetizador utilizando la id "1"
~synths[~id]=Synth("test");
// controlar sus parametros
~synths[~id].set(\x, 200);
~synths[~id].set(\y, 100);
// eliminar el sinte, utilizando un envolvente
~synths[~id].release;
// dos sintes a la vez:
(
~id_uno = \17;
~id_uno = ~id_uno.asInteger;
~id_dos = \347;
~id_dos = ~id_dos.asInteger;
~synths[~id_uno]=Synth("test");
~synths[~id_dos]=Synth("test");
)
// controlar parametros de cada uno
(
~synths[~id_uno].set(\x, 330);
~synths[~id_uno].set(\y, 500);
~synths[~id_dos].set(\x, 733);
~synths[~id_dos].set(\y, 540);
)
// yea:
(
~synths[~id_uno].set(\x, 310);
~synths[~id_uno].set(\y, 100);
~synths[~id_dos].set(\x, 1466);
~synths[~id_dos].set(\y, 140);
)
// eliminar los sintes
(
~synths[~id_uno].release;
~synths[~id_dos].release;
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment