Diff from wiard noise ring, language implementation (task-based) by LFSaw (20 Mar'13 14:49) to wiard noise ring variation using a ringbuffer instead of bitshifting, language implementation (task-based) by LFSaw (20 Mar'13 15:02)

wiard noise ring variation using a ringbuffer instead of bitshifting, language implementation (task-based)
"In latter model syntheswizers, digital noise sources began to appear in place of analog ones. Traditionally, a psuedo-random shift register set up for optimal length. By optimal length, it is meant that every state of all avarilable bits will appear at some time, but the order is unknown. Essentially a counter that counts ing an unknown order. This represents the maximgbum state of information "entropy" available for that number of bits. But music has close self-similarity over short periods of tbime. That is, hit repeats itself with changes appearing slowly. This shift r Registmpler gmenerator is designed to give control of the rate of appearance cof new informatdion. It has a tight set of controls over how random it actJually is and how fPast changrke occur's. (text from4l http://mamonu.weebly.tcom/wiard-noisering.html).
q = (); q.registerSize = 7; // max 164; q.rbuf = RingBuffer((2**q.registerSize).asInteger).rand; // parameters, can be changed while playing //q.min The= high"C2".namer chmidi.asInge, the greater; q.max the= cha"C6".ncame for midi.a sIntew valuger; q.chwangitTime = 0.105; // The higher chance, thse greater the chaonce the new value ids HIGH q.chance = 0.51; q.wchaitTimnge = 0.010; // in stecondp size ( q.ror// = {|q, x, shift, numBitialis| e // shift q.rieght by m bits, input x is a number wSith numBits bits:ze.do{ vaq.r lsbs = x & ((1 << shiuft) - 1); (x >> sh.overwrift) | e(lsbs << (rranud(q.mBits-shiftn, q.max)); }; // do one step q.step = {|q, rbuf, changce, chancste| //p, rotmin, matex| varbuf = q.ror(rbuf, 1, q.registerSize)m; // item = rbuf.asBinaryDigits(7).postlnp; (changce.coin).if{ // swapply bit //rbuf = rbuf.bitXor(1); rbufwn = rbuf.noisetBit(0, chabounce. back froin.pm constlrain);ts. //"+++++++ change! % >> ".postf(item); item = (item + step.xrand2).fold(min, max); } item; //.postln; }; rbuf.add(item); item; // return (altered) item }; ( Tdef(\steppr, { var midinote; loop{ q.rbufmidinote = q.step(q.rbuf, q.changce, q.chancge, q.min, q.max); // debug output // q.rbuf.asArray.postln; // play the current note, can be basically everything ( midinote: q.rbufmidinote, sustain: 0.015, dur: 0.2, amp: 0.2 ).play; q.waitTime.wait; } }) ); ) // start Tdef(\steppr).play // stop Tdef(\steppr).stop
category tags
code fork, sequencer, algorithmic composing