# Teletype haiku

That would be fantastic! I started and then realised it was a task to big for my spare time just now.

I have a spreadsheet I’ve dedicated to the task but it’s barely fit for human consumption

6 Likes

Dog, this is clutch! I very much appreciate this and find the inclusion of how these numbers add up is sweet. Just for my own edification; what is the mathematical equation I use to convert the 1-0 based string in to the summed number at the bottom?

Each nth bit is worth 2^n-1, and they just get added up. Root is 1st bit.
e.g. `=B13*1+B12*2+B11*4+B10*8+B9*16+B8*32+B7*64+B6*128+B5*256+B4*512+B3*1024+B2*2048`

2 Likes

Okay, cool, and we count down, I assume, so, for instance, it B13 would be the top, and then moving down?

Nah those are Excel rows, so B13 is actually the bottom row. Root is just a 1 in cell B13. `B13*1 = 1`. Let’s say root is C. One semitone up is in cell B12. So if the scale contains a C#, you’d put a 1 in cell B12. `B12*2 = 2`. And so on.

This is great. I’ll share a “screen shot” of my work in progress. I had been using the =BIN2DEC formula in excel but it only calculates up to 10 bits so I found the others in the link I provide above.
I like your first principles approach because you can define a 12tet scale/chord and get the decimal. Going the other way seems difficult though.

3 Likes

You can also use Teletype itself to calculate the numbers for you. If you use this script the pattern of 1s and 0s in the first column of the tracker will be converted into a decimal number and stored in A. You can combine this with my haiku to make a quantiser that you can switch on and off semitones. (If you use the original haiku, make sure you have a 1 at the root note - I.e. first position in the pattern.)

``````#1
P.N 0; A 0
L 11 0: A + LSH A 1 P I``````
6 Likes

Thanks for sharing this! What a astonishing haiku.
I’m newbie to programming and tt, there are several questions regarding this script.
As my understanding (and questions):
Randomly set variable `x` as a value within 0 to 36
`J BSET 0 % X 12 ` – How to understand `BSET`? ; Set `K` to 0
Do while `J` & `A` is 0?? ; `J RSH J 1` – How to understand this

It would be great if you can translate the whole script in English for me to understand. Thanks!

Yes - the chaos operator does this in a pseudo random way. In practice I don’t normally use this line and I usually set X from some other process (e.g. a voltage input) that I want to quantise. (Also I don’t normally have this script in metro - I usually put it in script 8, which I call whenever I want to quantise whatever is stored in X at the time.)

BSET sets a particular binary digit within a number on. This line gives us a number with just one of the 12 semitones set to “on” (controlled by X - the % throws away the octave information and just gives us a number between 0 and 11). Think of it like taking a zero and then flipping one bit to on.

This is a very condensed bit of code! Basically it shifts the bit (the semitone that’s going to play) rightwards (I.e. down the the scale) until that note coincides with a note that is in the scale. The logical and operator ‘&’ here is doing the work for us. It will return zero if the single bit that’s on in J doesn’t correspond to a bit that’s on in A and non-zero otherwise.

Hope this helps! I tried to do a line-by-line translation further up the thread. Have fun!

A quick tip: you can play around with some of these lines of code in the live mode to try and get a sense of what they do. For example, try typing BSET 0 1 or BSET 0 2 etc. in the live mode to see what gets returned by this operator. Also it’s helpful to run scripts with the variable view showing (press the back quote key in live mode) so you can keep track of what’s happening.

4 Likes

Big thanks @SimonKirby! With your words I believe I can counter the script line by line! I am gonna busy with my tt now!

I thought I’d share something I made with the binary quantiser haiku. Here I’ve built a script around it that plays a 6 voice prolation canon (where each of 6 voices play the same pattern but at different speeds and different transpositions within the scale). The speed is controlled by triggers from meadowphysics and the transposition by TXi. The voices are Just Friends, Plaits and Rings. The scales are: 1, 137 and 1165 Hope you all have a restful festive break!

Full version:

Instagram clip:

9 Likes

a fairy simple script (but a huge discovery to me). a short decay envelope with end of cycle trig out (decay amount controlled by `PARAM` knob)

``````#1

CV.SET 1 V 5; CV.SLEW 1 PRM
DEL EXP PRM: CV 1 0
DEL PRM: TR.P 1 -- you can patch the TR 1 to IN 1 to make it recycle
``````

or replace the last line with

``````DEL PRM: \$ 1
``````

i found that it would be a bit more pleasant for adding `EXP` (expontenial) on second line.
to avoid strange behavior, it is better set min 164 or above by use of `PARAM.SCALE min max` in `I` script.

thinking of what to do a adjustable AD function generator. any idea?

3 Likes

Nice! To make it have an attack slope too then you could move the slew to the start of the script and use CV rather than CV.SET for the attack part I guess.

I think it should be possible to make a full ADSR type envelope with a bit of work and using the new POL operators which allow a script to be triggered at the end of gate as well as the start… I wonder if it could be done as a haiku? Sounds like a challenge

Ok, this works as an ADSR, based on @vinc’s lovely idea. You need to mult your gate into both the first and second trigger inputs (could probably get around this by checking and changing script polarity in the one script but this would likely take it over the haiku limit!).

``````#1
CV.SLEW 1 A; CV 1 V 10
DEL A: \$ 3

#2
DEL.CLR; CV.SLEW 1 D; CV 1 0

#3
CV.SLEW 1 B; CV 1 C

#I
\$.POL 2 2
``````

The variables A,B,C and D contain the ADSR values. So, you can set them by typing something like this at the live prompt:

``A 100; B 500; C V 1; D 500``
7 Likes

I’m currently experimenting with a Hertz Donut mk2 alongside a mk3 to decide which I want to keep (if not both). One thing the mk3 does that I miss on the mk2 is a mode where the modulation oscillator quantizes to pleasant FM ratios. So I thought I’d create a tool for Teletype to generate those offsets, so I can turn the Param knob and have it sweep just those clean ratios.

What I do is set green tracking mode, turn the coarse modulation frequency down to 0 and patch CV 1 from Teletype to the V/OCT modulation input. I set TT’s param knob so A is 3, and fine-tune the modulation osc so the ratio light turns green.

``````M:
A / PARAM 1024
CV 1 PN 0 A
``````

I determined the pattern values by ear:

``````740
1410
1833
2370
3055
3340
4109
4971
5650
6178
6610
7060
7333
7862
8300
9230``````
5 Likes

Studying other people Teletype codes, I came across your haiku and I’ve had to try it. Very nice code!

4 Likes

extracting this from another post: sequence sequencer.

``````#I
G.BTX 16 0 0 1 1 1 0 0 16 8
Z 16

#M
G.CLR
G.REC T 0 1 8 -2 -2
L 1 8: \$ * I G.BTN.V + T * I Z
T % + T 1 Z
``````

use this with grid or with keyboard in grid visualizer mode. there are 8 rows of 16 columns, representing an 8 track 16 step sequencer. when a step is on it will trigger a corresponding script.

in this demo scripts 1-4 play a note / a chord / a strummed chord (using disting ex with wavetable algo) and scripts 5-8 control the wavetable and filter parameters and delay multiplier on disting ex #2 (running augustus loop delay):

https://www.instagram.com/p/CKsJQSPh6LO/

edit: fixed a small error, thanks to @renegog for spotting it!

8 Likes

My first Haiku!
Revolves around sending a pattern of bipolar VV values from Txo to the instruo Lúbadh’s speed input.

Assuming the playback speed is set as 0 on the Lúbadh:

VV -260 reverse x4
VV -125 reverse x2
VV -35 reverse x½
VV 35 x½
VV 65 x1
VV 125 x2
VV 260 x4

#M
M 900; \$1

#1
TO.CV 1 VV P.RND 0
P.N 0; P.L 8; CV 1 V RAND 5
EVERY RAND 5: TR.P 1; TR.P 2
EVERY RRAND 4 6: TO.CV 1 0

https://www.instagram.com/p/CMYJCpFh9H7/?igshid=1t2n7num06law

4 Likes

A little pattern save/recall haiku for adding to scripts with pattern sequences less than 32 steps.
A trigger to 7 will save step 0-31 of pattern 0 to step 32-63.
A trigger to 8 will replace your current pattern data with whatever was in save bank.
This can be done while the pattern is playing at any time without interrupting anything.

Good for making a sequence, letting it devolve into randomness and then returning to the original sequence. I came up with this for a Q bit bloom style fractalising sequencer I am working on that needed to remember the original sequence while replacing the working pattern with new fractalisations.

``````#7
P.N 0
L 0 31: J P I; P + 31 I J

#8
P.N 0
L 32 63: J P I; P - I 31 J
``````

Its pretty simple.
Its a loop that sets J as the pattern number at the index of the current loop number.
It then adds 31 to the loop number, and sets the pattern number at this new +31 index to J.
Script 8 does the same but in reverse, taking the number from index 32-63, setting J to that, then taking 31 away from the index number, and setting that pattern number to J.
This can be repeated for up to 3 patterns in 1 script e.g:

``````#7
P.N 0
L 0 31: J P I; P + 31 I J
P.N 1
L 0 31: J P I; P + 31 I J
P.N 1
L 0 31: J P I; P + 31 I J
``````

But with 7 and 8, this would be 12 lines not 4, and wouldn’t be a Teletype Haiku.

9 Likes