Help with sh-101-like sequencer with Teletype

i’d be happy to have some help with this (and i’m sure this would be useful to some people).
So i am working on a way to input notes to a sequence with a cv keyboard (microbrute, actually).
You hit a note, it’s added to the end of the sequence.
Here is were i am at, feel free to comment or help. The thing i am stuck at at the moment : i’d like that if the seq value is 0, the last value is held and no trigger out of tr A.

I :
A 16383
B 1000

// i need this to avoid long lines

1 : // write pattern
X SUB O 1
DEL 10 : P.L ADD X 1 // i don’t know why it doesn’t work when using O !
DEL 80 : Y SCALE O A O B IN
DEL 85 : CV 1 VV Y
DEL 100 : P X Y

2 : // read pattern
CV 1 VV .P.NEXT
TR.TIME 1 2
TR.PULSE 1 // used to trigger an envelope.

3 : // erase routine
L 0 64 : P I 0
P.I 0
O 0
X -1
P.L 0

Thanks !

1 Like

Or, as an educational exercise, does anyone want to give it a try ?

  • cv keyboard input : any pressed key adds the note to the end of the pattern
  • one script to erase the pattern
  • one script to add a rest to the pattern
  • two outputs : cv / trig
1 Like

here’s going blind:

1 (cv keyboard trig input)
DEL 100 : P X PARAM
X ADD X 1
P.L X

2 (erase)
L 0 63 : P I 0
X 0
P.L X
P.I 0

3 (rest)
P X 0
X ADD X 1
P.L X

4 (play step)
CV A P P.I
P.NEXT
TR.PULSE 1

2 Likes

Wow ! thanks so much. I’ll try this. I assume you meant IN instead of PARAM ?

oh yeah right! correct.

Very instructive, thanks much! But I don’t understand why the PRE
“DEL 100 :”
is needed in script 1. Please, can you help me understand?

On a related note: Does the PRE “DEL” just delay the line it is written in (which would mean that subsequent lines will get processed while the delay line is waiting in delay “limbo” to be executed), or will all subsequent lines only be executed after the delayed line has been executed? (I understand that this question must be boring for anyone having a TT, but as I don’t have mine yet, I can’t try it out.) Thanks!

just the single line is delayed. the delay is to ensure the CV is read from the keyboard, which will typically have a lag.

1 Like

Ah, I see, thanks!

On further trying to understand the script, script 3 (rest) writes 0 into the playhead’s position, but the play script 4 seems not to use this rest information. Would this fulfill the OP’s requirement:

4 (play step)
IF P P.I : CV A P P.I // only send new CV if new CV is ≠ 0, as CV = 0 is a rest
IF P P.I : TR.PULSE 1 // no trigger if new CV is a rest
P.NEXT

Would this work?

If it does, please allow one more question: is there any way to “group” several commands behind one “IF :” prefix, or do I have to use a new line with new IF for each new command (as in my proposal)?

I’ve tried :
IF EZ P.HERE : CV 1 VV P.PREV
ELSE : TR.PULSE 1

but in my context it would just stuck everything if 0.

Here’s my guess as to why your proposal doesn’t work.

Let’s assume your pattern has 3 positions with the values 12, 0, 5, and that the playhead is at position 1 (which has value 0).

Now we trigger your script
IF EZ P.HERE : CV 1 VV P.PREV
ELSE : TR.PULSE 1

The value at P.HERE is 0, which is equal zero, so the IF command gets executed, which means that P.PREV decrements the index to 0 and then reads the value 12 at the new position. If you now advance the index to get to the next step (with e.g. P.NEXT, which is not shown in your script snippet, but I assume you do it somewhere), the index is moved to 1 again, which of course still has the value 0.

This means you are trapped in a loop, as you can’t advance past the first index that has the value 0: you can’t move to the next step, as reading the value of the previous index sets you back one step, so moving one step forward will make you read the value 0 again (and so on and so forth).

As far as I understand it, there is no need to recall the previous CV value, as it is held anyway until it is changed.