Teletype - basic scripting question

So I just got hold of a Teletype a few days ago. My experience of coding is limited to dabbling with some variants of BASIC in the early 80s, messing with bad HTML in the 90s and some basic SQL since then – so the whole scripting thing is something of challenge (albeit an enjoyable one).

Now I’ve run into a problem. Let’s say I’ve created a pattern

1 0 0 0
2 0 0 0
3 0 0 0
4 0 0 0

and the script

PN.L 0 3
TR.P 1; CV 1 N PN.NEXT 0

This runs up the pattern and sends TR & CV pairs with note values 1 2 3 4 1 2 3 4 etc. As an exercise, I’m trying to work out how to make it run up then down again - so that it outputs CV values 1 2 3 4 3 2 1 2 3 4 3 2 1 etc.

It’s driving me bonkers. :no_mouth:

I’ve tried loops, a second script containing a PN.PREV, some other stuff, and nothing seems to do the trick. Can someone give me a hint? What’s the best process to use to achieve this?

i might be completely off, but would the most straightforward would be creating a pattern:

1
2
3
4
3
2

and setting pattern length to 6 so that as you NEXT it, it loops back from the last 2 to 1 again as it restarts itself?

(god i wish i had a teletype at work)

That would certainly do the trick, but what I’m wondering, I guess, is if there’s a way of scripting a ping-pong motion for playback of the pattern? Or is the direction of play limited to being either forwards or backwards only?

mmm. understood. i think the ops don’t have that built in yet?

perhaps my suggested column could be called upon as locations for another pattern’s read head? that would “script” the ping pong and could be manipulated with math, as well!

Ha! I saw exactly that issue coming, so I took two weeks off as soon as my TT arrived. :slight_smile:

Do you mean another script’s read head, or am I just confused? :confused:

1 Like

i will marinate on this. the tracker columns are what i was referencing as patterns, which are just lists of numbers that get called, so i think there’s a way to use one list of numbers to dictate how another list of numbers gets read.

exactly why i want a mobile teletype logic checker.

…and I’m home!

sweet, got it working.

column 0 dictates column 1’s playhead position. I forgot you had a TR.P in the original, so that’s not in the video, but it can be fit in!

I put this in the M script for easy triggering:

PN.NEXT 0
X PN.HERE 0
PN.I 1 X
TR.P 1; CV 1 N PN.HERE

fun!

3 Likes

Just tried this and it seems to work well:

PN.L 0 3
IF EZ PN.I 0: X 0
IF EQ PN.I 0 SUB PN.L 0 1: X 1
IF EZ X: CV 1 N PN.NEXT 0
IF EQ X 1: CV 1 N PN.PREV 0
TR.P 1

Essentially, X is being used to determine the direction (0 = forward, 1 = backward), which is toggled when PN.I equals either the first or last position.

Maybe not that elegant, but it does what you’re looking for :slight_smile:

EDIT: fixed to use PN.I rather than PN.HERE for the pattern index

5 Likes

i’ve never really used the EZ and EQ ops. wowowowow!

1 Like

my silly variation with random octave jumps

this thing in action. the octaves are out of tune this way and there is a bit of unwanted slew. non-coding solution: make the notes staccato & constant changes in timbre :wink:

2 Likes

@dan_derks @chrisharrisx @David_Rothbaum - Thanks so much for taking the time to look at this. :slight_smile: I think it’s pretty cool that there are such different ways of approaching a solution. And the EZ and EQ ops definitely look like they’re worth digging in to - handy little things to have around!

3 Likes

Ideally you’d want more patterns operators, like NEXT or PREV.

You could have a PING (not the best name) that would do the ping pong thing automatically, a RAND that would access a random valid element, a BROWN that would randomly choose between NEXT and PREV (with automatic wrapping), etc.

Not having to use 4or 5 lines for something like this enables you to do more things at the same time…

I haven’t looked at the code for this but making new operators like this is probably not too difficult…

2 Likes

If you have any ideas for new operators, feel free to post them in the New Teletype Operators thread!

2 Likes

Completely agree! When I initially started playing with moving through patterns using P.NEXT and P.PREV one of the first things I tried - just to see if it would work - was P.DRUNK.

(Of course, it didn’t work, and so I used a TOSS / IF ELSE to decide on a P.NEXT or P.PREV to do more or less the same thing.)

P.RAND and P.RRAND would have been my next guesses, but looking them up saved me trying them out. :slight_smile:

You could probably add a P.INC / PN.INC OP. (i.e. the amount to increment on next / prev, negative values swap direction).

Biggest issue is that it won’t be saved with USB saving and loading, and it’s won’t be trivial to fix that. Really the next “big thing” that needs sorting in the codebase is the USB loading and saving code, once that’s improved a lot of new features become possible (e.g. more than 4 patterns, more than 8 scripts, etc, etc).