Node.js SuperCollider audio generation web app
Table of Contents generated with DocToc
Node.js based web application to create audio files for SuperCollider, with SoundCloud integration.
Thanks to the following people for feedback, suggestions, technical insight and sanity checks. In alphabetical order -
export NODE_PATH=/usr/local/lib/node_modules
src/config.js
USAGE node supercollider.js [CONFIG FILE] [PORT]
node supercollider.js config.js 8080
npm install forever
forever start supercollider.js [CONFIG FILE] [PORT]
.
forever start supercollider.js config.js 8080
NOTE - The code is very early in development and is not safe to run on any public web server as it could expose your server to security/hacks.
The application wraps SuperCollider code submitted into a Task.
If the SuperCollider code uses Tasks or Routines, it would need to compatible with being run within a Task.
Else, you will get an error message that is not very informative, specifically ERROR: syntax error, unexpected '(', expecting '}'
Examples
ERROR: syntax error, unexpected '(', expecting '}'
{
SynthDef(\test, {
var st = SinOsc.ar();
Out.ar(0,st!2);
}).add;
s.sync;
Synth(\test);
}.fork
;
at the end. The code below works:
{
SynthDef(\test, {
var st = SinOsc.ar();
Out.ar(0,st!2);
}).add;
s.sync;
Synth(\test);
}.fork
;
As a reference, the resulting code the application sends to SCLang (SuperCollider) is more or less
s.waitForBoot({
Task.new ({
s.sync;
s.record(~path);
//---- START - inserted by server ----
SynthDef(\test, {
var st = SinOsc.ar();
Out.ar(0,st!2);
}).add;
s.sync;
Synth(\test);
//---- END - inserted by server ----
(~length).wait;
s.stopRecording;
2.wait;
s.quit;
0.exit;
}).play;
});