> teletype: grid # code exchange



@EqualTemperament suggested using SCENE op as a way to extend scripts - dedicate one scene to setting up your grid controls and then call it from the main scene.


Wow! Why did I never think of this? That will open up lots of possibilities. Thanks!!


This post (Teletype 3.+ feature requests and discussion) gave me a MS EXCEL flashback. Not exactly the same as a norm dist OP with mean and std, but you can calculate it outside and provide it as a discrete lookup table.

edit: One thing I have to fix is not every $1 trig provides a value.

edit 2: need to fix output binning, skews to right.

Edit 3: I think I fixed it. Also using local K to free up global R at the expense of 1 line.

PN 0: LOOKUP DIST (/100)
$ 1: STEP BY 1
$ 2: STEP BY 1000

K RRAND 0 99
W <= J K: J + J P.NEXT
PN.+ 1 P.I 1

L 0 1000: $ 1


5	0	0	0
11	0	0	0
21	0	0	0
26	0	0	0
21	0	0	0
11	0	0	0
5	0	0	0


The code for Grid ops is extremely complicated to me at the moment, dunno if I’ll ever get my head around it.


Is it perhaps that there is so much available? (of course a good thing). When I first came across it I was a bit overwhelmed - and I’m not a coder. So I set myself some simple tasks - like light up each button going right to left and when all buttons are fully lit - clear and start again. Do the same for going up and then down; throw in a little random. Found it useful just to get the feel of it.


this study should be a good start: https://github.com/scanner-darkly/teletype/wiki/STARTING-SIMPLE


I’ve tried this technique with SCENE to extend scripts, but I’m not sure to understand how to implement it, it has to be called manually, is that correct ? If I call a SCENE from another one, it won’t execute the INIT script of this second SCENE ? Is it possible to provide an example of how to use this technique please ?


yeah, it doesn’t execute init when you use SCENE:

but i think there are several ways to work around that (disclaimer: i haven’t tried any of this, just brainstorming). let’s say scene 1 is your main scene and scene 2 is the grid controls setup.

the easiest solution is to manually execute the init script. so in scene 1 init you do whatever you need to setup in your main scene and then the last line does SCENE 2. at this point it loads scene 2, you press F10 (or use grid control to execute init if you have grid already connected), it does what it needs to do and then as the last step executes SCENE 1.

a variation of the above that could make it easier: in scene 2 you create an extra button somewhere that executes the init script, and in the init just before it switches back to scene 1 you hide the button so it’s not in the way. this way you don’t have to switch to grid control mode.

another option: do initialization in metro script in scene 2. so, scene 1 loads, the init script switches to scene 2, at the next metro execution it will create all the grid controls and switch to scene 1. in this case you have to make sure you don’t put SCENE 2 in your scene 1 metro, otherwise it’ll create an endless loop!


Thanks for your reply and this detailed explanation. I will try one of these solutions.


YEAH (+ 16 characters)


Just wondered whether there could be an option on this - either at firmware load or specialised word?


yeah, perhaps a separate op which could be marked as “experimental” similarly to M!. this thread is a better place for discussion: Teletype 3.+ feature requests and discussion do you want to post there?