Teletype haiku

the one line implementation is functionally equivalent to the one on insta actually!

the idea is to use the knob to control probability of which output is chosen. if we just wanted both to have probability of 50% we could just use > RND 100 50. this assumes that random values within the chosen range are evenly spread over time. so then half of the time it’ll be a random number under 50, and half of the time over 50. now if we replace 50 with the knob value scaled to 0…100 we can control this with a knob. so if the knob scaled value is 20 then over time we should get 20% of values under that, and 80% of values will be over that. this was my thinking for the initial script.

but then i realized i don’t even need to scale if i just use the full knob range (which is 0…V 10 - and yeah V 10 is a handy shorcut for 16384!) and use the same range for RND.

1 Like

using knob to rotate the sequence reminds me of delptronics trigger man… this is trickier than it seems - i think it might be doable though, i’ll try it when i get a chance. btw you can gain 2 lines by combining the 3 lines in the init script into one: PN.START 3 0; PN.END 3 7; PN.L 3 8. another optimization - since you only use one pattern bank you can replace PN ops with P - this saves 3 characters per op!


some other potentially useful optimizations:

RRAND 0 x -> RAND x
WRAP 0 x y -> % x z where z is y+1
SCL V 0 V 10 0 16 PRM -> RSH PRM 10 (this will require calibration to have full 0…16 range, otherwise you’ll likely get 0…15)

5 Likes

Do you think a Circular Bit Shift OP would be useful regarding param knob pattern rotation?

Also, thanks for the >> PRM 10 tip. I never thought of that!

yeah, if you store gate sequences as individual bits a circular bitshift would certainly be useful! maybe we should add ops for that.

using the param knob for pattern rotation is tricky because you have to store the previous value in a variable, then compare it to the current value and it’s the delta that tells you whether you need to rotate. but i think maybe there are some easier ways to achieve this…

1 Like

amazing thread! i’m gonna play a few of these and hopefully come up with one of my own.

Nice, I can’t believe I didn’t think of that. To me A % + 1 A 8 reads better anyway if I’m thinking in terms of an 8-step repeating pattern.

Which reminds me of other ops I could suggest. I like the first two more in terms of programming elegance but the last two save more characters in a script :slight_smile:

++ x
// equivalent to + x 1

-- x
// equivalent to - x 1

INC x y
// equivalent to % + x 1 y

DEC x y
// equivalent to WRAP - x 1 0 + y 1

And on a different note

BIT x y z
// sets bit y in value x to (0 if Z==0, 1 otherwise)

This is why I was messing with XOR and LSH in my example; I wanted something more like B BIT B A TR A

5 Likes

ok yup this need to happen.

Very nice!

Stupid question: what are the ? for? Tried to find it in the manual, but I think I’m missing out somehow.

? is the “ternary if”: ? X A B will return the value of A if X is true and B otherwise. Unlike the IF PRE, you can’t use it to control the flow of the program with, say, BREAK.

5 Likes

@alanza pretty much covered it.

In this case I think i’m abusing it slightly.

The TR.P will get the trigger out number if its corresponding bit is 1 but will get 0 if its bit is off. (0001 will get you TR.P + 0 1) Since there’s no TR.P 0 it will not send out anything during this condition.

2 Likes

I’ve been wanting to check out some of the bitwise and logical ops that I’ve never used before, and some of the creations here like @adrianf’s and @Starthief’s inspired me to do so. I also wanted to create something more reusable than my first one.

Here’s what came out - a rhythm measure generator. Kick and snare is Peaks, and the cymbal is Rings. Pretty much endless combinations especially if you switch out the logical op like I was doing in the video.

This is the version in the video, which uses TXi.

#M
X TI.PRM 1; Y TI.PRM 2
T + T 1; Z % T 16
IF NZ BGET X Z: TR.P 1
IF NZ BGET Y Z: TR.P 2
A ! ^ BGET X Z BGET Y Z
IF NZ A: TR.P 3

If you don’t have a TXi, you can use this version with the PARAM knob, and then also connect a 10V offset (such as Maths CH 3) to the input jack, and use it as the second knob.

#M
X PRM; Y IN
T + T 1; Z % T 16
IF NZ BGET X Z: TR.P 1
IF NZ BGET Y Z: TR.P 2
A ! & BGET X Z BGET Y Z
IF NZ A: TR.P 3
8 Likes

Strumming Rings with the beta op DEL.R.

#I
G.BTX 0 0 0 1 1 1 3 1 8 1
O.INC 2

Define grid buttons and set the var O to increment by 2s. Each button press calls script 1.

#1
O G.BTNI; G.BTN.SW GBTN I
DEL.R 4 66: CV 1 N P O

Sets O to the button pressed which gets used as the starting note of the pattern. Switches all the buttons off except the pressed. Creates a loop of 4 notes, 66ms apart, incrementing up the pattern by 2s to strum some kind of chord.

A 4; P.PUSH A; P.PUSH + A 2
P.PUSH + A 3; P.PUSH + A 7
P.PUSH + A 8
L 0 4: P.PUSH + P I 12
L 0 4: P.PUSH + P I 24

A little over the 6 line limit with the pattern definition. This creates an E Hirajoshi scale pattern to loop through.

12 Likes

turing machine style shift register:

#1
A ? < RND V 9 PRM & T 1 TOSS
T + * 128 A >> T 1
L 1 3: TR.P ? BGET T I I 0
TR.P 4; CV 1 N / T 6
L 0 7: Z + 4 * 9 BGET T I; $ 2

#2
G.REC * I 2 3 2 2 Z Z

circulates 8 bits. param knob controls chance - all the way CW it will just recirculate what’s in there, turning it will introduce random bits. send clock to input 1. trigger outputs 1-3 will output the corresponding bits, trigger output 4 is clock out. cv 1 sends CV which is proportional to the binary number. make sure to turn on the grid visualizer for this one!

and if you add this:

#3
T ^ T << G.BTNV G.BTNI
L 0 7: Z + 4 * 9 BGET T I; $ 2

#I
G.BTX 0 0 3 2 2 0 0 3 8 1

you can control bits from grid!

14 Likes

Seeded Rhythms
Here’s a 4 part rhythm generator with fills, in 6 lines with no Patterns. Using my favourite Op of all time: SEED. (Requires the SEED beta from @alphacactus ).

#M
L 1 4: $1
EVERY 8: SEED PRM
EVERY 16: SEED + PRM % O 16

#1
PROB RND 75: TR.P I
CV I N RND 36; M RRAND 80 100
CV.SLEW I RRAND -100 / M RND I

In the example, I am sending the TR outs to Gate inputs on ER-301. Each ER-301 channel has a Variable Speed Player. Teletype CV outs go to the respective V/Oct controls.

CV 1 is most likely to have Slew applied, CV 4 is least likely to be slewed.

I am using a Yamaha TX81Z sample set.
Track 1 is Ride (with a little Quadraverb)
Track 2 is Hat
Track 3 is Snare
Track 4 is Kick

4 Likes

Unless I’m messing up something about probability (and the probability of that is pretty high), PROB RND 75 seems like it would be equivalent to PROB 38…?

1 Like

I suspect you’re right. At least, if you flip weighted coins with weights randomly chosen and uniformly distributed between 0% and 75% likelihood of coming up heads, the mean weight will come to 37.5, so we might say each coin has roughly a 38% chance of coming up heads.

damn!! this sounds so good. i wonder how this could be adapted for the gridless…

you can use any grid scenes without a grid by using the grid visualizer. how usable it’ll be depends on the scene, but for something simple like buttons it’s as easy as starting the grid visualizer in full mode (press alt-G in live screen twice), then using arrows to select a button and using space to press it.

2 Likes

20 characters of :open_mouth:

1 Like

You could also run a trig to input 1 to start the strum and set the pattern start number with the Param knob to add some playability (initialized to PARAM.SCALE 0 8) and changing the first line to from O G.BTNI to O PRM.

Or for something more generative set it to O RND 8 to randomly pick the note.

1 Like