The blog post details the author's process of livecoding graphics in Common Lisp using a combination of Quicklisp libraries, specifically cl-cairo2 and Qtools. They leverage the REPL's interactive nature to rapidly iterate and experiment with visual elements, modifying code and seeing immediate results in a Cairo graphics window. The author explains their setup and workflow, emphasizing the advantages of Lisp's dynamic environment for this type of creative coding, showcasing how functions can be redefined and tweaked on-the-fly to manipulate shapes, colors, and other graphical parameters. This approach allows for a fluid and exploratory development experience, turning the coding process itself into a performative act.
Kevin Gal's blog post, "Graphics livecoding in Common Lisp," details his exploration and implementation of a livecoding environment for generating visuals using Common Lisp. He begins by outlining the core concept of livecoding, where code modifications instantaneously affect the output, creating a dynamic feedback loop that fosters creative exploration and experimentation. He emphasizes the appeal of this real-time interaction for artistic endeavors, particularly within the realm of generative art.
Gal proceeds to describe his chosen tools and approach. He leverts Common Lisp's dynamic nature and the Quicklisp library manager for rapid prototyping and iteration. Specifically, he employs the CEPL library along with SDL2 and OpenGL for rendering graphics. CEPL's particular strength lies in its ability to redefine functions on-the-fly, a crucial feature for achieving the seamless updates characteristic of livecoding. This allows him to modify the code defining the visuals while the program is running, seeing the changes reflected immediately in the output window.
The post then delves into the technical details of his setup. He explains how he structures his Lisp code, using a combination of functions and global variables to manage the graphical elements. He also details how he uses CEPL to redefine functions, effectively "hot-patching" the running program with new code as he types it. He highlights the benefits of Common Lisp's interactive development environment, such as the REPL, for facilitating this livecoding workflow.
The author then shares practical examples and demonstrations of his livecoding process. He showcases how he can manipulate shapes, colors, and animations in real-time by modifying the Lisp code. He walks through the process of building up a visual scene incrementally, tweaking parameters and functions on-the-fly to achieve the desired aesthetic effect. This allows him to explore different visual possibilities quickly and intuitively, taking advantage of the immediate feedback provided by the livecoding environment.
Finally, Gal reflects on his experience and future directions. He expresses his satisfaction with the responsiveness and flexibility of his livecoding setup, noting how it empowers him to create generative art in a more fluid and interactive manner. He also discusses potential improvements and extensions, including exploring different rendering libraries and integrating sound generation into the livecoding workflow. He closes by emphasizing the potential of Common Lisp as a powerful tool for creative coding and live performance.
Summary of Comments ( 47 )
https://news.ycombinator.com/item?id=43774726
HN users generally praised the author's technical skill and the visual appeal of the live coding demo. Some expressed interest in learning more about Common Lisp and the specific libraries used. A few commenters discussed the practical applications of live coding graphics, suggesting uses in game development, generative art, and data visualization. One commenter pointed out the potential accessibility issues related to color choices in the examples. Another highlighted the historical precedent of Lisp machines and their graphical capabilities, connecting the demo to that lineage. The perceived complexity of Common Lisp was also mentioned, with some users acknowledging its steep learning curve but also its power and flexibility.
The Hacker News post titled "Graphics livecoding in Common Lisp," linking to Kevin Gal's blog post about livecoding graphics in Common Lisp, has generated a moderate amount of discussion with a number of insightful comments.
Several commenters express enthusiasm for the elegance and power of Common Lisp for this kind of work, particularly its interactive development environment and the REPL. One commenter highlights the "joy" of using Lisp for livecoding, contrasting it favorably with other languages. Another commenter specifically praises the ability to redefine functions on-the-fly without restarting the application, a key feature enabling livecoding.
The discussion touches upon the specific libraries and tools used by the author, including CEPL, SLY, and Quicklisp. Commenters share their experiences with these tools and offer alternative suggestions. One commenter suggests using a library like cl-cairo2 for 2D drawing or a game library like Trial for a potentially smoother experience. Another commenter mentions using similar setups with Common Lisp and OpenGL for 3D graphics programming.
Some commenters delve into the technical details of livecoding and image processing, discussing double-buffering techniques and how to handle window resizing events. One commenter specifically mentions a technique of using a dedicated thread for rendering to avoid blocking the main thread during intensive graphical operations.
A couple of comments reflect on the historical context of Lisp and its influence on other livecoding environments, including Smalltalk. One comment points out the rich history of Lisp machines and their emphasis on interactive programming, which paved the way for modern livecoding techniques.
The comments also branch into related areas, such as generative art and music, and the potential of Common Lisp for creating these types of interactive experiences.
While the general tone is positive and appreciative of the author's work, there are a few constructive criticisms. One comment notes the potential performance bottlenecks of Common Lisp for graphics-intensive applications and suggests exploring other languages or libraries for optimization. Another comment points out the relative niche status of Common Lisp in the contemporary programming landscape, which may limit its adoption for livecoding graphics.
Overall, the comment section provides valuable insights and perspectives on livecoding graphics with Common Lisp, touching upon both its advantages and its potential limitations. The commenters' collective knowledge and experience enrich the discussion and offer valuable pointers for anyone interested in exploring this area further.