> teletype : code exchange



Yes, I think this should work - so posting it on the 1.3 thread would be a good way to collect everything.


I suspect this is caused by the i2c read issues mentioned in the following thread

The fact that Kria continues to work would also suggest the issue is on the TT end.


Yes, this could probably be - it’s a shame that teletype remote is not working reliably.


hit a roadblock with the teletype loop commands that don’t make sense to me. i have a pretty simple command, like this

L 1 4 : TR.PULSE A

my expectation is that upon execution, output A will pulse 4 times (as determined by it’s TR.TIME value), but it only pulses once. is this behavior by design? can anyone think of a simple way to have output A trigger 4 times in a row in a single script execution (multiple lines are fine)?

fwiw, i expected the loop command to be syntactically similar to python code like this

for x in range(3)


Yes, that’s expected behaviour. Loop counts a variable I and executes a command several times on an instant with the changed I as an parameter. TR.PULSE I would trigger four outputs simultaniously.


so loops are only useful when you use the I variable?

The ‘we do this all the time’ section here http://monome.org/docs/modular/teletype/studies-7/ suggests that the pulse should be executed 4 times.


Yes, I would say so. And they loop, in this case four times, instantly, without delay between the single loops.

Yes, that’s right - you don’t have to use I. But the four pulses would be executed on the same trigger input not on four serial trigger inputs.

It’s like having four lines of TR.PULSE A in one script. You won’t hear four pulses then.


TIME controls the length of the pulse, not a delay between pulses.

I think you might want to use the M script?

Teletype Studies 2: Curves and Repetition


not sure the M page would get me any closer to a solution, i want to get 4 sequential trigger pulses from one trigger input.

if i’m understanding correctly now, the loop command executes the command specified within it N times at once instead of N times sequentially?

once again using python as a comparison, if i have a function that takes 2 seconds to complete and i execute it in a for loop, the function is not executed 4 times at the same moment, it is executed sequentially.


You could use a stack or a pattern to get four pulses evenly spaced apart from a trigger input.

Loops execute as fast as possible. They are sequential, but happening so fast it’s not going to appear to be sequential in the usage you’re proposing.


regardless of speed of execution, if it was sequentual then the pulses shouldn’t happen all at once, no?

e.g. if my pulse time is 100 and the loop is sequentual, then pulse 1 will occur for 100, pulse 2 for 100, pulse 3 for 100, pulse 4 for 100. the total time of execution would be close to 400.


The start of each pulse is happening sequentially, but no pulse start is waiting for any pulse end.


aha, that is where this is breaking down for me. so the four pulses essentially overlap one another, whereas my expectation was that one would finish then another would begin. thanks!


playing with the stack command, it puts me in a similar situation as the loop. this may be overly difficult without having the ability to write a ‘del’ command into a loop or stack.


You can use the M script to pop items off the stack. So when you want to “schedule” 4 triggers, you push them on the stack then set the metronome period and enable the M script, which will disable itself when the stack is empty.


yeah, that does seem to be one way to do this. thanks!


You can say DEL 250 : S.POP I think. Haven’t tried it.

Maybe L 1 4 : DEL MUL 250 I : S.POP would do it. I don’t know, I’m pretty new to teletype.


Much to learn about timing in this thread:


Can’t nest PREs, I think.

Which means that your solution is easier, as you can’t even put things on the stack in a loop.

4 lines for 4 triggers, I’m afraid.

Once I get my hands on mine I’m going to have a look at the codebase to see what can be done to allow teletype to be a little more flexible and terse. Maybe a loop + del macro?


yeah I was thinking that being able to call the del command inside a loop might be a simple resolution to this.