August 9th, 2024

Sonic Pi: Ruby as a Composition Tool

Sonic Pi is a software synthesizer that enables music creation through coding in Ruby, featuring extensive documentation and tutorials, bridging technology and music for innovative compositions without physical instruments.

Read original articleLink Icon
CuriosityAdmirationEnthusiasm
Sonic Pi: Ruby as a Composition Tool

Sonic Pi is a unique software synthesizer that allows users to create music through coding, specifically using an extended version of the Ruby programming language. Developed by Sam Aaron, Sonic Pi employs a domain-specific language (DSL) that maps musical concepts to code, enabling users to compose music by writing scripts. The author, who has a background in music and web development, reflects on their journey of rediscovering music composition through Sonic Pi after a hiatus from traditional instruments. They describe the process of creating music using code, including defining rhythms, melodies, and harmonies, and utilizing features like loops and threads to layer sounds. The article includes examples of code snippets that demonstrate how to manipulate sound parameters, such as tempo and synth types, and how to create musical sequences programmatically. The author emphasizes the educational aspect of Sonic Pi, highlighting its documentation and tutorials that assist users in learning both coding and music composition. Ultimately, Sonic Pi serves as a bridge between technology and music, allowing for innovative compositions without the need for physical instruments.

- Sonic Pi is a software synthesizer that uses Ruby for music composition.

- It allows users to create music through coding, utilizing a domain-specific language.

- The author shares their experience of rediscovering music through Sonic Pi after a break from traditional instruments.

- The platform includes extensive documentation and tutorials for learning.

- Sonic Pi combines technology and music, enabling innovative compositions without physical instruments.

Related

Synthesizer for Thought

Synthesizer for Thought

The article delves into synthesizers evolving as tools for music creation through mathematical understanding of sound, enabling new genres. It explores interfaces for music interaction and proposes innovative language models for text analysis and concept representation, aiming to enhance creative processes.

Introduction to Program Synthesis

Introduction to Program Synthesis

Program synthesis automates software creation by generating programs from requirements. It leverages Large Language Models (LLMs) like co-pilot and AlphaCode, alongside search-based techniques, for tasks like data manipulation and legacy application modernization.

Pixi – reproducible, scientific software workflows

Pixi – reproducible, scientific software workflows

Pixi is a new package manager for scientific software, focusing on collaboration, reproducibility, and performance. It offers lockfiles, streamlined workflows, GPU optimization, and integration with tools like Jupyter notebooks. Pixi aims to enhance scientific workflows by managing dependencies efficiently.

Pixi – rust-based package manager for reproducible scientific workflows

Pixi – rust-based package manager for reproducible scientific workflows

Pixi is a new package manager for scientific software, enhancing reproducibility and simplifying workflows. It features lockfiles, streamlined builds, and compatibility with Git and Jupyter, optimizing research efficiency.

Baking Pi – Operating Systems Development

Baking Pi – Operating Systems Development

Baking Pi is a tutorial course for ages 16+, teaching basic operating system development on Raspberry Pi. It includes practical exercises, requires specific hardware, and encourages community contributions via GitHub.

AI: What people are saying
The comments reflect a diverse interest in Sonic Pi and related music programming tools.
  • Several users mention alternative music programming languages like SCAMP and Glicol, highlighting their unique features.
  • Comments praise the capabilities of Sonic Pi, particularly its live coding performance and the engaging experiences it offers.
  • Users share personal experiences and memorable performances involving Sonic Pi, showcasing its impact on their musical journey.
  • There is a discussion about the challenges of installing Sonic Pi due to dependencies, with suggestions for packaging solutions like Flatpak.
  • Some users express interest in artists who effectively use Sonic Pi, sharing links to their work and performances.
Link Icon 13 comments
By @chaosprint - 8 months
If you're interested in live coding, feel free to try Glicol (https://glicol.org).

There's also TidalCycles. I have to praise the ability of Haskell and Ruby in creating DSLs

For Glicol, my thoughts on language design are focused on a synth-inspired syntax, speed for composition, and convenience of sound design. The idea is to design a DSL that draws from previous programming habits but isn't confined to existing languages.

By @dark-star - 8 months
Some years ago I found a video on YouTube by someone who used Sonic Pi to re-create the THX Deep Note. That video was awesome because he didn't initially explain what he was going to do. Je started by creating a single "note" of the sound but called it a bee. Then he tweaked the sound of the bee a bit here and there, showed what it sounds like, and in the end he was like "and now let's just create a couple hundred of these bees and hear what it sounds like in a beehive", and when he did that the Deep Note emerged.

I loved that video but I have since been unable to find it again. If anyone has a link to that video, please share

By @Alifatisk - 8 months
I think this is one of the cases where Ruby shines, the heavy metal programming allows the syntax to be almost english like programming.
By @pjerem - 8 months
I’ve had the chance to watch Sam Aaron (Sonic Pi’s father) doing a live performance with Sonic Pi several years ago.

He was impressive. The music was evolving each time he changed code in live. And it was good.

By @yowlingcat - 8 months
If you're interested in a couple of examples of artists that use Sonic Pi, I found out about DJ_Dave [1] a while back and think her stuff is a great example of a talented, competent musician using the tool well. She did an AMA [2] on Reddit a while back and I believe has some stuff up on GitHub [3]

[1] https://www.youtube.com/watch?v=JiQHclg_648

[2] https://www.reddit.com/r/audius/comments/19dxmy6/hey_audius_...

[3] https://github.com/algorave-dave

By @decasia - 8 months
Speaking as a Ruby developer, this is very cool. I could see using this for algorithmically generated music and that would be neat. (Speaking of which, I was meaning to make our noisy git repository events into some kind of algorithmic music — this would be good for that.)*

But speaking as a musician with lots of keyboard instruments — if I were trying to compose a piece of music, I'm not really sure why I would compose musical sequences with Ruby when I can play them with a MIDI keyboard, or record an acoustic instrument and loop it. I see that you can input anything you like with the Ruby DSL, but it's not a great UX compared to a piano keyboard.

I guess to put it another way — I would not use this to replace what I use Logic for. But that's just me.

* see also http://listen.hatnote.com/

By @bbbhltz - 8 months
I was just thinking about Sonic Pi the other day and watched a few videos online. I only ever played with it briefly years ago(busted out the classic Old MacDonald and Hot Cross Buns jams).
By @garbagepatch - 8 months
For a different take (not live) at programming music check scamp for python[0]. The author also has a bunch of videos in youtube with things he does with it, like this Fourier Elise video[1].

[0] http://scamp.marcevanstein.com/

[1] https://www.youtube.com/watch?v=zq32bIud3OM

By @latexr - 8 months
Looks like your HTML comments aren’t taking, because your editor converted -- (two hyphens) to — (one em dash).
By @naltroc - 8 months
Shoutout to alsoknownasrox, my favorite Sonic Pi livecoder!

https://www.youtube.com/watch?v=wXIvXrBQFkE

By @cies - 8 months
I wish this was available as a flatpak. There are just toooo many dependencies that need to be custom install to install Sonic Pi. Packaging it for distro will be a nightmare.

Flatpak to the rescue.

By @_vaporwave_ - 8 months
This is a really neat demo!

Just a heads up though your site layout is broken in Safari

By @portpecos - 8 months
So it’s a music composition programming language?