SLOrk/2016/FAQ

From CCRMA Wiki
Jump to: navigation, search

FAQ and useful info for your SLOrk experience is here.

What's with the caps lock?

On SLOrk machines, the "caps lock" key is instead a(nother) control key. More control, less SHOUTING!

SLOrk Code Repository

We use SVN to save all SLOrk code, from the beginning of time. You'll put yours there too!

Each SLOrk laptop has a copy of this repository at /Users/slork/slork. The master repository is hosted at https://chuck-dev.stanford.edu/svn/slork/trunk.

To update everything in the SLOrk repository, simply open a terminal and type sup. This performs cd ~/slork && svn update, i.e. go to root of your SLOrk repository directory and update all. You can also update only certain directories by navigating to them in terminal, and then typing svn update.

ChucK: version and setup

We use ChucK 1.3.5.3-dev. This is conveniently available in our SVN repo (see above), and is installed on each laptop at ~/slork/bin/chuck

To test and fix a wrong chuck version:

albacore:slork slork$ which chuck
/usr/bin/chuck
albacore:slork slork$ ls -l /usr/bin/chuck 
-rwxr-xr-x  1 root  wheel  5229644 Apr 22  2015 /usr/bin/chuck

We don't want that one!

albacore:slork slork$ sudo rm /usr/bin/chuck
Password:
albacore:slork slork$ which chuck
/Users/slork/slork/bin/chuck

That's the right one!

albacore:slork slork$ cd ~/slork
albacore:slork slork$ sup
~/slork ~/slork
At revision 1891.
~/slork

Now let's double-check that we have the right version.

albacore:slork slork$ chuck --about
usage: chuck --[options|commands] [+-=^] file1 file2 file3 ...
   [options] = halt|loop|audio|silent|dump|nodump|server|about|probe|
               channels:<N>|out:<N>|in:<N>|dac:<N>|adc:<N>|
               srate:<N>|bufsize:<N>|bufnum:<N>|shell|empty|
               remote:<hostname>|port:<N>|verbose:<N>|level:<N>|
               callback|deprecate:{stop|warn|ignore}|
               chugin-load:{auto|off}|chugin-path:<path>|chugin:<name>
   [commands] = add|remove|replace|remove.all|status|time|kill
   [+-=^] = shortcuts for add, remove, replace, status  

chuck version: 1.3.5.3-dev (chimera)
   mac os x : intel : 64-bit
   http://chuck.cs.princeton.edu/
   http://chuck.stanford.edu/

Success!


Sound through MOTUs

We have MOTU UltraLite mk3 and older MOTU UltraLite (version 1). Plug one into each laptop with a Firewire 400 to Firewire 800 cable.

Output numbering is confusing because there are two “Main” outputs in addition to the 8 "analog out" aka "out" jacks. Software sees this:

Software output channel MOTU output jack
1-2 Main outs (left, right)
3-10 Outs "1" through "8" (all are actually off by 2)
11-12 S/PDIF digital outputs
13-14 Headphones (though settings can change what exactly feeds the headphones)

Master Volume

The MOTUs have a master volume feature that can attenuate all outputs by a given number of dB between -80 and 0 (or also MUTE, which is minus infinity dBs).

On the MOTU UltraLite mk3, the knob directly above the headphone jack (third knob from the left) toggles between controlling the “Phones” (headphones) or the “MASTER”. Press the button to switch which it controls.

On the original UltraLite mk1, the upper left knob labeled “MAIN VOL” controls the master volume, which (sometimes? by default? depending on nondeterministic CueMix settings?) doesn’t affect the MAIN OUTs, only the OUT. In other words, for our purposes, it affects outputs 3-6 but not 1-2. That’s why we normally use only the mk3s but if you need to use a mk1 (e.g., because you need to daisy-chain FW400 to get >8 audio inputs) ask Ge to help configure this.

Sound through Hemis

The “Hemis” are the hemispherical loudspeakers, pictured below.

Power it with a black DC power adapter. Flip the power switch up for on. Some have slightly mechanically flaky power switches.

Use a blue SLOrk snake to plug in six input signals. The two ends of the snake have different diameter metal plugs: the fat ones fit only the speaker side and are too fat to plug into the MOTU side. So, plug the skinny side into the MOTU and the fat side into the hemi.

Channel 1 is the input closest to the switch, then going 2, 3, 4, 5, 6 to the left. These correspond to the loudspeakers as per the picture below.

SpeakerSetup.jpg

How do I set up ChucK to use 6 channels?

ChucK, by default, might run in stereo mode. That means the dac has 2 output channels.

To run with 6 channels using ChucK in commandline, you should invoke your program with the -c argument. For example, chuck myInstrument.ck -c6 for 6 channels.

If you're using miniAudicle, you can explicitly tell miniAudicle use 6 channels by going to miniAudicle > Preferences (or use the keyboard shortcut ⌘,), and selecting 6 output channels. (Note that you'll have to restart the virtual machine for this change to take effect.)

How do I program my ChucK code to use those 6 channels?

You have individual access to each output channel via dac.chan(i), where i is the zero-indexed channel number (i.e. 0, 1, 2, 3, 4, 5). How you want to address these individual channels is up to you. Maybe you want some elements to play through all speakers at the same time; then you would just chuck the element to each channel of the dac. Maybe you want to have have it go to only one specific channel; then you would just setup your patch to output to that channel (e.g. SinOsc foo => dac.chan(0); to only output to the first channel).

However, you could also do more interesting things! What if I have one ugen, and I want to send it to different individual channels? I could have an array of gains for each channel, and "turn on" and "turn off" individual channels via their gains (0 for off, nonzero for on). The toy example code below implements this.

// ChucK function demonstrating a single sine wave fed alternately through each speaker, via a gain array.

6 => int N; // Number of channels we expect.

// Sanity check -- do we actually see 6 channels?
if( N > dac.channels() )
{
    // error
    <<< "dac has less than the requested number of channels...", "" >>>;
    <<< "   (try starting chuck/miniAudicle with more output channels?)", "" >>>;
    me.exit();
}
// print
<<< "Using", N, "channels" >>>;

SinOsc foo => blackhole; // Get the sinosc running
Gain g[N]; // Instantiate an array of gains for each channel

// connect to individual channels through individual gains
for( int i; i < N; i++ )
{
    0.0 => g[i].gain; // start gains at 0
    foo => g[i] => dac.chan(i); // this is the signal flow for each channel
}


while(true){
    for( int i; i < N; i++ )
    {
        // Set all gains to 0
        for( int j; j < N; j++ )
        {
            0.0 => g[j].gain;
        }
        // Short silence
        100::ms=>now;

        // Set one channel's gain to nonzero (i.e. turn on one channel)
        0.15 => g[i].gain;

        // run for half a second
        500::ms => now;
    }
}

Have a single file that works in both 2 and 6 (or any) channels!

You're probably hacking on your laptop (with 2 channels of output), but will ultimately perform on hemis (6 channels). It's annoying to have different files for those different scenarios.

The solution: have your code work for N channels, and have it detect what value of N (e.g. 2, 6) your dac sees. You could do that via the below snippet:

// ChucK code for automatic channel number detection
dac.channels() => int N;

// print
<<< "Using", N, "channels" >>>;