Or use semicolon (provided the commands will fit in one line)…

Does that work? I thought the syntax of the language doesn’t allow that. (But I’m not next to my teletype to test it out.)

Yep, it works. You aren’t allowed to use more than one PRE operator per line though.

I’m seeing some strange behavior with O.

It seems like the change to O.INC doesn’t take place until AFTER the next time O is accessed directly. It’s not applied immediately.

If I set O.INC to a new value I would expect that the next time I access O it will change by the O.INC value I set, but instead it changes by the previous O.INC, then applies the new O.INC after the change.

To see what I mean:
INIT
O.MIN 0; O.MAX 5
O.INC 1; O 0

Then access 0 a few times - everything seems fine.

A O
A O
A O
etc.

Weird things happen when you change INC:

A O # A = 0
A O # A = 1
O.INC 2; A O # A = 2
A O # A 4

I was under the impression that statements on a single line will be executed from
right to left but…doesn’t matter if you do it the other way around either:

A O; O.INC 1 # A = 0
A O # A = 1
A O # A = 2
O.INC 2; A O # A = 3
A O # A = 5

Feature or bug? Or perhaps just a misunderstanding of my code?

Semicolon-separated statements are evaluated left-to-right, e.g.

X 0
X + X 1; X * X 2
X   # is 2

You’re correct in your assessment, from the manual:

The O variable is already set to some value at the time you read it, then its next value is calculated after the read. Source code is here.

hi everyone
question:
is there a way to “clock” a variable with ansible/arc/cycles?
example

ansible trig out 1 (arc cycles) -> teletype in or txi -> variable (in bpm)

can i use something like LAST command?

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