Wavepot Milestone #1

Wavepot, by George Stagas, is reaching it's first milestone. It's a crowfunded dsp sandbox. A bit like glsl sandbox. In wavepot you can listen at the works of the others and try your own modifications on them, or create your own audio processing programs.

Whereas the glsl sandbox has been bounded to simple fragment shaders, the wavepot's module system means it'll be easier to create large scripts and build on top of others work. I'm already using some of the modules from opendsp, not needing to rewrite the filters for every dsp function.

Biggest thing introduced in the first milestone is the github interface. The code you write into the screen is stored into github. It ends up to anonymous account if you're not logged in. The scripts can also read .wav -samples from any repository: Here's a sample.

You can use this tool to create your own sound effects, or small sound tracks. Without a track editor and midi input you have to notate that all into your code or use a separate tracker. The functions can be embedded into javascript programs or recorded into samples.

Stagas is planning to open source, and he's perhaps running second crowdsourcing funding for the milestone #2. I'd be already quite satisfied if the tool would get a decent track editor and midi input, perhaps some knobs. When wavepot was down for few days, I already thought about doing it myself.

How to use Wavepot

To use wavepot, you need to know how to code javascript. Perhaps need to know little bit about the upcoming ecmascript 6 -standard. The DSP scripts are plain javascript. If you know a little bit about digital audio synthesis, that's good too. The script must produce a dsp -function, like this:

export function dsp(t) {
    return Math.cos(t*Math.PI*2*440) * 0.5;

The above dsp is a 440Hz sine oscillator. The Math.PI*2 is π*2, also known as tau. It's multiplied with 0.5 to reduce the amplitude. What you write there depends on what you're doing, and how loud sound you want to produce. The t is time in seconds from the start of the track.

Wavepot's driver calls the dsp(t) to fill an audio frame. The driver roughly looks like this:

for (var i = 0; i < frame_length; i++) {
    var out = dsp(i / sampleRate + time);
    if (out instanceof Array) {
        left[i]  = clamp(out[0], -1, +1);
        right[i] = clamp(out[1], -1, +1);
    } else {
        left[i]  = clamp(out, -1, +1);
        right[i] = clamp(out, -1, +1);
time += frame_length / sampleRate;

Here's a longer example, that you can try out yourself:

var pi  = Math.PI;
var tau = 2*Math.PI;

import Biquad from 'opendsp/biquad';

var bq = new Biquad('lowpass');

export function dsp(t) {
  bq.cut(100 + 10000*(1+Math.cos(t*tau*0.1))).res(5.0).gain(1.0).update();
  var l = noise() * 0.1;
  var r = bq.run(l);
  return [r, r];

function noise() {
  return Math.random()*2 - 1;

The above program is driving noise through a biquad filter with oscillating cutoff frequency. The filter is instantiated outside the function because it encloses a bit of state. The .run() -method advances the filter, and stops working as intended if called more than once in the dsp -function.

Here's some other wavepot scripts I've written last week: