Ok, just checked the manual. I see the QT op in the alphabetical index. But now I’m wondering, what is the JI op for? The description is rather vague.

Actually, it appears to be Study 4. But there is something about the examples I don’t get:

CV 1 QT PARAM N 1
CV 1 QT PARAM N 2
CV 1 QT PARAM DIV N 1 2
CV 1 QT PARAM V 1

So N is the semitone value (constant). QT takes 2 parameters. And DIV takes two parameters. But DIV seems to have 3 parameters here? And so does QT in the rest of the examples? What I would give for a pair of parenthesis…

CV 1 QT PARAM DIV N 1 2

N is an unary operator so DIV N 1 2 actually has two parameters.

With a different notation it would be

CV(1,QT(PARAM(DIV(N(1),2))

Which is actually harder to parse for an human :slight_smile:

The thing that makes it confusing is:

A 1
N 1

The first one is an assignment, the second one is not…

Yeah, you kinda have to know the operators.
There are not too many and it doesn’t really take long to get used to them though.

I think that’s a needed compromise to be able to write readable code in very few characters (I code in C++ every day and it’s definitely a different mental space for me).

N is a lookup table (think midi note number).

The thing is CV takes the value the DAC needs (if I’m not mistaken, at last some value that doesn’t really makes sense to humans). So N 12 is converting the note number 12 to the integer value representing C an octave up, since euro is 1V/octave, this is 1 volt. Another build in lookup table is V (volts), so V 1 is also 1 volt, and would give you the same value as N 12.

I think most if not all of this will land on its feet once you spend some time with your yet to arrive teletype.

I wonder if you can think of alternative solution for getting this in one line:

IF && > D 2 < D 6 : J 1
ELSE: J 0

Essentially I’m trying to change a flag when a variable is within a specific range but I only found solutions that require two of our precious six lines :slight_smile:

You could use:

J * > D 2 < D 6

Since the operators produce 0 for true and 1 for false :slight_smile:

5 Likes

Alternatively J ? && > D 2 < D 6 1 0 because ternary operator == fun

4 Likes

Thank you both for your excellent suggestions, I already learned something new!

1 Like

I’d go with @Starthief, but the shortest I can think of is

J ! / - D 4 2
1 Like

Minimized to the maximum :sweat_smile:

Didn’t I see somewhere that you can double-up commands on a line with a semicolon? Or was that just on someone’s wish list?

Unfortunately the semicolon can’t be used to combine the IF and ELSE operator on one line - it comes in very handy at other times though :wink:

Good to know. What about a loop that contains an if? I came up with this approximation for a script I’m working on:

L 0 11:IF MAX 0 SUB P ADD I A:D SUB P ADD O A

It loops from 0-11 until a value drops to 0 or below which could occur at any point in the loop (that’s the idea, anyway, may need some tweaking before it’s ready for prime time). It’ll keep looping until it gets to 11 but it’ll stop doing the part after the IF: at some point during…

Is this kind of thing valid? I think I can probably simplify it but I’m wondering about the basic concept of using an IF within an L loop (no ELSE)

That’s not possible unfortunately. The “things that end with :” (like IF, DEL and L) are called PREs and you can only have one PRE per line…

Edit a few shorteners (I think your line is too long):
Use + instead of ADD
Use - instead of SUB
Use a value directly to check for non-zero instead of MAX 0

The ternary operator ? is great for this, or have your loop call a separate script with your conditional in it.

1 Like

I can probably convert this to a while instead of a loop/if, and good to know about the operators-- I hadn’t spotted that you don’t have to use ADD in the manual-- and your earlier examples suggested to me that symbols might work as well, so I was just about to ask about that…

1 Like

In fact, so far I’ve been unable to find anywhere that the symbols over keywords are fully documented-- I’m wondering, is there a symbol for “MOD”? The pipe perhaps? The equal sign for EQ? Are >= <= != also supported?

Searching the threads for documentation has a couple of issues-- one is that there’s a lot of old information here as well as current, which one would expect. Plus, there’s also a lot of “boy, I wish it had this feature” stuff here as well, which out of context could lead one to believe there are features present that aren’t actually there.

It took me a while to find out some critical information-- not the least of which is the 6 line limit, and I’m still not sure how many characters per line is supported, 32? And are spaces significant? I gather they are, but I’m not sure. The fact that the Pattern buffer data is saved as part of the Scene (or at least I gather it is), that the Tracker can be used to edit the pattern buffer to manually enter specific data so that you don’t have to write a script to “populate” it on every start up, etc. What additional non-input triggered scripts there are, such as the one attached to the Metronome and the Init script (which I gather have their own scripts beyond the 1-8 triggered ones? Not sure about that, either).

One feature I’d really like to see is an alternative way to address the Pattern data. 4x64 orientation makes some assumptions as to how you may want to use them, which if what you need is a different structure, you have to “un-map” your desired structure and re-map it into 4x64 (in my case, I was looking for 12x12 and I have another application where I need something like 10x18. I’ve figured out what I think is sufficient re-map logic, like the example below (where X and Y are presumed to be initially set to the coordinates in an array treated as if it were 12x12:

A + X * 12 Y;X MOD A 64;Y / A 64

It’s exactly 32 characters, which I’m hoping will fit into a line (and also where my question about MOD possibly being a symbol and spaces being significant). First, A is set to the 12x12 Y coordinate, multiplied by 12 and added to X. This should linearize the desired data dimensions into 0-N. Then X is set to A modulo 64, and Y to A divided by 64 in order to produce the 4x64 necessary to address the structure of the actual pattern buffer. And that’s all presuming it’s origin-0 which I gather, it’s not. So I actually need to add 1 in a couple of places I’m thinking.

This re-mapping by itself eats up an entire line of code. On the other hand, if the pattern buffer was a single linear array 0-255, the mapping code needed would be a third of what it needs to be now:

A + X * 12 Y

which could probably be packed in with other lines using the semicolon, and might not even need to be carried in a variable.

If anyone can think of any improvements to my re-mapping approach for the current 4x64 architecture here, I’d appreciate the input…

I don’t have any inputs on re-mapping the patterns, but a few answers:

If by MOD you mean modulo, there’s %

It seems you might want to take a look at this:
https://monome.org/docs/teletype/manual/#alphabetical-list-of-ops-and-mods

And in particular this:
https://monome.org/docs/teletype/manual/#maths

3 Likes