Soundpipe

Soundpipe is a lightweight music DSP library for musicians and creative coders. It exists to bring beautiful sounds to your projects. The Soundpipe library is built up of over 100 (and counting!) high quality modules. These modules can be combined together to build unique sounds.

Features:

The source code for Soundpipe can be found on sourcehut.

Using Soundpipe

The Soundpipe library is simple and straight forward to use. Every Soundpipe module has documentation with at least one short C example. By default, the only library Soundpipe needs is libsndfile, and compiles to a single static library, making it ideal for embedding.

Soundpipe is built so that it is easy to extend and hack on. It is easy to add and take away modules in Soundpipe for specific project needs.

Here is a example of Soundpipe code. In this example, a 5-second 500hz sine wave (generated via a table lookup oscillator) is written to disk:

 #include <stdlib.h>
 #include <stdio.h>
 #include <time.h>
 #include "soundpipe.h"
 
 typedef struct {
     sp_osc *osc;
     sp_ftbl *ft;
 } UserData;
 
 void write_osc(sp_data *sp, void *udata) {
     UserData *ud = udata;
     sp_osc_compute(data, udp->osc, NULL, &sp->out[0]);
 }
 
 int main() {
     UserData ud;
     sp_data *sp;
     sp_create(&sp);
     sp_ftbl_create(sp, &ud.ft, 2048);
     sp_osc_create(&ud.osc);
 
     sp_gen_sine(sp, ud.ft);
     sp_osc_init(sp, ud.osc, ud.ft);
     ud.osc->freq = 500;
     sp->len = 44100 * 5;
     sp_process(sp, &ud, write_osc);
 
     sp_ftbl_destroy(&ud.ft);
     sp_osc_destroy(&ud.osc);
     sp_destroy(&sp);
     return 0;
 }

The Soundpipe Model

Soundpipe is callback driven. Every time Soundpipe needs a frame, it will call upon a single function specified by the user. Soundpipe modules are designed to process a signal one sample at a time. Every module follows the same life cycle:

  1. Create: Memory is allocated for the data struct.
  2. Initialize: Buffers are allocated, and initial variables and constants are set.
  3. Compute: the module takes in inputs (if applicable), and generates a single sample of output.
  4. Destroy: All memory allocated is freed.

Documentation

Online documentation for Soundpipe can be found here

If you have lua installed on your computer, you can generate the current html documentation for soundpipe by running "make docs". A folder called "docs" will be created. The top page for the documentation is docs/index.html.


Projects

Home