Hi. This is in the process of a major redesign. Take this with a grain of salt.


Polysporth. Polyphonic Sporth.

Polysporth is a ugen written for Sporth, designed to address some of the natural shortcomings of the Sporth language: polyphony, events, and abstraction. The source code can be found on github.

Polysporth is spawned from inside of Sporth as a ugen. From there, PolySporth is able to be controlled via Scheme (tinyscheme). Sporthlets can be toggled on and off, and they scheduled using a notelist interface that slightly resembles a Csound/Music V score. Meta-notes also exist, which allow scheme functions to be called instead of sporthlet voices. Contiguous sporthlets can be grouped together to form voice groups, which can used to implement an efficient means of polyphony.

PolySporth has access to many under-the-hood features of soundplumber, Sporth's sound engine based on Soundpipe. Coupled with the Scheme language, this allows for abstractions not possible with Sporth alone, such as procedural code generation, parameterized functions, and reusable code.


Nothing special. Polysporth is now included inside of Sporth, and can be called as a standard ugen.

A simple example

A typical polysporth instance has a Sporth file and a Scheme file.

The Sporth code calls Polysporth (call this file simple.sp):

 _in 1 zeros
 0 0 4 _in _out "simple.scm" ps
 0 4 _out ftsum

In the code above:

The Scheme code manages all the different chunks of Sporth code (call this file simple.scm):

 (define sine0 "60 mtof 0.2 sine")
 (define sine1 "64 mtof 0.2 sine")
 (define sine2 "67 mtof 0.2 sine")
 (ps-eval 0 sine0)
 (ps-eval 1 sine1)
 (ps-eval 2 sine2)
 (ps-turnon 0 -1)
 (ps-turnon 1 -1)
 (ps-turnon 2 -1)

In the code above:

Execute the code by running:

 sporth simple.sp

If all goes well, it will generate a 5-second audio file called "test.wav".

Less simple examples

The Polysporth folder in the Sporth source tree contains a small examples, each demonstrating a particular feature of Polysporth. At the moment, they are the closest thing to documentation:

Example 0: a trivial sine. sp | scm

Example 1: audio input. sp | scm

Example 2: Notelists and event blocks. sp | scm

Example 3: Metanotes. sp | scm

Example 4: Triggerable callback functions. sp | scm

Example 5: Using the SoundPlumber Lexer sp | scm

Example 6: Using tset from Polysporth sp | scm

Example 7: Using variables in Polysporth sp | scm

Example 8: Dynamic libraries in Polysporth sp | scm | c

Future plans

Future plans include: