‹ Deleted QuarksextMasterEQ ›


2014-10-03 11:53:12 supercollider

clean-up: #41

Yet another small piece of code I found in my SuperCollider extensions folder.

It's very basic and just generates a PWM signal (Pulse-Width Modulation). You could do the same thing quicker with the standard LFPulse, but sometimes it's good to roll your own just to see another approach.

Pwm {
    *ar {|freq= 100, width= 0.5|
        ^LFSaw.ar(freq)>(width* -2+1);
    *kr {|freq= 100, width= 0.5|
        ^LFSaw.kr(freq)>(width* -2+1);
//mouse controls pwm duty cycle
{Pwm.ar(300, MouseX.kr(0, 1))!2*0.2}.play
//simulating voltage
{Amplitude.ar(Pwm.ar(300, MouseX.kr(0, 1))).poll; DC.ar(0)}.play
‹ Deleted QuarksextMasterEQ ›