Cagire: Live Coding in Forth (cagire.raphaelforment.fr)
100 points by surprisetalk 10 days ago
codesnik 3 hours ago
Nice. When I saw some javascript live music arrangement experiments, I thought that forth is syntactically better for that task because of postfix notation - no need to select and execute parts, keywords could be self-adding/playing.
eggy 18 hours ago
Cool, and I love the retro font. I had a Vic-20 (early 80s) and Commodore PET 2001 (1977) I am learning Odin, and I was going to try creating live coding environment with scripting in Forth and with the gui and rest in Odin, but for audio and graphics. I was inspired long ago by Paul Batchelor's Sporth and Tidal (now tidal cycles?). Forth is a great language. You can make an compiler/interpreter in a few days. John Earnest's ok.js is also cool. I like stack and array languages, so when I am not playing in J, I use Uiua. Uiua has the capability to do audio and graphics/animations and scratches my array/stack itch.
quaverquaver 21 hours ago
for FORTH like synthesis environment you will want to check out SAPF! (by James McCartney author of SuperCollider) https://github.com/lfnoise/sapf
quaverquaver 20 hours ago
concatenative code is sort of a natural fit for audio in terms of representing signal flow...
eggy 18 hours ago
Wow, I never saw this! I like APL/J/Uiua, so this is perfect. Uiua is both stack and array based. Thanks!
hankbond 19 hours ago
This is a neat project and I don't think I'm aware of any sequencers that allow for arbitrary execution per-step (not that I am that deep into the space). The font choice for the website is really... interesting. I don't think I can recall ever feeling this dyslexic trying to read the copy here.
eluusive 14 hours ago
This is super cool. I've been thinking about doing something like this for awhile as a retirement project.
chantepierre 17 hours ago
Very cool. Are you near Aspet ? I often hike with a friend who lives there. The Cagire is one of my favorite peaks of the Pyrénées.
alex7o 16 hours ago
Oh it seems like forth is a pretty good candidate for this. Like most of these things are a post processing steps
octetta 18 hours ago
Neato... I'm glad stuff like this exists in the world. I'm gonna steal some ideas for my own project (Skred). Thanks!
DonHopkins 19 hours ago
Toffoli and Margolis's CAM-6 cellular automata machine board for the IBM-PC was programmed in FORTH. I made a simulator, and this video shows some of the original FORTH code that I saved, as well as my own compatible FORTH CA rule computer that le me run the rules from the book, which produced lookup table for the hardware, which the simulator is compatible with. I've since rewritten it in JavaScript. It's not live coding, but it has a live performance user interface (quite weird and hard to figure out, especially if you haven't read the book, but I demonstrate it in the video).
CAM6 Demo
https://www.youtube.com/watch?v=LyLMHxRNuck
Original FORTH code that drove the actual CAM-6 board:
tomt-cam-forth-scr.txt: https://donhopkins.com/home/code/tomt-cam-forth-scr.txt
tomt-users-forth-scr.txt: https://donhopkins.com/home/code/tomt-users-forth-scr.txt
My compatible CA compiler and glue to the simulator written in C:
cam.f.txt: https://donhopkins.com/home/code/cam.f.txt
compile.f.txt: https://donhopkins.com/home/code/compile.f.txt
An old version of the simulator written C, before I rewrote it in JavaScript:
https://github.com/SimHacker/micropolis/tree/master/Micropol...
The JavaScript CAM6 simulator:
CAM6.js: https://github.com/SimHacker/CAM6/blob/master/javascript/CAM...
joshu 5 hours ago
Oh, this is awesome. I actually have this book. Also, for some reason, I am writing a hacking game based around fourth which has been interesting.
DonHopkins 3 hours ago
Wow! If you ever get tired of it I will buy it from you. It's impossible to find copies now, and they make great wedding or graduation presents. ;)
Just joking, I know you would never part with it!
If you were sneaky and transgressive like Aaron Schwartz, you might notice the url of the pdf file is shown in the browser bar in the video, and type in the url to steal the book:
https://donhopkins.com/home/cam-book.pdf <= DO NOT CLICK THIS URL! IT IS FOR EDUCATIONAL RHETORICAL PURPOSES ONLY.
Fortunately Norman Margolis has generously given me permission to distribute that pdf file (although I don't know what MIT Press would think about it, but last time I was at MIT I visited their store and they didn't have any copies, so if they would only get their shit together and publish the fucking book somewhere I could buy it, I would already own a pile of them to hand out to tricker-treaters and religious zealots who knock on my door, as brain candy to set them on a better path).
He's also given me permission to make interactive versions of any of those chapters, and he said that his favorites were the physical simulations, because they have something to say about nature and physics. That's definitely on my TODO list!
I'd really like to do a "KidPix" kind of cellular automata playground, like Rudy Rucker and John Walker did with Autodesk CALab. There's some great stuff from that online, including a web based version of CALab and a fieldbook of many rules in the manual:
https://www.rudyrucker.com/blog/2023/12/07/the-roaring-twent...
https://scanalyst.fourmilab.ch/t/rudy-rucker-and-john-walker...
https://www.fourmilab.ch/cellab/
https://www.fourmilab.ch/cellab/manual/
This is one of my favorites, ECOLIBRA, which I call ECO, and used for SimCity DRM as well as demonstrated in those videos. Rudy came up with it, as an excercise in composing multiple CA rules by layering and multiplexing: there is one layer of "ANNEAL" that defines whether each cell is water or land, and in land it runs "LIFE" and in water it runs "BRIAN'S BRAIN" (named after Brian Silverman, who did not actually name it after his own brain, that was somebody else attributing it to that part of his anatomy).
https://www.fourmilab.ch/cellab/manual/rules.html#EcoLiBra
ANNEAL (Vote rule + tie breaker flip):
https://youtu.be/lyZUzakG3bE?t=534
LIFE:
https://youtu.be/lyZUzakG3bE?t=572
BRAIN:
https://youtu.be/lyZUzakG3bE?t=588
ECOLIBRA:
https://youtu.be/lyZUzakG3bE?t=612
>This rule is a cross between Life and Brain. The basic idea is that the cells are divided between dark “sea” cells and light “land” cells. We run Brain in the sea, and on land we run not Life but AntiLife. All the land cells are normally firing cells, and the presence of an active AntiLife cell is signaled by having a land cell which is not firing. Full details on EcoLiBra are in the Cellular Automata Theory chapter.
>The name EcoLiBra suggests 1) an ecology of Life and Brain, 2) a balanced situation (equilibrium), and 3) the human intestinal bacteria Escherichia coli, known as E. coli for short. The third connection is perhaps a bit unsavory, but remember that E. coli cells are in fact the favorite “guinea pigs” for present day gene splicing experiments. As one of the goals of CelLab is to promote the development of artificial life, the designer gene connection is entirely appropriate. I've given EcoLiBra a nice, symmetric start pattern, but it also does fine if you use the Bit Plane Editor to randomize all bit planes.
The "ECO" version in my simulator actually runs "DEATH" aka "ANTI-LIFE", the one's complement of "LIFE", so that the cells of LIFE and BRAIN along the shores stimulate each other more and spawn lots of life onto land and brain into the sea, due to their "foamier" interactions along the coast.
I also took Rudy's idea of layering CA rules another 5 steps and ran a dithered heat diffusion in the upper 5 leftover high bits (and echo the 1 bit of life's history into the next higher bits so life and brain are both the same 2 bits of depth + 1 bit of anneal + 5 bits of heat), so the heat diffusion picks up "heat" that the life and brain particles emit, and they leave trippy trails and cause "global warming". Using CA to tell a metaphorical narrative of the organisms polluting their own environment.
https://github.com/SimHacker/CAM6/blob/master/javascript/CAM...
(Yes it's unnecessariy complicated code, and don't get me started about why it rotates the scan order around every 4 frames -- suffice it to say it makes it look better, by canceling out the directional heat diffusion dithering artifacts from the serial scan order).
More links here, and if you only look at one, be sure to check out Rudy's 1970's late night television style commercial with overdubbed 800 number.
https://news.ycombinator.com/item?id=42806736
There's so much about it that I love, but my favorite part of Rudy's CALab demo is the "Office of the Future" and 1-800 number at the end:
phreda4 21 hours ago
Nice! I try this