Cascade is a live-coding environment
It runs in the web browser, turning CSS rules into sound

Code on Gitlab Videos Discussion


Cascade is a live-coding parasite to Cascading Style Sheets



How to use Cascade

Cascade interprets the HTML element with a .cas class. You can start by creating a visible div with the background color you like, more details about how to start in Getting Started.

Cascade also provides useful commands to execute in the browser’s webdev console, (see Commands). Any other way to modify a web page is compatible with Cascade, collaborative editing, static HTML pages, live-coding performances… Be creative!

Getting started

Download Cascade and import the following files present in the /js folder to your HTML page:

<script src="path-to/Tone.js" charset="utf-8"></script>
<script src="path-to/instruments.js" charset="utf-8"></script>
<script src="path-to/cascade.js" charset="utf-8"></script>

You will also need to link cascade.css to your page. You can find it in the /css folder:

<link rel="stylesheet" href="path-to/cascade.css">

Create an HTML structure with divs and background colors, for instance:

<body style="background-color: navy; height: 100vh;">
  <div class="cas" style="top: 2vh; left: 10vw; background-color: yellow; width:100px; height:300px;"></div>
  <div class="cas" style="top: 1vh; left: 30vw; background-color: red; width:100px; height:30px;"></div>

Now you need to initialize Cascade with JavaScript, here we take body as the Cascade container:

let c = new Cascade("body")

You should now hear something. To go further, open your browser’s devtool and move the divs around by changing their positions, background colors, sizes… A couple of scripts will help you to play around, for instance, js/interface.js will make every element draggable, change their background color on shift + click, and remove it with a double click.


new Cascade(querySelector root element, {options})

The default cascade class is .cas. Only elements containing that class are taken into account. To override that default:

let c = new Cascade("body", {
  cascadeClass: '.yourOwnClass',

Available options are:

An exemple with custom options:

  let c = new Cascade("body",{
    cascadeClass: ".toplay",
    defaultStyle: "width:20px; height:70px; background:olive;",
    startButton: false,
    activeStyle: "border-bottom:4px solid red;",
    bpmRange:[30, 300],


The following commands can be executed in your browser’s devtool console:

If you use the following cascade variable name:

let c = new Cascade("body")

…you will access to the commands this way, on your page or live, in the devtool’s console:

c.add('width:10vh; height:30px; background:cyan; top:80vh;')

Alternatively, for the sake of keyboard speed, you can add the file js/live-shortcut.js to directly access the commands:



The following events can be listened: add, clone, start, stop, rm, update. You can use events this way:

let c = new Cascade("body")
c.on('add', function(e) {
  console.log(`Created: ${}`)


The following table associates graphic and sound characteristics. Some properties are vague on purpose (positions) because they can be impacted by many CSS rules: top, right, bottom, left, margin, transform, flex

CSS Sound Comments
Body background color bpm Only body’s background color luminosity will set the piece’s bpm. e.g. yellow = 150 bpm MidnightBlue = 81 bpm.
horizontal position delay Time delay within the beat period: if the element 10% from the left, it be delayed 10% after the time.
vertical position note The note pitch. Higher = louder.
width / height ratio beat distribution The width / height ratio sets the number of beats and the number of steps, following Godfried Toussaint’s euclidean rhythm distribution. E.g a ratio 8:13 will play 0 1 1 0 1 1 0 1, 1:2 will play 1 0. The ratio ignores the orientation, in this sense 4:3 = 3:4 ; The greatest of the two ratio numbers is always used for the number of steps, and the smallest for the number of beats.
background color Instrument The background-color of an element will define the instrument: Cascade comes by default with 10 color CSS variables you can overwrite, those variable numbers (e.g.:--c3) will set the third instrument. Any other color will be interpreted as the closest one defined by a variable.
Surface Velocity (volume) The surface of an element (with × height) will affect the volume of the associated instrument. The bigger the louder.
opacity probability The opacity value will affect the chance an element will have be played. E.g. opacity:0.5; will play the element randomly 1 over 2 times.
border radius duration The cumulated 4 border radius of the element will define the duration of the sound it triggers. High radius => short sound.
border top width cycle shift This value in px will shift the rhythmic pattern. E.g. A 1px border top will change 1 0 0 0 into 0 1 0 0. This can be also known as “Euclidean rotation”.
border left / right width pan (soon) The difference between a left and right borders width will define the left / right pan. E.g. to place an instrument at the max. right, add a 10px right border or more.
More to come…

Cascade: Graphic / Sound associations Full-size image

Why Cascade is cool?

Note on CSS properties

Only a few CSS properties are interfaced with sound, other properties are ignored. The chosen CSS properties were picked for the following reasons:

Cascade Pool (collab mode)

With Pool mode, you can use Cascade with other performers in real time, or broadcast a live performance to another browser.

Install and run

Go to /pool, then install npm modules with:

$ npm install

…and run the app with:

$ node index.js

Then got to either localhost:8080/performer for performing (can listen, see, and modify) or localhost:8080/ to attend the performance (can listen and see only).

Pool: Limitations

Cascade pool comes with the following limitations:


Contributions are welcome, let’s talk about your feedback and ideas in the issues.

Huge thanks to @alicericci for her dev skills and @svilayphiou and her students for the early adoption.


Cascade is released under GNU AGPL.

Table of content