I'll try to dig up my c code and give it to you, in exchange for GPL. ~Kyle
On 3/17/07, padawan12 <[EMAIL PROTECTED]> wrote: > On Fri, 16 Mar 2007 13:18:12 -0600 > "David Powers" <[EMAIL PROTECTED]> wrote: > > > Wow I thought for sure this would be built in ... or at least a common > > external. > > It possibly is. I'm just showing you how to do it from scratch in a way > that directly follows the algorithm Kyle pointed you at. > > You could use << and >> to rotate your numbers, and other ways to do it > differently. Making it extensible/flexible so that you can work on > 8, 16, 32 or bigger rythmns is an important consideration, and you > usualy end up using lists to do that or adopt a fixed width approach. > > > I guess speed is the issue here for me, rather than the ability to > > convert per se. > > The binary representation of beats has come up before, several times and > although it is seductive as an apparently efficient data structure it > has a bunch of its own pitfalls and weaknesses that I'm sure you will have > fun discovering :) As for speed, I don't think the conversion stage is > where you will gain much opimisation anyway if your premise is to save > cycles by doing bitwise transformations on integers. > > > This would be a good reason to write my first external > > I guess. > > Yes it would be a good task to do. It's quite trivial > in C. You could make a simple and general [bit n] > that returns the nth bit of a decimal int on its > left inlet. To do it properly and make it maintainable > perhaps some arguments for byte/word size and endiness > would help. > > > > > ~David > > > > On 3/16/07, Kyle Klipowicz <[EMAIL PROTECTED]> wrote: > > > You must implement the algorithm shown in this link: > > > > > > http://en.wikipedia.org/wiki/Binary_numeral_system#Decimal > > > > > > I did that in C during that earlier mentioned summer of my K&R C > > > binge. I'm not sure how tricky it would be to do in Pd. > > > > > > ~Kyle > > > > > > On 3/16/07, David Powers <[EMAIL PROTECTED]> 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 <[EMAIL PROTECTED]> 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 &,&&,|,||,<< > > > > > and >>. See also http://en.wikipedia.org/wiki/Bitwise_operation > > > > > > > > > > Hope this helps. > > > > > > > > > > > > > _______________________________________________ > > > > [email protected] mailing list > > > > UNSUBSCRIBE and account-management -> > > > > http://lists.puredata.info/listinfo/pd-list > > > > > > > > > > > > > -- > > > > > > http://theradioproject.com > > > http://perhapsidid.blogspot.com > > > > > > (((())))(()()((((((((()())))()(((((((())()()())()))) > > > (())))))(()))))))))))))(((((((((((()()))))))))((()))) > > > ))(((((((((((())))())))))))))))))))__________ > > > _____())))))(((((((((((((()))))))))))_______ > > > ((((((())))))))))))((((((((000)))oOOOOOO > > > > > > > _______________________________________________ > > [email protected] mailing list > > UNSUBSCRIBE and account-management -> > > http://lists.puredata.info/listinfo/pd-list > > _______________________________________________ > [email protected] mailing list > UNSUBSCRIBE and account-management -> > http://lists.puredata.info/listinfo/pd-list > -- http://theradioproject.com http://perhapsidid.blogspot.com (((())))(()()((((((((()())))()(((((((())()()())()))) (())))))(()))))))))))))(((((((((((()()))))))))((()))) ))(((((((((((())))())))))))))))))))__________ _____())))))(((((((((((((()))))))))))_______ ((((((())))))))))))((((((((000)))oOOOOOO _______________________________________________ [email protected] mailing list UNSUBSCRIBE and account-management -> http://lists.puredata.info/listinfo/pd-list
