Submit
Browse
Anonymous
Login
RSS
SuperCollider Code
Fork Code: Poussière : standalone dust generator (uncommented version of luce)
name
code content
( /* Poussière module for SuperCollider, licensed under GNU GPL v3 (<https://www.gnu.org/licenses/>), Poussière means 'Dust' in French. Written by Simon Deplat (aka Dindoleon). See http://sccode.org/1-5aY for more informations. */ var synth, synth_amount_range, win, window_size, slider, margin, value, knob_size, knob_outline_size, stroke_size, frame_color, frame_border_color, gradient_color, diamond_color, diamond_outline_color; window_size = [ 400, 300 ]; knob_size = 8; knob_outline_size = 15; stroke_size = 2; margin = 3; frame_color = Color.black; frame_border_color = Color.white; gradient_color = Color.white; //Diamond Colors are disabled in order to change its color on fly //diamond_color = Color.red; //diamond_outline_color = Color.red; value = [ 0, 1 ]; synth_amount_range = [ 0.5, 10000 ]; synth = SynthDef(\poussiere, { |out = 0, freq = 440, amp = 0, amount = 0| var snd; snd = Dust2.ar(amount, 1); Out.ar(out, Pan2.ar(snd, 0, amp)); }).play; win = Window("Poussière", Rect(0, 0, window_size[0], window_size[1]), false); win.background_( frame_color ); slider = UserView( win, Rect( margin, margin, window_size[0] - ( margin * 2 ), window_size[1] - ( margin * 2 ) )); slider.drawFunc = { Pen.width = stroke_size; Pen.addRect( Rect(0,0, slider.bounds.width,slider.bounds.height) ); Pen.fillAxialGradient( slider.bounds.leftBottom, slider.bounds.rightTop, Color.black, gradient_color ); Pen.moveTo( ( slider.bounds.width * value[0] - knob_size ) @ ( slider.bounds.height * value[1] ) ); Pen.lineTo( ( slider.bounds.width * value[0] ) @ ( slider.bounds.height * value[1] - knob_size ) ); Pen.lineTo( ( slider.bounds.width * value[0] + knob_size ) @ (( slider.bounds.height * value[1] ) ) ); Pen.lineTo( ( slider.bounds.width * value[0] ) @ ( slider.bounds.height * value[1] + knob_size ) ); Pen.fillColor_( Color.new( 1-((0.5*value[0])+(0.5*(1-value[1]))), 1-((0.5*value[0])+(0.5*(1-value[1]))), 1-((0.5*value[0])+(0.5*(1-value[1]))) ) ); // Here. Pen.fill; Pen.moveTo( 0 @ ( slider.bounds.height * value[1] ) ); Pen.lineTo( ( slider.bounds.width * value[0] - knob_outline_size ) @ ( slider.bounds.height * value[1] ) ); Pen.moveTo( ( slider.bounds.width * value[0] ) @ 0 ); Pen.lineTo( ( slider.bounds.width * value[0] ) @ ( slider.bounds.height * value[1] - knob_outline_size ) ); Pen.moveTo( ( slider.bounds.width * value[0] + knob_outline_size ) @ (( slider.bounds.height * value[1] ) ) ); Pen.lineTo( slider.bounds.width @ (( slider.bounds.height * value[1] ) ) ); Pen.moveTo( ( slider.bounds.width * value[0] ) @ (( slider.bounds.height * value[1] + knob_outline_size ) ) ); Pen.lineTo( ( slider.bounds.width * value[0] ) @ slider.bounds.height ); Pen.moveTo( ( slider.bounds.width * value[0] - knob_outline_size ) @ ( slider.bounds.height * value[1] ) ); Pen.lineTo( ( slider.bounds.width * value[0] ) @ ( slider.bounds.height * value[1] - knob_outline_size ) ); Pen.lineTo( ( slider.bounds.width * value[0] + knob_outline_size ) @ (( slider.bounds.height * value[1] ) ) ); Pen.lineTo( ( slider.bounds.width * value[0] ) @ (( slider.bounds.height * value[1] + knob_outline_size ) ) ); Pen.lineTo( ( slider.bounds.width * value[0] - knob_outline_size ) @ ( slider.bounds.height * value[1] ) ); Pen.strokeColor_( Color.new( 1-((0.5*value[0])+(0.5*(1-value[1]))), 1-((0.5*value[0])+(0.5*(1-value[1]))), 1-((0.5*value[0])+(0.5*(1-value[1]))) ) ); // And here. Pen.stroke; Pen.addRect( Rect(0,0, slider.bounds.width,slider.bounds.height) ); Pen.strokeColor_( frame_border_color ); Pen.stroke; }; slider.action = { synth.set(\amp, 1 - value[1]); synth.set(\amount, linexp(value[0], 0, 1, synth_amount_range[0], synth_amount_range[1])); slider.refresh }; slider.mouseDownAction = { arg slider, x = 0.5, y = 0.5, m; ([256, 0].includes(m)).if{ value[0] = (x).linlin(0,slider.bounds.width,0,1); value[1] = (y).linlin(0,slider.bounds.height,0,1); slider.doAction}; }; slider.mouseMoveAction = slider.mouseDownAction; win.front; )
code description
Dust2 synth controlled by a custom 2D slider (kind of simulates vinyl crackles). Actually an uncommented fork of the luce module. Easy to integrate and modify.
use markdown for formating
category tags
comma separated, i.g. "wild, siren" (do not enter default SC class names, please)
ancestor(s)
comma separated identificators, i.g. "1-C,1-1,1-4M,1-x"
Private?
the code will be accessible by direct url and not visible in public activity
signup to submit public code without captcha
comment of change