PHP5 BitArray class

Recently I had an idea to try making some kind of generative music program. I got thinking about how to model harmony and musical scales etc. It seemed like the simplest way to think of an (abstract, i.e. key-less) scale was as a 12-bit binary number.

Well, ‘the thing’ will eventually have some kind of web-facing API so I’m building it in PHP.  Some operations are conveniently done using just a binary number and bitwise operators, others (eg random access to individual bits) are less convenient and would benefit from a helper class of some kind.

Read more of this post