Diff from wiard noise ring, language implementation (task-based) by LFSaw (20 Mar'13 19:49) to wiard noise ring variation using a ringbuffer instead of bitshifting, language implementation (task-based) by LFSaw (20 Mar'13 20:02)
name
wiard noise ring variation using a ringbuffer instead of bitshifting, language implementation (task-based)
description
code
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
ancestors
1-4SD