> teletype: grid # code exchange

teletype

#225

Ahhhh!!!

It’s alive! It’s alive!

How foolish I was. Many many thanks. (bottom 3 are still blinking like in the video though, but i don’ think there is any effect on usage)


#226

I’ve been thinking about scripting a version of John Conway’s Game of Life, after seeing @mloggers recent Instagram post where he uses an implementation on Norns to great, melodic effect.

As I am a few hours away from being able to sit at the TT, I thought it might be productive to post here and see if anyone can suggest an approach.

My first thought was to store the current and next state of the Grid’s 128 cells in the 4 available patterns (using 2 patterns per state), but the BIT op would be more efficient. (eg 8 cells could be stored in one pattern entry in binary and read off using BIT?)

Then I wondered if it was possible to use Pages (Groups?) and check the state of a cell in a group other than the active group - to avoid having to store the cell states anywhere else. I’m not very familiar with Pages.

Obviously a dedicated Op would be the fastest, least script-heavy solution - and maybe the TT devs have thoughts on this.

It would probably be more useful if the ruleset could be set as part of the Op. Or is this too niche? I think @mlogger has shown that it could be put to very musical use!

Edit: Just to add that, Game of Life Cellular Automata can’t be achieved with CHAOS.ALG 3.


#227

yeah, i was thinking that the easiest approach would be to use grid buttons to represent cells. and since there are 256 buttons in total this gives us 2 pages (on grid 128), one for current and one for next generation.

so it would be something like this: define 2 pages of 128 buttons each. on each step calculate the next state and then switch pages. i think this should be totally doable, i might take a dig at it.

but yeah a dedicated op makes sense, and my plan was to allow specifying different rules - there is a lot of fun to be had experimenting with rules, especially if you put them under CV control or change them some other way. here is an example of it from the implementation i did for nw2s::b module:


#228

Heres the official video for Zellen - there are quite a few play options (up/down,random,drunken walk, manual, semi manual, automatic play) and different modes, like born, reborn and ghost features, in the parameters menu. It’s very melodic because there big selection of quantized scales


#229

Ah yes I forget there are actually 256 buttons.

The only thing I’m not sure about is handling the corners and edges (I’m presuming we want the filed to wrap). There will need to be a different set of conditionals for each page won’t there? As button 0 (top left) and button 128 (“top left” of 2nd page) are actually not in the same location. Or am I over-thinking it?

It looks like Zellen doesn’t wrap. Thinking about it, it might make more sense given there are only 8 cells vertically.


#230

cool, will check it out! i wouldn’t want to copy it (at least not without asking a permission first), and i think it’s good to have many different versions. and, of course, with both teletype and norns it’s super easy to try variations and different ideas.

i was able to implement game of life scene using 3 scripts / 15 lines. here is a quick demo:

here i’m simply mapping the number of live cells to various parameters, including pitch which uses a scale with 8 notes. i’ll think of some more interesting ways to interpret it musically. will post it soon, want to add a couple of things first.

@rikrak i’m using wrapping here which i think makes it more interesting but it’s easy to make it not wrap too.


#231

This is so great! I’m really glad you’ve been able to do it with wrapping and look forward to seeing the scripts. Sounds like there is plenty of room left in the Scene to experiment with ways of interpreting the state.


#232

Amazing, seriously shocked how quickly you got a working script going. Thankyou!


#233

here is the scene: game_of_life.txt (1.8 KB)

inputs:

  • trigger input 1: clock
  • trigger input 2: clear all
  • trigger input 3: create a random state

by default it’s clocked from metro script (the rate is controlled by the parameter knob). if you want to just use external clock make sure to disable metro with M.ACT 0. remember - you can also manually trigger all of the above from grid control.

outputs:

  • trigger output 1: clock
  • trigger output 4: trigger when there are no live cells
  • CV output 1: note
  • CV output 2: left side voltage
  • CV output 3: right side voltage

note is determined by the total number of live cells plus variable O (this way if it’s in a static / looped state it will still advance through the sequence). the notes are specified in values 0…7 of pattern bank 0.

CV 2&3 is voltage in the range of 0…10V which is based on the position of the leftmost/rightmost live cells. this can be changed to something else, of course.

trigger output 4 will trigger when there are no live cells. one good use for it could be patching it into trigger input 3 to create a new random state whenever the previous civilization dies.

implementation:

this uses 2 pages of 128 grid buttons each. buttons are used both to control cells manually and to keep the current state. the current page is stored in variable A.

script 1 advances to next generation by applying the rules to the current page and updating the next page accordingly, then toggling A and switching which page is shown. the rules are applied by script 7, which uses script 8 to calculate the number of live neighbours for cell specified by variable B. since buttons are arranged first by columns, then by rows, the neighbour immediately to the right will have id of the current cell + 1, the neighbour directly above will have the id - 16 (since there are 16 buttons in a row) etc. these numbers are stored in pattern bank 3 - one interesting thing to try would be changing them so that instead of using immediate neighbours it would use cells further away.

scripts 4&5 is where CV/triggers are output based on the current state. this is where you can change how note number and CVs are calculated (you could give a different weight to different cells, for instance).


#234

Fantastic! That’s my Xmas day sorted. Really looking forward to experimenting with the ruleset. Thanks for finding the time to do this - I really appreciate it. Have a great day!

Edit:


#235

Awesome! I missed this with the Xmas festivities, will try ASAP - thankyou!


#236

I don’t understand where the first 3 numbers come from - ie. 4335, 4080, 3825…


#237

are you using pattern bank 3 values 0…7 for anything else? they should be -17, -16, -15, -1, 1, 15, 16, 17 for classic conway’s game of life.


#238

That’s odd - they have been set like that since I first ran it, and I’m not using PN 3 for anything. I wonder if I accidentally saved over the initial values… Odd also that it appears to be working perfectly!


#239

looks like there is a bug, i just tried importing the scene and i’m also getting different values for the negative values. i’ll do some testing.

… and looks like it’s quite an old bug too, i can reproduce it with 2.0 release. guess negative pattern values aren’t used much! logged the bug: https://github.com/monome/teletype/issues/172


#240

i’m testing the fugetta scene using the latest official release (3.0) and not getting any blinking in the bottom rows. which version of firmware are you using?


#241

Also running on 3.0. Not a big deal tho, I can live with it.


#242

thanks for confirming!

it might be pointing to some inefficient or buggy code which is why i want to investigate… i wonder if it’s only present on newer edition grids. i only have the 2012 edition grids, will get one of the newer ones so i can test.


#243

I got a Teletype a few weeks ago - getting my head around it has been a great holiday project. Still very early days, but I thought I’d share something I’ve been working on as a learning exercise.

Feeling inspired by Noise Engineering’s Zularic Repetitor, but not having one (nor having room for one!), I thought it would be an interesting exercise to code up some patterns from the Zularic (which are available in the manual), and see how much of that module’s functionality I could emulate, including using a grid to visualise the patterns, select different patterns, and shift the phase of the individual “child” rhythms.

To get started I chose 4 16 beat patterns (Rhumba, Clave, Gahu, Funk 1) from the Zularic manual, transposed them into the pattern memory. For example, P 0 [rows 0-15] contains the top line “mother” rhythm and P 1-3 [rows 0-15] contain the “child” rhythm for Rhumba, and so on for rows 16-31, 32-47, 48-63.

Scripts 1 - 4 render the patterns out via triggers 1-4, and also render the pattern to the top 4 rows of the grid. In the bottom half of the grid, 4 buttons in column 1 jump between patterns, and the 6 buttons in cols 4-5 allow each of the 3 child patterns to be rotated forward and back. Drive the scene with a clock into Input 1 (Script 1 calls the other 3 children - not sure if that is really the right teletype ‘idiom’ - still learning about timing management, metro etc).

With this template it should be possible to create other scenes which have other patterns. It is probably easier to group patterns of the same length into the same scene, and then adjust Script 7 to jump the pattern start and end forward appropriately - I’m not sure it would be that easy to have patterns of variable lengths, but perhaps there’s a way.

I’m sure there may be lots more efficiencies that people could suggest to make this more compact. I imagine in theory that using some shift register math it would be possible to store a lot more patterns by using the “compiled” value of a pattern rather than an explicit string of 1’s and 0’s, but I haven’t tried to get my head around that just yet.

One limitation I’m experiencing with my current set up is that when I plug in an actual grid, I get a lot of weird additional triggers out of TR 3 (well at least the Peaks module I’m triggering is registering additional triggers, although I’m not seeing extra LED activity at TR 3 on the TT). I have a new batch TT, so I’m plugging the grid directly into the TT, so I guess this is an electrical noise issue? Anyone else seen similar things?

ZULARIC EMULATRIX



#1
A PN.NEXT 0; B - + PN.I 0 15 Y
IF A: TR.PULSE 1
IF A: G.BTN.L B 15
ELSE: G.BTN.L B 5
SCRIPT 2

#2
A PN.NEXT 1; B - + PN.I 1 31 Y
IF A: TR.PULSE 2
IF A: G.BTN.L B 15
ELSE: G.BTN.L B 5
SCRIPT 3

#3
A PN.NEXT 2; B - + PN.I 2 47 Y
IF A: TR.PULSE 3
IF A: G.BTN.L B 15
ELSE: G.BTN.L B 5
SCRIPT 4

#4
A PN.NEXT 3; B - + PN.I 3 63 Y
IF A: TR.PULSE 4
IF A: G.BTN.L B 15
ELSE: G.BTN.L B 5

#5
L 0 3: PN.I I Y
X 0

#6
A G.BTNI; B ? % A 2 -1 1
IF < A 3: PN.I 1 + PN.I 1 B
ELIF < A 5: PN.I 2 + PN.I 2 B
ELSE: PN.I 3 + PN.I 3 B
X + X B

#7
Y * - G.BTNI 7 16
L 0 3: PN.START I Y
L 0 3: PN.END I + Y 15
L 0 3: PN.I I Y
L 0 3: PN.L I 64
L 15 79: G.BTN.L I 5

#8
G.BTX 1 3 5 1 1 0 5 6 2 3
G.BTX 15 0 0 1 1 0 5 0 16 1
G.BTX 31 0 1 1 1 0 5 0 16 1
G.BTX 47 0 2 1 1 0 5 0 16 1
G.BTX 63 0 3 1 1 0 5 0 16 1
G.BTX 7 0 4 1 1 0 5 7 1 4

#M

#I
X 0
Y 0
SCRIPT 8

#P
64	64	64	64
1	1	1	1
48	48	48	48
63	63	63	63

1	1	1	0
0	0	0	0
0	0	1	1
1	1	1	1
0	0	0	0
0	0	1	0
0	0	0	1
1	1	1	1
0	0	1	0
0	0	0	0
1	1	1	1
0	0	0	0
1	1	1	0
0	0	1	0
0	0	0	1
0	0	1	1
1	1	1	0
0	0	0	0
0	0	1	1
1	1	1	1
0	0	0	1
0	0	1	0
1	1	0	1
0	0	1	1
0	0	1	0
0	0	0	0
1	1	1	1
0	0	0	0
1	1	1	0
0	0	1	0
0	0	0	1
0	0	1	1
1	1	1	1
1	1	0	0
0	0	0	0
1	1	0	1
0	0	0	0
1	1	0	0
0	0	0	0
1	1	0	1
0	0	0	0
1	1	0	0
0	0	0	0
1	1	0	1
0	0	0	0
1	1	0	1
0	0	0	0
0	0	0	0
1	0	0	0
0	0	1	1
0	1	0	0
1	0	1	0
0	0	0	0
1	0	1	1
0	1	0	0
0	0	1	0
1	0	0	0
0	0	1	1
0	1	0	0
1	0	1	0
0	0	0	0
1	0	1	1
0	1	0	1
0	0	1	1

#G
0000000000000000
0000000000000000
0000000000000000
0000000000000000
0000000000000000
0000000000000000
0000000000000000
0000000000000000
0000000000000000
0000000000000000
0000000000000000
0000000000000000
0000000000000000
0000000000000000
0000000000000000
0000000000000000

0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0
0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0
0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0
0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0
Summary

This text will be hidden


#244

Hi there - I have a Zularic Repetitor and it’s a great little module - look forward to trying out your script. It’s a perfect idea. You’ve done mighty well in a few weeks! I’m a much slower coder. Can’t help regarding the trigger issue. I’ve have an older TT and have just got used to automatically powering the Grid via battery pack. The one I’ve got lasts for weeks.