> teletype : code exchange



Let’s use this page to post, discuss, exchange, and share everything related to teletype code.

_specific scripts you found particularly useful;
_questions about certain commands that need elaboration;
_functionality ideas that need scripting solutions;

What do you say?

mod edit august 2017: the TT script repository is on github; ask for write access in this thread.

Teletype Tutorials (upcoming)
Teletype Scenes
Teletype - opinions
Teletype Tutorials (upcoming)
Expert Sleepers ES-8 + MAX
Telex: Teletype expanders
> teletype: grid code exchange
Teletype max script length
CV recorder in Max
Teletype love

sorry i don’t have shit to contribute but props to all having built this and those using! exciting times we are in. can’t wait to learn more about this module!!!


OK, so I am trying to think of the best way to capture/document the scene with all the code.
Just typing it in the post certainly makes sense, but I was also considering something a little closer to the teletype sensibility.

So, this is the Reich scene (“Piano Phase” and “Clapping Music” simultaneously https://youtu.be/SixhcwS-IJg):

The main reason I was considering going this route is that if someone liked a complete scene, it would be easy to save a single image (or PDF file) on their laptop or tablet, or print it out for future reference.
Is that approach worth further work?


it would be super cool to be able to somehow cut and paste between devices like this>text>copy into another teletype module. probably impossible but i cannot remember, so many, all the times recently that technology hasn’t supported simple cut/paste ideas i have had between devices/contexts/work/play etc etc.


Copy and paste would be cool, but when learning code I find that typing it out really helps to understand it. I often skim a piece of example code, trying to understand the thought process and flow. Then I try to recreate taking my understanding of what was written, and trying to recreate the process. If I get stumped on syntax, I see how far I can get without referring back to the code.
Once I get it working, I go back and start exploring.mapping out my own tangents and trying to follow those trajectories. Often they fail, but sometimes you find magic in meandering.

Teletype Challenge : Bartok Palindrome

I agree %100 that having to type the code is the best way to learn. Even if it means just re-typing something from an example. With Teletype code re-typing is super easy, since the lines are so short and each script is no more than 6 lines!

So, does anyone have any tidbits to share?
Something that you coded in Teletype that was especially satisfying?


Great thread, but i am still waiting for my teletype !


I like the idea of posting code directly, prefaced with four spaces, like this:


although that doesn’t really address the posting of a full scene.

I agree that typing code in is useful, also fun. It also matches the memorylessness of modular generally.

Here’s a question: if two scripts each set P.N to different values and call P.NEXT, what happens if the scripts are triggered at the same time? Does P.NEXT reliably increment and read the right P? (I see that the Reich scene @laborcamp posted does this, or might do this.)


Good question about declaring two different patterns and possible confusion.
I have not noticed any problems with this. I think if you call P.N right before the P.NEXT in the same script, it should not get confused with other patterns called in different scripts. I would be curious to hear from @tehn about the order in which commands/scripts are executed. But if the scripts are executed “as a whole” then there should not be issues…


I think the reality is that nothing truly happens ‘at the same time’ in the processor. Everything is processed sequentially (though there could be some strange race conditions). A whole script will be performed before another script is run, so if this happens inside a single script then it should be quite reliable.

If you’re triggering multiple scripts, it will likely depend on the source that is sending the triggers.

Meadowphysics for example will reliably trigger the lower number outs before the higher ones. Thus two simultaneous triggers from MP outs 1 & 2, will trigger the script connected to 1, then the script connected to 2. This isn’t so much a designed behaviour, but that is what I’ve observed through practice.

Simultaneous Teletype triggers?

Makes perfect sense.


i might’ve asked this before but can’t remember - what if there are delays in a script? would it delay everything else until all of the delayed commands have been executed?

say you have this:

CV 1 V 1
DEL 1000 CV 1 V 2

CV 1 V 3

say 2 gets triggered almost right after 1, would CV 1 change to 1, 3, and (after delay) 2, or 1, 2 (after delay) and 3?


This is my second take on the Steve Reich “Clapping Music” rendition as a scene in Teletype.
I thought that I could post it as a form of “tutorial” explaining each component of the scene, which consists of only 3 scripts, and one pattern.

Connect external clock to INPUT 1 (which will execute script 1 on each trigger)
Connect trigger OUTPUT A to INPUT 2 (which will execute script 2 on each trigger)
Connect trigger OUTPUT B to a VCA or your percussive sound generator
Connect trigger OUTPUT C to a VCA or your percussive sound generator

I set up the pattern as 24 steps, which is an equivalent of two identical bars from the “Clapping Music” (see here: http://www.music.mcgill.ca/~gary/306/week10/clapping.pdf ) You will see that steps 0-11 are the same as steps 12-23. I set this up this way so that I can use the same pattern for the two sequences that constitute the composition. (Short explanation of the structure of the piece is that one sequence repeats the same bar consistently, while the other shifts forward by one step until it reaches the full cycle of 12 shifts and begins to play the same sequence as sequence 1, and the cycle begins again. Here is a visual representation of the two cycling patterns as two rotating discs: https://upload.wikimedia.org/wikipedia/commons/0/07/Steve_Reich_-_Clapping_Music_visualization_disks.png )

This is the “Initializing” script that is automatically executed when the scene is loaded. essentially set up as a “starting point” or a kind of reset for the piece. This can be manually executed by pressing the “widows” + I on the keyboard at any time to restart the piece.

P.N 0 — tells the teletype to work with Pattern 0 (first column on the left in TRACKER mode)
P.L 24 — sets the length of the sequence at 24 steps
Y -1 — sets variable Y to -1 (so that when the script 1 is executed for the first time it will set it to 0, and read the first step of the sequence
Z 0 — sets variable Z to 0

Most of what happens in this script is two counters (Y and Z) that are advancing the steps in the two sequences.

Y ADD Y 1 — using the ADD arithmetic operator it simply adds 1 to whatever the current Y count is, each time this script is executed, which is every time it receives the external clock trigger on INPUT 1.
IF EQ Y 12 : Z ADD Z 1 — an IF modifier checks whether the Y count had reached number 12, and IF it did, it advances the count of variable Z by adding 1 to it’s current count. So, each time a complete sequence of 12 steps is counted on Y, it advances Z by 1.
IF EQ Y 12 : Y 0 — and, when the count of Y reaches 12, it also resets Y back to 0.
IF EQ Z 12 : Z 0 — and the same for variable Z: if it reaches 12, it is reset back to 0.
TR.PULSE 1 — sends a pulse out of trigger OUTPUT 1 which is connected (self-patched) to INPUT 2 on teletype. (This is basically my way of extending this script beyond the 6 lines limit. The content of SCRPT 2 could have easily been sitting in SCRIPT 1.)
T PN 0 Y — sets up variable T which is set to either a 1 or a 0. Using the PN command, it looks at pattern 0, and checks the index position Y (which is a continuous count from 0 to 11).

X P ADD Y Z — sets up variable X sets the index position for this pattern to be a result of addition of variable Y and Z. (So that when variable T begins the second repeat of the 12 step bar at position 1, then variable X begins at position 2 - one step ahead, and on next rotation, two steps ahead etc.)
IF EQ X 1 : TR.PULSE 3 — check current step position in the pattern at index equal to variable X, and see if it is a 1 or a 0. IF it is 1 then send trigger out of OUTPUT C.
IF EQ T 1 : TR.PULSE 2 — check current step position in the pattern at index equal to variable T, and see if it is a 1 or a 0. IF it is 1 then send trigger out of OUTPUT B.

Hopefully this will be helpful to someone here.
If you have any questions, please don’t hesitate to ask.

Also, if you see different ways of approaching these tasks, maybe “cleaner” way of scripting, do share, I would love to learn further. There are always different ways of going about making things happen :wink:



Awesome ! Thank you so much. Commented lines of code is perfect to learn.


CV 1 would go to 1V, then 3V. then 1000ms later 2.

a DEL command puts the line into a queue immediately and then continues on. it does not hold up the processor/etc.


Very nice initiative, could also be cool to see short utility scripts with description and commentary on each lines ( see laborcamp post above )


thanks tehn, i was hoping this was the case. should make for more interesting cross script pollination…


I was wondering if anyone got any idea how i could combine DEL and PROB functions ( i tried combining PRE functions but it doesn’t seen to be possible ). Let’s say i would like to set a Probability of Delaying a trigger ( and, bonus, also add the probability of playing this trigger … ). Any thoughts ???


Not a perfect solution, but use the DEL to TR.PULSE and patch this into another input on TT where you plać the PROB command.
In other words chain two scripts, and self-patch TT.


Yep, thit is my actual solution, i just wonder if such thing is manageable in one only script.