RedBitStream stream bits


Inherits from: Stream


modelled after CollStream.  produces a bit stream out if an array of integers.

the least significant bit comes first in each byte.  (LSB)

use class RedBitStream2 for most significant bit first.  (MSB)


*new(collection, byte)

collection - an Array of integers

byte - number of bits per byte in this collection of integers.

if byte is 8 then integers should not be greater than 255.


//--

a= RedBitStream((0..255), 8);

a.nextN(8);

a.nextN(8);

a.nextN(8);

a.nextN(8);

a.nextN(8);

a.nextN(16);


//--count from 0 to 255 lsb.  the process takes 4min and 25sec

s.boot;

a= RedBitStream((0..255), 8);

b= Pbind(\degree, a, \dur, 0.125, \amp, 0.3, \legato, 0.4).play;

b.stop


//--same but msb

a= RedBitStream2((0..255), 8);

b= Pbind(\degree, a, \dur, 0.125, \amp, 0.3, \legato, 0.4).play;

b.stop