Code in Code: The Resonance of Translation




Work in progress

16-Jan-2024, varible size

Real-time code computation, Interactive animations



"Code in Code" is an artistic exploration that weaves together three distinct languages – the human natural language of text input, the computer programming language, and the expressive language of visual forms embodied in L-systems. This project represents my ongoing journey into the realm of computer graphics, with a particular focus on the study of fractals.

The process begins with the audience's textual input, which is first transformed into sounds; each keystroke resonates with a corresponding piano note, creating an auditory backdrop. These inputs are then sent via OSC to TouchDesigner. Here, they undergo transformations as Python scripts algorithmically transcribe them into L-systems signs, finally in the creation of intricate and symmetrical 2D visuals.

During a reflective afternoon, I found myself pondering the profound relationship between language and code. As I manipulated symbolic commands, guiding the aimless path of Lindenmayer's turtle, I contemplated how characters like F, +, -, !, /, and [] are not merely instructions. They are an expression of my intent to mold fractal patterns, akin to crafting a unique vocabulary. Each function I define and invoke is like weaving a precise and fashionable word into a dialogue. It's comparable to directing the turtle with instructions such as F+[F]-[F], a dance of commands that translates to a step forward, a turn right, and a retreat to the starting point for a turn left. This project is more than coding; it is a symphony of interaction, a bridge connecting my creative vision with the computer's interpretation.

At this point, "Code in Code" delves into the inversion, mapping, and transformation among these languages. The project binds these elements through a nodal connection, where the OSC wireless transmission protocol, alongside nodes and lines in Max and TouchDesigner, narrates a visual, logical, and linguistic resonance. This exhibition stands as a testament to the harmonious integration and mutual influence of diverse forms of expression in the digital era, inviting the audience to witness a dialogue between human creativity and digital interpretation.


Screenshots of some generated graphics

Technical Implementation

At first, I was merely fascinated by the patterns generated by mathematics, which led me to start learning more about the subject recently. Despite my weak math foundation, I have gained a wealth of knowledge from friends who are experts in the field. For instance, I've always found fractal shapes like the Mandelbrot set and Julia set magical but elusive. When watching other people's shaders, I discovered that the x and y axes on our canvas can directly represent the complex numbers'a and b axis(c = a + bi), and many people have used these formulas and theorems to create beautiful graphics with shaders. But for me to comprehend what math and shaders working is too hard.

I began learning TouchDesigner from scratch and delving deeper into Max/MSP. These tools are much more powerful than p5.js, which I am most familiar with; they are fast, use GPU rendering, and have fewer bugs. They seemed tailor-made for visual artists like me. However, after going through a series of tutorial videos, I felt a bit tired. Although I could easily create seemingly pretty graphics with various ready-made nodes, it didn't bring me the joy I had anticipated. They also seemed more homogenized compared to creative programming. Too many people were creating similar visuals with similar nodes.

Suddenly, I noticed the L-system SOP, which I had researched in p5.js last year. In code, changing it seemed a bit troublesome, but in TD, it appeared that I could do much more. I started to read its documentation to understand its syntax.

As I mentioned earlier, even simply commanding the turtle how to crawl, I consider it a language. I wanted to try translating our everyday human language to it. Initially, I set up a series of complex mapping rules (such as mapping text length to iterations, letter frequency to rotation angle, and first and last letters to branching rules, etc.) but quickly got overwhelmed. Being a beginner, I couldn't manage such complexity in a short time, so I resorted to the most conventional way. I simply assigned the symbols F, +, and - to the 26 uppercase and lowercase letters. This rule seemed simple, but it was the most feasible solution I could come up with in the limited time I had. These symbols could be combined in any order, and the computational load was not too heavy. Even with many generations added, it wouldn't crash my computer. So, I decided to use my text input, trying to chang this string of expressions in real time. I made a p5.js sketch here:
translate text to L-system code: https://editor.p5js.org/huichuan1999/sketches/eMjgn7GKg
but it is not enough.

With the help of my teacher, I successfully achieved the transmission of textual information from Max to TouchDesigner. I'm immensely grateful to Olivier for his assistance! In addition, I experimented with the jit.linden and jit.turtle objects in Max/MSP to implement the L-system and attempted to create some visuals. However, I found that their potential for visual iteration and development was significantly limited compared to TouchDesigner. Moreover, they seemed more suited to musical applications, so I decided to leave them as simple experimental outcomes.

After resolving the issues, I started to play around with colors and parameters, applying what I had learned from various tutorials. Finally, following my instincts as a visual artist, I managed to make it look very attractive. I'm delighted that I was able to create it successfully!


References

Przemyslaw Prusinkiewicz and Hanan, J. (2013). Lindenmayer Systems, Fractals, and Plants. Springer Science & Business Media.

Derivative. (2021). TouchDesigner Documentation. [online] Available at: https:// docs.derivative.ca/LSystem_SOP.

Anon, (n.d.). How to create L-Systems – Houdini Kitchen. [online] Available at: https://www.houdinikitchen.net/2019/12/21/how-to-create-l-systems/#advgb-toc%027588e908-26fb-4283-92ee-a449b516916a [Accessed 16 Jan. 2024]

Derivative. (2020). Colour Lover Palette Picker. [online] Available at: https:// derivative.ca/community-post/asset/colour-lover-palette-picker/62697 [Accessed 16 Jan. 2024].

www.youtube.com. (n.d.). 1/3 TouchDesigner Vol.031 Procedural Plants with L-system. [online] Available at: https://www.youtube.com/watch?v=-yxDrCbGpfg [Accessed 16 Jan. 2024].

00's Adventure. (2018). Algorithm Creation Practice 03 - Implementing L-system with MaxMSP. [online] Available at: https://uegeek.com/181128-computational-creativity-in-maxmsp-03.html [Accessed 16 Jan . 2024].

MAX/MSP Tutorial-05 Obtaining Keyboard Key_bilibili. [online] www.bilibili.com. Available at: https://www.bilibili.com/video/BV1554y1t7qN/?spm_id_from=333.880. my_history.page.click&vd_source=2fd8d1ba069d13976ae3994a882e8337 [Accessed 16 Jan. 2024].