[PD] Binary - integer conversion

David Powers cyborgk at gmail.com
Fri Mar 16 20:59:37 CET 2007

```Please, I appreciate the answers, but again this isn't what I'm
looking for, because your method provides no speed gain, and thus no
reason to implement my idea. I was assuming there was some object
coded in C to do the conversion already in existence. I already know
how to do it "manually" in PD. But there's no point in doing binary
shift if it requires conversion through PD abstractions. I can just
achieve the same result with a simple list operation.

PD always kills my work laptop CPU (WinXP with Pentium M), so if I'm
ever gonna do serious audio with it, speed is fairly crucial...

~David

>
> binary to decimal, just raise the nth bit 2^^n, decimal to binary see attached
> (done from Kyles link) - problem: the list is a variable length and you probably
> want to pad it with zeros for whatever word length you have.
>
> On Fri, 16 Mar 2007 12:17:02 -0600
> "David Powers" <cyborgk at gmail.com> wrote:
>
> > Hi, sorry I do know that, but it's not my question.
> >
> > In order to use the bitwise operators, I think I need to convert an
> > arbitrary string of 0's and 1's, say "00010101", into an integer, in
> > this case I think 21. Is that more clear?
> >
> > Thanks,
> > David
> >
> > On 3/16/07, Steffen <stffn at dibidut.dk> wrote:
> > >
> > > On 16/03/2007, at 18.44, David Powers wrote:
> > >
> > > > Hello,
> > > >
> > > > Is it possible to somehow convert back and forth between integer and
> > > > binary in PD?
> > > >
> > > > My idea, is to represent simple drum machine style rhythms as binary
> > > > numbers. [101010001011]. Ok, so if this were a float, it would be
> > > > trivial to do a common task and shift the rhythm left or right. I
> > > > think, that other rhythmic variations would also be quite fast to
> > > > implement using this system, you can do binary math instead of list
> > > > operations which should be much faster, I assume.
> > >
> > >
> > > I think you want to have a look at the bitwice operators &,&&,|,||,<<
> > >
> > > Hope this helps.
> > >
> >
> > _______________________________________________
> > PD-list at iem.at mailing list
> > UNSUBSCRIBE and account-management -> http://lists.puredata.info/listinfo/pd-list
>
>

```