I’ve taken an interest in this wonderfully crafted code and for the whole idea of using binary in TT which I hadn’t yet got around to.
I was trying to work out a table for the decimal of various modes and chords and found this resource that I thought I would share. Its too much detail for me to work through completely now but I can confirm to others that the blue numbers for each scale are the decimal values (at least I have found the ones that I can calculate to confirm).
https://ianring.com/musictheory/scales/

5 Likes

Ooooh! Good find! I’m going to take some time out this weekend from grieving over my country’s election results to share some tables for scales and chord numbers to use with the haiku quantiser.

5 Likes

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 :slight_smile:image

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
5 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.

3 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! :smile:

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 :slight_smile: Hope you all have a restful festive break!

Full version:

Instagram clip:

6 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 :wink:

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
6 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
4 Likes

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

3 Likes

extracting this from another post: sequence sequencer.
sequence scripts instead of notes!

#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!

6 Likes