L-System Script for Osci-Render
I have long been interested in fractals, so when I discovered Lindenmayer Systems as a simple way to create them, I was inspired to write a Lua script that can transform L-systems into stereo waveforms in Osci-Render. In this script, you can easily create your own L-system and render it at different iterations and frequencies. Hypothetically, anything you can draw with only connected straight lines can be rendered with an L-system.
What is an L-system?
L-systems are a way to describe growth patterns, including how fractals emerge from a simple set of rules. The online L-System renderer by piratefsh is a GREAT way to play around and experiment with different ideas before plugging them into my script in Osci-Render.
<<http://piratefsh.github.io/p5js-art/public/lsystems/>>
Try looking up the Wikipedia article or a YouTube video to learn how they work! Here's the video that introduced me to the idea:
<<https://youtu.be/OMB1JLIdwNA?si=Gx3K3MdVi8QSWLm2>>
Key Features of the Script:
1. Customizable L-systems: Choose your own axiom, rules, angle, length, and number of iterations to generate unique and captivating designs. I've included a few examples to help get you started.
2. Interactive Sliders: Take full control of your creations with easy-to-use sliders for adjusting parameters like frequency, iteration, size, and even some fun effects.
3. Efficient Move Reduction: Automatically optimize your L-systems by removing unnecessary moves to enhance performance and change the timbre of your image's sound. This works by modifying the output string itself, so you can even run this outside of Osci-Render and connect it to other scripts that use L-systems!
4. Explanations and Debugging: The script is filled with comments, enabling you to learn how everything works and even make modifications. The code is organized so that functions and variables are defined first, making the logic flow that comes afterward easier to read. There are also debugging toggles that tell you what happens in the first sample via the console.
5. Approximation at High Frequencies: With enough iterations, you might have so many details in your image that Osci-Render physically can't calculate everything fast enough, even at the highest sample rate. When that happens, the script approximates your image instead, preserving your desired frequency at the cost of clarity.
You'll get the L-System Lua Script for Osci-Render, a project file with the script already set up, a project file showing several examples of L-systems, and a move reduction script for tackling strings too cumbersome to modify in the main script.