Nes2Triangle 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 [Nes2Noise], [Nes2DMC], [Nes2Square]


*ar(trig, start, counter, freq, vbl)

trig - control or audio rate trigger

start - linear counter start 0/1

counter - linear counter 0-127

freq - frequency 0-2047

vbl - length counter 0-31


s.boot

{Nes2Triangle.ar(Impulse.kr(10), MouseX.kr(0, 1), MouseY.kr(0, 127))}.play

{Nes2Triangle.ar(Impulse.kr(10), 0, 10, MouseX.kr(0, 2047), MouseY.kr(0, 31))}.play


{Nes2Triangle.ar(Impulse.kr(10), LFPulse.kr(0.8, 0, #[0.6, 0.5]), LFSaw.kr(0.2, 0, 63.5, 63.5), SinOsc.kr(LFSaw.kr(0.3, 0, 0.1, 0.2), 0, 200, 900).round(#[100, 110]), 3)}.play


{Nes2Triangle.ar(Dust.ar(SinOsc.ar(0.3, 0, 20, 40)), 0, SinOsc.kr(0.08, 0, 2, 3), LFNoise1.ar(SinOsc.kr(0.4, 0, 20, 40), 400, 400)).dup}.play