Sponc, a multi-touch aware GPL game which can be retrieved on libavg's git repository mtc-sponc , can now handle audio.

Audio on Sponc relies on Supercollider 3 ( http://supercollider.sf.net ), using Pkaudio ( http://trac2.assembla.com/pkaudio ) as a convenient gateway interface.

Installation

Installation is straightforward but is not like a "click&install package":

pkaudio

Pkaudio is a bundle of interfaces that makes easy to get music-oriented environment working seamlessly. We are mainly interested in supercollider part.

Brief todo:

  • Checkout the svn version of pkaudio
  • Install needed portions of the package

Checkout and install

1 $ svn co http://svn2.assembla.com/svn/pkaudio
2 $ cd pkaudio
3 $ sudo python setup_scosc.py install

(!) Note: (!)
This guide has been tested against revision 3 of pkaudio

Supercollider

Supercollider is one of the most advanced rt and non-rt synthesis framework. It's divided into two parts:

  • sclang or the interpreter (a 'friendly' smalltalkish interface)
  • scsynth or the audio worker (which speaks in OSC, Open Sound Control)

Basically we need only the latter to be run (some glitches with linux due to sound library compatibility, very simple on OSX)

Brief todo:

  • Download (and eventually install) Supercollider
  • Start the scsynth server by hand or prepare an automated script for that purpose

Download and install

The full procedure for linux setup can be found here: Supercollider_On_Linux, additional help can be found here this hint: http://swiki.hfbk-hamburg.de:8888/MusicTechnology/847

MacOSX package is ready after a simple extraction from the installation DMG, which can be retrieved here: http://sourceforge.net/project/showfiles.php?group_id=54622&package_id=51508&release_id=577995

Sources can be retrieved here: http://sourceforge.net/project/showfiles.php?group_id=54622&package_id=246937&release_id=577996

Run scsynth

MacOSX: Just start supercollider.app and click on 'Boot' button on the 'localhost' server. If you want to to that by console, try this:

1 $ cd /path/to/SC3
2 $ ./scsynth -u 57110 -b 1026

Linux: a good intro can be found here http://wiki.eeeuser.com/howto:installingsupercollider

If you experience problems with Jackd on Ubuntu, try to use portaudio (compiling sc from source)

Running

Whenever you have completed those tasks, you can simply fire up the application: it will catch the availability of the framework and use it.

Troubleshooting

AUDIO: Audio subsystem not available

This means that something is wrong with pkaudio, check if the installer placed scosc and scsynth on a PYTHON_PATH directory

AUDIO: Audio subsystem available but server is not responding. Disabling audio

This time the audio subsystem cannot send commands to Supercollider which is expected to be found on localhost at port 57110/UDP. Double check if scsynth is running.

SC SynthDefs

Whoever would take care of getting SynthDefs? running by hand or tweak them, here come the sources:

 1 (
 2 SynthDef("simpleAnalog", {
 3     arg gate = 0, lfoFreq = 2, lfoAmt = 0, baseFreq = 139, osc2Shift = 1, aAttack = 0.001, aDecay = 0.5, aSustain = 0.1, aRelease = 2, fAttack = 0.001, fDecay = 0.5, fSustain = 0.1, fRelease = 0.1, fEnvAmt = 0, fCutoff = 300, fReso = 0.1, fKTrack = 1, xpos = 0, ypos = 0;
 4     var oscFreqAdd, vco1, vco2, aEnv, aAmp, oscStage, filterStage, ampStage, outStage, fEnv, fFreqEnv;
 5
 6     // LFO/FM
 7     oscFreqAdd = LFTri.kr(lfoFreq, 0, lfoAmt);
 8
 9     // OSC STAGE
10     vco1 = Pulse.ar(baseFreq + oscFreqAdd, 0.3);
11     vco2 = Pulse.ar(baseFreq + osc2Shift + oscFreqAdd, 0.3, 0.8);
12     oscStage = vco1+vco2;
13
14     // FILTER STAGE
15     //fCutoff = MouseX.kr(0,1000);
16     //fReso = MouseY.kr(0.01, 1);
17     fEnv = Env.adsr(fAttack, fDecay, fSustain, fRelease);
18     fFreqEnv = EnvGen.kr(fEnv, gate, fEnvAmt);
19     filterStage = Resonz.ar(oscStage, baseFreq + fCutoff, fReso);
20
21     // AMPLITUDE ENVELOPE
22     aEnv = Env.adsr(aAttack, aDecay, aSustain, aRelease);
23     aAmp = EnvGen.kr(aEnv, gate);
24     ampStage = aAmp * filterStage;
25
26     // OUTPUT
27     Out.ar(0, Pan4.ar(ampStage, xpos, ypos, 1 ));
28  }).writeDefFile;
29
30 s.sendSynthDef("simpleAnalog");
31
32 (
33 SynthDef("QuadraPlayer",{
34     arg xpos=0,ypos=0, bufnum=0, loop=0;
35     var playbuf;
36     playbuf = PlayBuf.ar(1, bufnum, BufRateScale.kr(bufnum), 0, 0, loop);
37     FreeSelfWhenDone.kr(playbuf);
38     Out.ar(0,
39                 Pan4.ar(playbuf, xpos, ypos, 0.45 )
40        )
41 }).writeDefFile;
42
43 s.sendSynthDef("QuadraPlayer");
44 )
45
46 (
47 SynthDef("StereoPlayer",{
48     arg xpos=0, bufnum=0;
49     var playbuf;
50     playbuf = PlayBuf.ar(1,bufnum, BufRateScale.kr(bufnum));
51     FreeSelfWhenDone.kr(playbuf);
52
53     Out.ar(0,
54         Pan2.ar(playbuf, xpos, 0.9 )
55     )
56 }).writeDefFile;
57
58 s.sendSynthDef("StereoPlayer");
59 )