Hi! This is an abandoned project. Feel free to look around. Some things may work (I've tried to keep it that way)! Other things may not.
Polysporth
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.
Installation
Nothing special anymore. 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):
4 _out "simple.scm" ps
0 4 _out ftsum
In the code above:
- ps instantiates Polysporth, taking in the following arguments max voices, output table (generated by polysporth), scheme filename
- ftsum takes the output table of polysporth and sums them together. This mixes all the individual sporthlet voices together.
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:
- define creates three sporth strings, each containing a sine wave generator of a particular frequency
- ps-eval evaluates the sporth code into sporthlet voice N.
- ps-turnon turns on sporthlet voice N. The -1 parameter turns them on indefinitely.
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
There are no future plans. Feel free to hack on this project any way you wish.