Hello, Does anyone have an example of how to do ternary counting in pd? 00 01 02 10 11 12 20 21 22 ...etc
thanks, Tim
Try a [div] [mod] chain
Four digits base 3 would be
base 10 | [t f f]_[mod 3]_ D0 | [div 3] | [t f f]_[mod 3]_ D1 | [div 3] | [t f f]_[mod 3]_ D2 | div 3] | [t f f]_[mod 3]_ D3 | etc. for more digits
On Thu, 8 Sep 2011 15:19:03 +0200 tim vets timvets@gmail.com wrote:
Hello, Does anyone have an example of how to do ternary counting in pd? 00 01 02 10 11 12 20 21 22 ...etc
thanks, Tim
perfect, thanks :) Tim
2011/9/8 Andy Farnell padawan12@obiwannabe.co.uk
Try a [div] [mod] chain
Four digits base 3 would be
base 10 | [t f f]_[mod 3]_ D0 | [div 3] | [t f f]_[mod 3]_ D1 | [div 3] | [t f f]_[mod 3]_ D2 | div 3] | [t f f]_[mod 3]_ D3 | etc. for more digits
On Thu, 8 Sep 2011 15:19:03 +0200 tim vets timvets@gmail.com wrote:
Hello, Does anyone have an example of how to do ternary counting in pd? 00 01 02 10 11 12 20 21 22 ...etc
thanks, Tim
-- Andy Farnell padawan12@obiwannabe.co.uk
Pd-list@iem.at mailing list UNSUBSCRIBE and account-management -> http://lists.puredata.info/listinfo/pd-list
On Thu, 8 Sep 2011, Andy Farnell wrote:
Try a [div] [mod] chain
Four digits base 3 would be
Also, to have the counting itself in base 3, chain counters that count 0,1,2,0,1,2,0,1,2,... in which each counter adds a 1 to the counter on the left whenever it goes from 2 to 0.
This makes a sequence like 00 01 02 10 11 12 20 21 22 as Tim wants.
This can be converted back to another number format using the opposite of what Andy showed :
take D3 multiply by 3 add D2 multiply by 3 add D1 multiply by 3 add D0
But the output of this, and the input of Andy's, is not necessarily in base 10. It is actually in the base that [mod], [div], [*] and [+] are in, and in the case of Pd, that's in binary.
libc's printf() function does something very much like what Andy said, to convert its binary ints to decimal ascii. The differences are that it says 10 instead of 3, and it adds 48 to each digit because codes 48 through 57 represent the 10 digits.
| Mathieu Bouchard ---- tél: +1.514.383.3801 ---- Villeray, Montréal, QC
On 08/09/2011 15:39, Andy Farnell wrote:
Try a [div] [mod] chain
Four digits base 3 would be
base 10 | [t f f]_[mod 3]_ D0 | [div 3] | [t f f]_[mod 3]_ D1 | [div 3] | [t f f]_[mod 3]_ D2 | div 3] | [t f f]_[mod 3]_ D3 | etc. for more digits
On Thu, 8 Sep 2011 15:19:03 +0200 tim vetstimvets@gmail.com wrote:
Hello, Does anyone have an example of how to do ternary counting in pd? 00 01 02 10 11 12 20 21 22 ...etc
thanks, Tim
Maybe also something like this (still using [mod 3] and [div 3] as Andy suggested)?
Lorenzo