Config Programming

       A "config" is a file that contains plain-text data intended to be read-in by WhiteCap. Configs contain a non-ordered list of named strings, similar to a Windows INI file and can be viewed or edited by using any text editor. Depending on the role a config file is intended to play, WhiteCap looks for specifically named items and uses them in accordance with the role of that config. For example, when a WaveShape config defines a string named "Pen", it's understood that the string paired to it defines how darkly lines are drawn. If you want to learn the config file syntax, it will help to have some familiarity with programming and/or script writing. Many users submit their configs so that they can be redistributed—over half of the configs that come with G-Force and WhiteCap were made by users just like you.

Syntax

The config file syntax is straightforward and is nothing more than a flat, non-ordered, list of key-value pairs (ie, a dictionary). It's an ASCII plain-text file (ie, not any other kind of file, such as an RTF file), with 1 to 4 character case-sensitive "key" identifiers followed by an equal sign, followed by the key's value. If the value isn't a number (a leading '-' and/or '.' is ok), then it should be in quotes. All whitespace outside of quotes is ignored, and both kinds of C-style comments are processed. An example of valid syntax:

X0=".5 + sin( .3 * t )"          // This is a comment
Y0="123"
Pen=.8
Ans=-42
ALFA="1 / exp( c1 ^ 2 )"      /* This is another comment */
Vers=260

 

Submitting Your Configs

If you'd like a config you made yourself to permanently become part of WhiteCap, please contact us. From there, it'll be evaluated and checked for possible problems or faults. If you choose to redistribute your configs on your own and do something hazardous in them, you may cause other versions of WhiteCap to crash or have other problems. Further, sending in your configs centralizes the entire process, guaranteeing your work to appear as soon as possible.

Documented Configs

Below is a list of configs included with WhiteCap that are documented (try using a file search in your OS to find them). In other words, if you open a config file in a text editor or word processor, then you'll find information that will allow you to make and edit your own configs. Try looking at them in order listed, and be aware that many other configs contain documentation/comments added by the author that created them. If you see a config in WhiteCap you really like, don't be afraid to open it in order to see how it's doing it.

  1. WhiteCap/Configs/ArcticFox Memories.txt
  2. WhiteCap/Configs/Musical Lens Flare.txt

Be Patient

Don't get discouraged if the math seems like a lot. It's simply a matter of experience and it'll come much easier with just a little time—like riding a bike. As you explore existing configs, you may want to try using a graphing calculator to help see how a certain equations behave. A common way to learn config programming is to alter existing configs and observe the effects of your changes.

Testing Your Configs

When you're ready to test your config, you have to tell WhiteCap to load a fresh copy it from the disk. Otherwise, if you switch to a config you've been editing, WhiteCap won't load your changes (because it's using a cached copy). The 'U' key will reload the currently displayed configs. In other words, when you save changes to a config, press 'U' to make WhiteCap load a fresh copy from disk.

 

 

Config/Language Reference

 

Common
(All angles are in radians)

abs() absolute value
exp() e to the x
log() natural logarithm
sqr() square
sqrt() square root
sin() sine
cos() cosine
tan() tangent
asin() arcsine (-PI/2 to PI/2)
acos() arccosine (0 to PI)
atan() arctangent (-PI/2 to PI/2)
atan2() arctangent (0 to PI)
 

Logical/Discrete

pos(x) x if x > 0 and 0 otherwise
sgn(x) 1 if x > 0 and -1 otherwise
clip(x) 0 when x < 0, 1 when x > 1, and x when 0 <= x <= 1
sqwv(x) 1 if abs(x) <= 1.0 and 0 otherwise
 

Miscellaneous

rnd(x) a random real number from 0 to x
trnc(x) everything to the right of the decimal point in x is dropped
flor(x) the largest integer that is also less than x (ex, flor(3.2) == 3, flor(-2.7) == -3 )
wrap(x) x - flor( x ) (ex: wrap( .3 ) == .3, wrap( 4.12 ) == .12, wrap( - 2.7 ) == .3 )
flip(x) sawtooth that passes thru ...(-3, -1), (-1, 1), (-1, -1), (1,1), (1, -1), ...
trwv(x) triangle-shaped wave that passes through (0,0), (1,1), (2,0) and repeats in both directions along the x axis
seed(x) seeds the random number generator based on the bits of x, returns x
 

Operators

+ - Add/Subtract
* / Multiply/Divide
% Modulo or "the integer remainder when A is divided by B" (ex, 8 % 4 == 0, 11 % 3 == 2)
^ raised to the power
 

Audio Access

fft() Accesses the frequency transform/spectrum of the current audio
BASS A single scalar value that approximates the overall beat
 

Globals

PI
3.141592653
NUM_S_STEPS
The number of times the X, Y, and C expressions are evaluated per sample (ie, per frame)
NUM_FFT_BINS
The number of bins/resolution composing fft()