TELETYPE - Decimal to binary scene HELP

Hi,

I was looking at Noise Engineering - Variatic Eruption manual and it gave me some ideas of things i wanted to try with my teletype. But although i understand the basis of teletype language i am far from being a math guy…

So here are the things i want to do :

1 - Convert decimal numbers to binary
2 - Create a pattern ( of 1 and 0 … ) from a binary number in the tracker

So is there any way to achieve this ??? :kissing:

can you be more specific on what you want to achieve ? i’m curious…

@martinmestres that’s a really cool idea. You could effectively make each pattern step an entire pattern of gates. Might need some additional string or array features in the language though.

I don’t know exactly yet, but it could open up things like stocking decimals numbers in P.0 reading one of them to set P.1 sequence of pulses:

Ex: reading 1320 in P.0 could give that sequence in P.1:

0
0
0
0
0
1
0
1
0
0
1
0
1
0
0
0

So you could have 64 sequences stocked in P.0, and that would be a good start for a lot of deep scenes. :heart_eyes:

I hope you are wrong :cold_sweat:

so let’s say X holds your value, then you could do something like this (i don’t have access to tt right now so this might need some tweaking):

P.PUSH MOD X 2
X DIV X 2 

this will need to be executed N times where N is the number of steps, so you could either do it in M script or put it in a trigger script and loop that. the limitation is 15 bits though, since numbers are treated as signed int, so the max value is 32767 which gives you 15 bits.

slightly off topic, but:

given number X translate to triggers 1-4 in binary

TR 1 NZ AND X 1
TR 2 NZ AND X 2
TR 3 NZ AND X 4
TR 4 NZ AND X 8

basically does a bitwise AND with the binary position (power of 2) and checks if this is zero or not

on topic:

for number X, looking at step Y (16 bit)

TR 1 NZ AND X LSH 1 Y

that’ll do it. just increase Y for the step position, X is the “sequence” of 16 bits.

so yes, TT can do all this-- with one line. math is cool yeah?

4 Likes

Thank, it may take a while for my brain to process this :pensive:

So if i understand well:

means " if trigger 1 is not equal to 0"

I don’t get it…

With X = 1320 and Y position in pattern

1320 LSH 1 0 = 0
1320 LSH 1 1 = 0
1320 LSH 1 2 = 0
1320 LSH 1 3 = 0
1320 LSH 1 4 = 0
1320 LSH 1 5 = 1
1320 LSH 1 6 = 0
1320 LSH 1 6 = 1

etc…

So i’m not sure about how to write the entire “BINARY PATTERN” ( in P.N 1 ) from my decimal ( in P.N 0 ) in One TRIG. I’m thinking about something like that:

[quote]P.N 0
X P.HERE
P.N 1
P.I 0
L 0 63 : P.PUSH X LSH 1 I [/quote]

???

Why the need of a number to convert it to a sequence of 0 and 1s ? Why not simply generate the sequence with TOSS ?
L 0 63 : P.PUSH TOSS

Ha i see ! Save a lot of space that’s the point.

AND is bitwise Operation.
Any bits A and B only translate to 1 if both are 1.
You have your X in bit representation and a bitmask of 1 (0000000000000001) which you shift towards the left and therefore always gives you the next position in the bit representation of X.

Quite cool isn’t it :smile:

1 Like

This thread is so promising !!!
Let’s get crazy…how to do this in base 4, so you generate patterns of 0/1/2/3, allowing you to trigger the 4 trig outputs ? imagine the rhythm sequences…

I still don’t get why i need to put ab AND here…

@tehn

Ok think i misunderstood that thing.

I can’t make it work, i tried different adaptations and i can’t reach what i was thinking about:

• Stock decimals in P.N 0
• Convert the Decimal to Binary number
• Transform the Binary number in a pattern of 0 and 1 and set it in P.N 1

It’s a low level “trick” if you will. Getting just the bit(s) you want, in very short code.

Ok i managed to do what i wanted. I will make some modifications and post the stuff here when it’s done.

Ok this is the basis of the Scene that could open on a lot of stuff:

So put a regular clock in INPUT 2 turn PARAM knob to set a value to extract pattern from and TRIG INPUT 1 .

This is the basis, i will think about something more advance now, like chaining 2 or 4 sequences to get 32 or 64 steps patterns.