As a token of my heartfelt gratitude to everyone supporting me on Patreon, I thought it was be nice to give you a sneak preview of the fun stuff I’ve been working on recently. It’s still very early in its development, but it’s already exciting and expressive enough to share so you all can start playing with it.
(Just as a warning - this is a very early experimental prototype. So please expect bugs, poor documentation and things to be generally rough and unfinished. That’s the point - I wanted to get it into your hands so you have the opportunity to provide feedback and help improve the design and implementation of the final release which I’m hoping will be some time in the summer.)
Tau - a web-powered GUI component for fast development
I have been working towards a new web-powered interface for Sonic Pi for a long time now. This initially started with the integration of the Elixir programming language in v4 which brought with it a web framework called Phoenix and a powerful live interface technology called LiveView. The main idea is to use this new web technology to develop new interface ideas and components. Given Elixir LiveView’s very fast development workflow - it will be much faster to develop and extend the interface than it is with the existing C++ GUI toolkit (Qt).
The other side of Tau is an integrated web view build directly into the browser. This new view is built with the same tech as Chrome and is programmed to directly connect and work with the LiveView backend described above.
It’s important to point out that none of this requires a connection to the web. Everything is built directly into Sonic Pi. Once you have downloaded and installed Sonic Pi you’ll have everything you need to live code an audio visual set - no internet required.
I have many, many things planned for Tau which I’ll continue working towards and sharing with you as they become a reality. However, one important long-term goal is to use it for visualisations. Back when I worked on Overtone (the predecessor of Sonic Pi) I was performing with visuals from a combination of OpenGL shaders (a simple clone of Shadertoy) and Processing (using a library I was working on called Quil). It was amazingly fun and has long been something I wanted to see inside Sonic Pi.
Today, v5 Tech Preview 1 introduces the first step towards that vision of powerful and expressive visual tools integrated deep within Sonic Pi.
As a “hello world” example to get things started I have integrated the wonderful Hydra visual synth into Tau. Hydra was created by Olivia Jack and has a vibrant and active community of visual artists sharing and discussing their work. You can start experimenting and playing with Hydra here:
The plan is for the vast majority of Hydra sketches to be simple to copy and paste into Sonic Pi and for them to “just work”. This is achievable with the new function
hydra which takes a single string representing the code for the new Hydra sketch. For example, you can start with something very simple:
Wait, what is that osc() and out(), what do they mean, how does it work, what else is available? All great questions and for now there’s no real support in Sonic Pi to help with any of this - all that will come - including ways to trigger and manipulate complex sketches with the same simplicity as triggering a synth or sample.
However, for now, I would definitely recommend you play around with what’s possible. Get a feel for it and see what you can do. A great starting point is the official Hydra API:
Note that you can call
hydra anywhere you would call
sample. This means you can put calls inside a
live_loop and live swap the visuals in time with your music.
A Lovely Example to Try
Try running this sketch by Flor de Fuego which is one of the many wonderful examples over on https://hydra.ojack.xyz
#licensed with CC BY-NC-SA 4.0 https://creativecommons.org/licenses/by-nc-sa/4.0/ #Glitch River #Flor de Fuego #https://flordefuego.github.io/ hydra "voronoi(8,1) .mult(osc(10,0.1,()=>Math.sin(time)*3).saturate(3).kaleid(200)) .modulate(o0,0.5) .add(o0,0.8) .scrollY(-0.01) .scale(0.99) .modulate(voronoi(8,1),0.008) .luma(0.3) .out(); speed = 0.1"
Where is Tau?
Excellent question! Right now, you have to open the help system (hit the big help button) and click on the Tau tab. This is just a temporary home - I’ll figure out where it should go before releasing. Note that there are a few handy controls -
R refreshes the Tau window and is useful if things misbehave and you want to reset.
E opens Tau in your default browser. You can have as many connections as you want and when you call
hydra the running Hydra sketch in all browsers will update simultaneously.
- change the zoom level.
Lots and lots and lots and lots. I’m only just getting started and I expect to make a few tech previews as I explore various ideas. For example, if your Hydra syntax isn’t correct you don’t currently see the error, you can’t (yet) access the Sonic Pi audio data to drive the visuals and you can’t (yet) easily stream new control values to a running sketch like you can with a running synth. For example, mapping MIDI controls or multiple live_loops to the running visualisation. This will all be possible.
What’s the mysterious spinning square in the top left?
That’s a proof-of concept p5.js sketch running happily along. You can’t modify or live code it yet, but you will be able to soon. I just wanted to make sure both Hydra and Processing could co-exist in the same view.
Discuss and Share on Discord
Please do discuss and share your ideas on the Sonic Pi discord server. I’d love to see what you come up with. There’s also a Hydra discord to join and learn from those with considerable experience.
That’s it for now. I have so much planned - but I’ll leave discussing and sharing those plans with you for another day. For now, learn some Hydra, play around with the new functionality. Tell me what’s missing. What do you want to see next?
I hope that you’re as excited about Tau as I am!
Patreon supporters can download v5 Tech Preview 1 here: https://www.patreon.com/posts/v5-tech-preview-78420348