Yes, LAST is what you want here. If you put X BPM LAST SCRIPT in, say, script 1, then put a trigger into the 1 input in teletype, X will end up with the BPM of the input pulses.

You can find the amount of time since any trigger is fired with LAST, but the trick is to put the call to LAST in the script that is being run from the trigger input. That way the time is measured between each pulse of the trigger.

The SCRIPT bit there is just a special op that returns the current script number.

Not sure how you’d do it from a TXi trigger, since you need the script to run immediately it gets a trigger…

3 Likes

Incidentally, I wonder if there’s a problem with the documentation for LAST? In the docs it says:

Gets the number of milliseconds since the current script was run. From the live mode, shows time elapsed since last run of I script.

But that doesn’t seem quite right - it gives the number of milliseconds since the script with the number of the argument given was run. It would be better if it said:

Gets the number of milliseconds since the script numbered x was run. You can use SCRIPT as the argument if you want to check time since the current script was last run.

Or something like that… I’ve suggested an edit on github.

2 Likes

My teletype is showing a bright vertical line on the display, does anyone know what this means? I just put it in a new case a 4ms pod48x just tried it in the old case and the line is still there.

The module has travelled? Been shaken? Bumped?

I just transferred it from one case to another, was pretty careful with it. I got it second hand though maybe it already had been jolted. Any clues on how to repair it?

I had one in my hands a year ago and it showed approx. the same issue. I used a long flat screwdriver and pushed the upper side where the pins are soldered to the pcb. Gently and with a lot of TLC. After that all was OK.

1 Like

My Teletype 3.1.0 386683A doesn’t hang on long lines because it won’t let me edit long lines! For example if I create this long line in a text editor and upload it to the Teletype it works perfectly:

TR.TIME 1 - K 20; CV 1 J; TR.P 1

But if I try to edit on the Teletype to this shorter line I can’t;

TR.TIME 1 - K T; CV 1 J; TR.P 1

The first line is exactly 32 characters long and displays correctly in the script section (33 characters also display correctly), but when editing the last character is off the right edge of the screen (two characters when line is maxed out at 33 displayed characters). The last few characters not being displayed are not a problem for me. What is a problem is when you try to edit the lines, pressing delete or backspace cause the last character to be repeated. Clearing the line with Alt-x or Shift-backspace get around the problem with the last character repeating.
When adding a line back in the max that can be typed is 30 (this includes any bogus characters added via backspace or delete).

2 Likes

I’ve got some basic ops questions; I’ve been reading through some scripts and I see a few scenes occasionally referencing P on its own.

Here is an example line:

K P % T 12

Or, another example:

A ? P Y 1 0

I’m going to ask the writer what the P is there, but I wanted to ask the community to, so it is maybe a little easier to find.

Using P with one numerical argument gets the value of the current working pattern at the index specified by the argument. Two numerical arguments allow the value at that index in the current working pattern to be set.

The current working pattern can be changed by P.N

Hope this helps! Mainly P is used to avoid too many characters on a line, but is also useful if you want to move around the patterns programmatically.

1 Like

So to deconstruct the second example:

set A to 1 if the value in the current pattern at index Y is true (not zero), otherwise set A to 0

I’m puzzled by the first example. I don’t recognise a single “K” operator.

K is one of the new local variables, J, K, that can have a different value in each script.

2 Likes

This absolutely helps out. Thanks for this! Totally makes these lines make sense. Really exciting to deconstruct these scripts. Seems like an exciting sequencer that I am just scratching the surface of.

And to continue wit decoding, basically the first argument would be

Set K to the pattern index value that is the mod, or remainder of T divided by 12

I also want to clarify, I am using @a773’s fantastic github as a tool to see a combination of both code and audio/video of the code in action.

1 Like

First we have to make sure we know RPN! So working our way from right to left: “% T 12” is “T modulo 12”. In my world I always use T as time-keeper, incremented on each metro tick, so on first tick it’s 0, next 1, next 2 etc until teletype overflows. So in my world this would translate into something that repeats every 12 steps, like 12 16th notes in a bar, and the result is the position in the bar from 0-11.
P is lookup in current pattern, so we’re getting values out of the pattern from location 0 on first step, location 1 on second step etc, wrapping around so on 13th step we’re getting from location 0 again.
The retrieved value is finally stored in the local variable K. So after this line K holds the value retrieved from current pattern on the location corresponding with where we are in the bar.

First we have to know that ? is the ternary operator, so “? a b c” is “if a then b otherwise c”. In this line a is “P Y”, b=1 and c=0. “P Y” is (again) pattern lookup, returning the value stored in current patten on location Y. In my world (since you might have gotten this from me) is always current location in the bar (since I use it so much, I don’t want to waste space on calculating it all over the place, so I calculates it once after T is updated), in standard 4/4 time I’d have “Y % T 16” somewhere. In any case the “? P Y 1 0” returns 1 if location Y in current pattern is non-zero, and zero if otherwise. This value is then stored in the global variable A.

Hope that helps…

5 Likes

Teletype uses Polish Notation, not Reverse Polish. Reverse Polish would be like
2 3 +
not
+ 2 3

/me removes pedant hat

5 Likes

Of course, you’re right!

Always wondered if Teletype can be used by someone who not dives into the coding/keyboard input parts of. Like can there be apps loaded to it that resemble sth like Ansible earthsea tobe used with a grid?

I dont think so, but figuered i ask anyway

1 Like

Yes, you could use Teletype without ever attaching a keyboard. There are some scripts shared on this forum which you could load from a USB drive. I don’t believe this would be a satisfying use of the Teletype so I’d never recommend it unless someone had a very specific application in mind.

Something that resembles poly earthsea? And only one “app” a time or like cycling through a few?
Yes i realize this would be largely underusing the teletype.

You could load any Multipass app on the Teletype, including polyearthsea. That is not a Teletype script but an alternate firmware. You would need a PC to flash the firmware.

If you are loading multiple Teletype scripts then you can cycler through them, yes.

1 Like

There’s also a special mode with the grid attached for changing scenes and variables and so on directly from the grid, so you can actually do quite a lot without swapping the keyboard in if you have the scripts you want loaded in.

EDIT: here’s the relevant docs. https://github.com/scanner-darkly/teletype/wiki/GRID-CONTROL-MODE