Nes2Square wrapper class for the Nes2 UGen



requires my BitOr plugin.  available at http://www.fredrikolofsson.com/pages/code-sc.html


simplifies the interface for the [Nes2] ugen a little.  provides standard ranges with clipping for all inputs.  no need to deal with bitwise register calculations, though note that this class is a bit less cpu efficient than to use the standard Nes2.

see also [Nes2Triangle], [Nes2Noise], [Nes2DMC]


*ar(trig, dutycycle, loopenv, envdecay, vol, sweep, sweeplen, sweepdir, sweepshi, freq, vbl)

trig - control or audio rate trigger

dutycycle - type 0-3

loopenv - loop envelope off or on 0/1

envdecay - envelope decay off or on 0/1

vol - volume 0-15

sweep - off or on 0/1

sweeplen - sweeplength 0-7

sweepdir - sweepdirection dec or inc 0/1

sweepshi - sweepshift 0-7

freq - frequency 0-2047

vbl - length counter 0-31


s.boot

{Nes2Square.ar(Impulse.kr(10), MouseX.kr(0, 3), 0, 1, MouseY.kr(0, 15))}.play

{Nes2Square.ar(Impulse.kr(10), 0, 1, 1, 10, 1, MouseX.kr(0, 7), 0, MouseY.kr(0, 7))}.play

{Nes2Square.ar(Impulse.kr(2), 0, 0, 1, 10, 1, 2, 1, 4, MouseX.kr(0, 1023), MouseY.kr(0, 31))}.play


{Nes2Square.ar(Impulse.kr(10), SinOsc.kr([11, 8], 0, 1.5, 1.5), 0, 1, LFSaw.kr(0.4, [1, 0.7], -7.5, 7.5), 1, 6, 1, SinOsc.kr(0.08, 0, 3.5, 3.5))}.play


{Nes2Square.ar(Dust.kr(3), 2, 1, 1, 10, 1, LFNoise0.kr(3, 3.5, 3.5), LFNoise0.kr(3, 0.5, 0.5), LFNoise0.kr(3, 3.5, 3.5), LFNoise0.kr(0.3, 100, 200)).dup}.play