ChucK : Programming Guide

Command-line Options

version: 1.5.x.x (chai)



chuck command-line options:
chuck --[options|commands] [+-=^] file1 file2 file3 ...
   [options] = halt|loop|audio|silent|dump|nodump|about|probe
               channels:<N>|out:<N>|in:<N>|dac:<N>|adc:<N>|driver:<name>
               srate:<N>|bufsize:<N>|bufnum:<N>|shell|empty
               remote:<hostname>|port:<N>|log:<N>|level:<N>
               callback|deprecate:{stop|warn|ignore}|chugin-probe
               chugin-load:{auto|off}|chugin-path:<path>|chugin:<name>
               color:{on|off}|pid-file:<path>|--cmd-listener:{on|off}
   [commands] = add|remove|replace|remove.all|status|time
                clear.vm|reset.id|abort.shred|exit
       [+-=^] = shortcuts for add, remove, replace, status

(run 'chuck --about' to print the above information)


DESCRIPTION

[source ChucK files]:
ChucK can run one or more programs in parallel. The programmer only needs to specify a list of programs on the command line, and chuck will compile and run them all concurrently in the VM. Each input source file (.ck suffix) will be run as a separate 'shred' (strongly-timed ChucK process) in the VM. They can 'spork' additional shreds and interact with existing shreds. Due to the ChucK timing mechanism, shreds don't necessarily need to know about each other in order to be precisely 'shreduled' in time - they only need to attend to their own behavior with respect with time. For example:

 %> chuck file1.ck file2.ck file3.ck

Addtionally, shreds can be added/removed/replaced manually at run-time, using on-the-fly programming commands (skip ahead!).


[options]:

--about / --help
prints ChucK usage message, with the ChucK URL.

--version
prints version information.

--halt / -h
(on by default) - sets the vm to halt and exit if there are no more shreds in the VM.

--loop / -l
sets the ChucK VM to continue executing even if there no shreds currently in the VM. This effectively runs a local "chuck server" allowing shreds to be added/remove/replaced on-the-fly from a second terminal window or from a different machine. Note it is perfectly valid to specify this option without any input files. For example:
 %> chuck --loop

the above will 'time-loop' the VM, waiting for incoming shreds.

--audio / -a
(on by default) - enable real-time audio output

--silent / -s

disables real-time audio output - computations in the VM is not changed, except that the actual timing is no longer clocked by real-time audio. Timing manipulations (such as operations on 'now') still function logically in full. This is useful for rendering audio to file. Also, it can be handy for running a non-audio program.

--log(N) / --verbose(N) / -v(N)
sets the report level to (N). 0 is none, 10 is all, default is 1. Set higher levels to see more detailed information regarding ChucK’s internal operation.

--srate(N)
sets the internal sample rate to (N) Hz. by default, ChucK runs at 44100Hz on macOS and Windows, and 48000Hz on linux/ALSA. even if the VM is running in --silent mode, the sample rate is still used by some unit generaters to compute audio, this is important for computing samples and writing to file. Not all sample rates are supported by all devices.

--bufsize(N)
sets the internal audio buffer size to (N) sample frames. larger buffer size often reduce audio artifacts due to system/program timing. smaller buffers reduce audio latency. The default is 512. If (N) is not a power of 2, the next power of 2 larger than (N) is used. For example:

 %> chuck --bufsize:950

this will implicitly set the buffer size to 1024.

--driver(name)
Choose a specific driver to use by name. Drivers tend to be platform-specific between Linux (ALSA, Pulse, Jack), Windows (DirectSound, WASPI, ASIO), and macOS (CoreAudio).

--dac(N)
opens audio output device #(N) for real-time audio. by default, (N) is 0.

--adc(N)
opens audio input device #(N) for real-time audio input. by default, (N) is 0.

--channels(N) / -c(N)
opens (N) number of input and output channels on the audio device. by default, (N) is 2.

--in(N) / -i(N)
opens (N) number of input channels on the audio device. by default (N) is 2.

--out(N) / -o(N)
opens (N) number of output channels on the audio device. by default (N) is 2.

--remote(hostname) / @(hostname)
sets the hostname to connect to if accompanied by the on-the-fly programming commands.
(host) can be name or ip of the host. default is 127.0.0.1 (localhost).

--port(N) / -p(N)
sets the port to listen on if not used with on-the-fly programming commands.
sets the port to connect to if used with on-the-fly programming commands.

--probe
probes the system for all audio devices and MIDI devices, and prints them.

--chugin-probe
probes your system for chugins, and verify chugin versions between chugins and the host. Also see: --chugin-path for default chugins search paths.

--chugin-load:{auto|off}
(default: auto) specifies whether ChucK should automatically load ChuGins (auto) or disable ChuGin loading (off).

--chugin-path:(path)/-G(path)
adds (path) to the list of paths searched for ChuGin to load. Any file ending in .chug (chugins) and .ck (chuck files to pre-load) in the ChuGin path are loaded when chuck is run. Each platform has its default chugins search paths:
macOS
  /usr/local/lib/chuck
  /Library/Application Support/ChucK/chugins
  ~/Library/Application Support/ChucK/chugins
  ~/.chuck/lib

Linux 
  /usr/local/lib/chuck
  ~/.chuck/lib

Windows
  C:\Windows\system32\ChucK
  C:\Program Files\ChucK\chugins
  C:\Program Files (x86)\ChucK\chugins
  C:\Users\%USERNAME%\Documents\ChucK\chugins

--chugin:(filename)/-g(filename)
loads a specific ChuGin at the location specified by (filename). This can be used to load ChuGins not in the default list of paths (see --chugin-path).

--color:{on|off}
specifies whether chuck should output ANSI color codes for TTY terminal. (See example)

--no-color
disables ANSI color codes for TTY terminal; same as --color:off

--pid-file:(filename)
if this flag is specified with argument, chuck will attempt to write its process ID to the given file upon startup, and then remove that file upon shutdown. This assists external process supervision (through tools like monit,etc) for long-running installations that need auto-rebooting, instant kill switches for live performances, and other programmatic external process control.

--cmd-listener:{on|off}
specifies whether chuck should listen for incoming OTF commands (e.g., add, replace, remove, etc.).

--no-cmd-listener
disables listening for incoming OTF commands; same as --cmd-listener:off

--callback
utilizes a callback system for real-time audio (default).

--blocking (no longer available)
utilizes blocking behavior for real-time audio.

--deprecate:{stop|warn|ignore} (default: warn) specifies how to handle deprecated classes, UGens, and functions. "stop" will cause a program to not compile if it uses any deprecated features. "warn" will issue a warning. "ignore" will cause the program to compile normally without complaint. For example, $ chuck --deprecate:stop file.ck will cause chuck to stop compilation if file.ck uses any deprecated features.

--dump / +d
dumps the virtual instructions emitted to the console (stderr), for all the files after this flag on the command line, until a 'nodump' is encountered (see below). For example:

 %> chuck foo.ck +d bar.ck

this command will dump the virtual ChucK instructions for bar.ck (only), with argument values, to the console. --dump can be used in conjunction with --nodump to selectively dump files.

--nodump / -d
(this is the default) ceases the dumping of virtual instructions for files that comes after this flag on the command line, until a "dump" is encountered (see above). For example:

 %> chuck +d foo.ck -d bar.ck +d doo.ck

will dump foo.ck, then doo.ck — but not bar.ck.

These are useful internally for debugging ChucK itself. Or if one is curious about what the ChucK virtual machine.

--shell
runs chuck in interactive (shell) mode. Can dymically run code specified within { }, for example:

 chuck %> { <<< "hello there" >>>; } 

For the origins of ChucK shell, see this 2006 paper.


(from here, we go to)
On-the-fly Programming Commands

(or return to the)
Documentation Home


chuck | soundlab | cs | music | ccrma