Chorth
What do you get when you combine the powers of Sporth and Chuck together? You get Chorth.
Chorth is a Chugin that uses the Sporth API to seamlessy run Sporth code inside of Chuck.
Sporth is a much needed supplement for ChucK. Just as a good cook uses only the finest ingredients, a computer music composer should always seek out the best sounds to use. Unfortunately, compared to other musical languages like Csound and Supercollider, ChucK comes with a very limited base set of Unit Generators. Despite it's easy to use syntax, strongly-timed design, and potential for live coding, choosing ChucK used to mean a significant handicap for sound design. With Chorth, this no longer has to be the case.
Sporth is a domain specfic audio language that allows one to concisely define
complex sounds in a way that is difficult or impossible to do in ChucK code.
The Sporth collection has dozens of high quality unit generators ported
from Csound and Faust, as well as a handful of modules and micro-languages truly unique to Sporth.
Because it uses the Soundpipe DSP library, there is the potential
for many many more unit generators to come.
There is no significant overhead when running Sporth code inside of ChucK. In fact, even inside of ChucK, some unit generators in Sporth outperform their native ChucK equivalents.
Installation
For now, Chorth is Linux only (OSX coming very soon!). Be sure to have installed the latest and greatest of Sporth and Soundpipe (dev branch) before proceeding.
Chorth is located in the Sporth source code. Navigate to the directory called "chorth" and run:
make linux
sudo make install
Now, update the linker with:
sudo ldconfig
A trivial example
Here is a short and boring example of Chorth in action:
Sporth s => dac;
s.parse("440 0.5 sine");
10::second => now;
In this example, a Sporth object is being sent to dac, and then a string is
parsed with the parse method, creating a 440Hz sine that lasts for 10 seconds.
P-Registers
Audio rate information can be sent to and from Sporth with the use of so-called p-registers using 'pset' and 'pget' in Chorth, and 'p' and 'pset' in Sporth. Sporth has a total of 16 registers that can be accessed as zero-indexed array indices.
This example below takes signal from the SndBuf unit generator in ChucK, and processes it through a moog ladder filter in Sporth via p-register 0.
Sporth s => dac;
SndBuf snd => blackhole;
snd.read("oneart.wav");
s.parse("0 p 300 0.5 moogladder");
while(1) {
s.pset(0, snd.last());
1::samp => now;
}
Multi-channel output
P-Registers can also be used to have Sporth communicate with Chuck. This example, for instance, uses Step unit generators and pget to get stereo reverb out of Sporth (ChucK doesnt even have a stereo reverb by default, let alone one with a controllable size parameter!):
Sporth s => blackhole;
Step outL => dac.left;
Step outR => dac.right;
s.parse("
'piano.wav'
diskin dup 0.97 10000 revsc
0 pset 1 pset
0
");
while(1) {
s.pget(0) => outL.next;
s.pget(1) => outR.next;
1::samp => now;
}
Note that even though Sporth is being chucked into a blackhole, it is still necessary to push something onto the stack everytime, even if that thing is 0.
Projects