Skip to content

Instantly share code, notes, and snippets.

@moxuse
moxuse / gist:1183270
Created August 31, 2011 10:37
Cut Oscillator Sequence with BBCut
(
SynthDef("sinerl0",{arg amp=0.8,att,rel,note;
var src,freq;
src=Mix.fill(3,{freq=(note+[0,5,7,12,36,48].choose).midicps;SinOsc.ar([freq,freq+(5.rand)],0,0.2)*amp})
*EnvGen.ar(Env.perc(att,rel,0.99,-3),doneAction:2);
Out.ar(10,src);
}).store;
SynthDef("sinerl1",{arg amp,note;
var src,freq;
@moxuse
moxuse / gist:1183279
Created August 31, 2011 10:41
one line aho
Tempo.bpm=155;SynthDef("hh1",{|out=20,amp=1,rate=1|var src;src=RLPF.ar(Pan2.ar(ClipNoise.ar(0.2)),LFNoise2.ar(0.1,3000,9000),0.3)*EnvGen.ar(Env.perc(0.01,0.07,amp,-6),doneAction:2);Out.ar(20,src)}).store;SynthDef("snr",{|out=20,amp=1,rate=1,src,src2|src=RHPF.ar(ClipNoise.ar(0.05),LFNoise2.ar(1,700,800),0.3)*EnvGen.ar(Env.perc(0.00,0.125,amp,-3),doneAction:2);src2=SinOsc.ar(120,0,0.3)*EnvGen.ar(Env.perc(0.00,0.26,amp,-12),doneAction:2);Out.ar(out,(src+src2).dup);}).store;SynthDef("hh2",{|out=20,amp=1,rate=1|var src,src2;src=RLPF.ar(ClipNoise.ar(0.15),LFNoise2.ar(1,1200,9700),0.8)*EnvGen.ar(Env.perc(0.00,0.125,amp,2),doneAction:2);src2=RLPF.ar(BrownNoise.ar(0.35),945)*EnvGen.ar(Env.perc(0.00,0.2,amp,-12),doneAction:2);Out.ar(out,Pan2.ar(src+src2,LFNoise2.ar(1)));}).store;SynthDef("kicks",{|amp|var out;out=SinOsc.ar(XLine.kr(7020,50,0.02),pi/4,amp).dup*EnvGen.ar(Env.perc(0.03,0.25,0.65,-6),doneAction:2);Out.ar(0,out.softclip);}).store;SynthDef("snr1",{|out,amp,rate=1|Out.ar(out,Pan2.ar(PlayBuf.ar(1,3,rate,1.0,0.
@moxuse
moxuse / gist:1239128
Created September 24, 2011 08:47
lumin
(
SynthDef("lumin0",{arg freq=4000,amp=1,gate=1,rate=68;
var src;
src=RHPF.ar(Klank.ar(`[[4105, 128, 123, 8083]*rate, 0.5, [1,1,1,1]], ClipNoise.ar([0.005,0.005]) )*EnvGen.ar(Env.adsr(0.00,0.3,0.1,0.1,0.8,-3),gate,doneAction:2),LFNoise2.ar(2,23,36).midicps,0.4);
Out.ar(0,src*amp);
}).store;
SynthDef("lumin1",{arg freq=4000,amp=1,gate=1,fx=68;
var src;
src=RHPF.ar(Impulse.ar([freq,freq*2.01]*92,SinOsc.ar([freq,freq*1.01]*36*SinOsc.ar(freq*82,0,0.1)),SinOsc.ar([freq/fx,freq/fx*0.99]*102,0,0.3*amp*Decay2.ar(Dust.ar(8),0.0,0.05)))*EnvGen.ar(Env.adsr(0.00,0.2,0.2,0.1,0.8,3),gate,doneAction:2),LFNoise2.ar(2,23,36).midicps,0.4);
@moxuse
moxuse / gist:1242464
Created September 26, 2011 15:12
SimpleOscPlay
(
var indexNum,window,portText,hostText,addresText,address,slideView,
numArray,bufferArray,pattern,valMonitor,playButton,resetButton,task,host,port,
stDist,scale,scaleTex,scaleTexField,poler,modePopup;
///////////priset destination OSC///////
host = "127.0.0.1";
port = 5000;
address = "/value";
@moxuse
moxuse / gist:1306057
Created October 22, 2011 14:24
Non realtime SCSynth Render Server Client
"SC_SYNTHDEF_PATH".setenv("PATH FOR synthDefFiles");
(
o = OSCReceiver("/assign", nil);
OSCReceiverFunction("/assign", "gf", {|msg|
var graphFnc,time,second,scoreFile,pathToSoundDir,isFile,skip;
skip = false;
pathToSoundDir = "PATH FOR soundFiles dir";
time = Date.getDate.format("%Y%m%d%H%M%S");
@moxuse
moxuse / gist:2602067
Created May 5, 2012 12:42
get twitter #sc140 with curl
"curl search.twitter.com/search.json?q=%23sc140".unixCmdGetStdOut;
@moxuse
moxuse / gist:4016192
Created November 5, 2012 09:10
Load Binary File To Buffer
(
f = File("PATH TO YOUR FILE","rb");
a = [];
240000.do({arg i;
a = a.add( f.getInt8 );
});
b = Buffer.loadCollection(s, a.normalize);
f.close;
a.plot
)
@moxuse
moxuse / gist:4230241
Last active October 13, 2015 17:27
map挿入、検索、削除
/////////////// insert
users.insert( map<string, UserClass>::value_type( str, UserClass( args.. ) ) );
////////// loop access
map<string, UserClas>::iterator it = users.begin();
while( it != users.end() ) {
cout << "key : " << (*it).first << " value : " << (*it).second << endl;
++it;
@moxuse
moxuse / gist:4239726
Created December 8, 2012 10:30 — forked from reprimande/gist:4239620
play binary by supercollider
(
s.waitForBoot {
var rootPath, window, view,
drawBuf, bufnum, sound, task,
width, height, fps, curX, curY, pixSize,
processFunc, loadFile;
// initial settings
rootPath = "/path/to/root/dir";
pixSize = 5;
@moxuse
moxuse / OSCThreadedObject.h
Created December 11, 2012 02:06
openframeworks OSC Recieveのスレッディング サンプル
#define PORT 5000
#import "ofmain.h"
#include "ofxOsc.h"
#include "User.h"
class OSCThreadedObject : public ofThread {
private:
ofxOscReceiver receiver;