Some basics
about CSL command and configuration files/Keating
CSL works in terms of commands. For classes and some common tasks,
certain commands may be pre-programmed for users. But if you want to do
anything the least bit different from what is already set up, you must
understand how CSL uses commands.
-
CSL commands
-
CSL macro or command files (filename.cmd)
-
CSL key files (filename.key)
-
CSL configuration files (filename.cfg)
-
Two sample .key files that bypass cmd files
-
My cfg file "pk1tr.cfg"
1. CSL commands
Commands either perform operations, or SET parameters/options of operations.
Forms of command:
i) command (source) location1 (location2)
command = the operation (using all parameters as currently set)
source = where to find the thing to do it to (which window), if not the
default (remember, the active window is where you want
the results of the operation dumped
location = where in the source (at the cursor, at some time value, ...)
If two locations are given, they define a range the whole of which is used
P. 65 of the manual has an important list of representations for locations
(whole: 0 *; displayed: < >; between marks: m1 m2;
between tags: tn tm; at cursor: =)
Examples:
ENERGY a m1 m2 (puts into the active window the energy,
according to current settings, of signal between marks in A)
SPG A T1 T2 (puts into the active window a spectrogram,
according to current settings, of signal between tags in A)
FMT A < > (puts into the active window a formant history,
according to current settings, of signal now displayed in A)
RUN FILENAME (runs a file such as a .cmd, .cfg, or. key
file)
ii) set parameter newvalue
set = this word begins a "set" command
parameter = what you want to set (a parameter of some command)
newvalue = the value to give to that parameter
Examples:
SET SPK.REPEAT SINGLE (causes
"play" functions to play only once)
SET DIRECTORY C:\USERS\104 (sets directory in which files
to be loaded are to be found)
SET LPC.ORDER 14 (sets the number of LPC coefficients
to 14)
Commands can be executed by menu selection, or by typing on the command
line, (you do not have to type space bar before typing a command, but Kay
recommends doing so to avoid possible conflicts with defined key functions),
or by running a command file.
-
The form of the last-executed command is displayed by backspace.
This lets you get the exact form for any command you use. "Using commands"
in the manual gives the commands associated with various functions, and
"Reference: commands" gives complete information about each command.
[Back to Top]
2. CSL macro or command files (filename.cmd)
A macro or command file contains and executes one or more CSL commands
(if more than one, then executed in the order listed), thus at least saving
you some typing and possibly automating some procedure you use repeatedly.
Commands can be put on separate lines, or strung together separated by
semi-colons.
-
p. 38 and pp. 83-5 of the CSL manual give the macros Kay provides
-
A file named filename.cmd can be executed by typing "run filename" as a
command, or by assigning it to a key (see below).
Example: A file named "load.cmd" which prompts for a new
file for window A:
use a;purge a;ldspl
(activates window A, deletes its current contents;
executes "load" command -- which will then prompt for a filename in the
currently-specified directory)
How to make a command file:
-
Find someone else's command file that nearly does what you want and modify
it using any text editor (e.g. Edit in DOS).
-
Record a macro using the Macro-Record menu. This works well when you have
just worked out an efficient sequence of menu selections for some job.
It is also a good way to learn about the contents of command files, because
you know perfectly well what the sequence is supposed to be doing. The
Record function does not record color changes, however; you have to edit
the resulting file in a separate step.
-
Type your commands directly into a file that you create using any text
editor. For beginners, this works well only for short macros.
Sample command file from Ling. 104:
use a; purge a (activates A and deletes current contents)
ldspl; ldflt lp50%.flt; fltr a 0 *; ds a 0 * 8000 (execute
load command; load the named filter apply it to the entire signal in a;
downsample entire signal in a to 8000 Hz SR)
use b; purge b (activates window B, deletes current
contents)
set spg.length 50 (sets window length for spectrogram
to 50 samples (wider BW))
spg ? < > (performs spectrogram on currently-displayed
source signal)
link a (links cursor in B to cursor in A)
use b; set color 1 (activates window B and sets pen
color to "1")
set fmt.order 10 (# coefficients for Formant History
set to 10)
fmt ? < > (perform Formant History on currently-displayed
source signal)
link a (links cursor in B to cursor in A)
use c (activates window C)
set lpc.order 14 (# coefficients for LPC set to 14)
set color 3 (pen color set to "3")
lpc a = (perform LPC on signal at cursor in A)
[Back to Top]
3. CSL key files (filename.key)
-
Functions are assigned to the keys of the keyboard by key files. CSL includes
a default file, csl.key, whose assignments are indicated by the plastic
overlay for the function keys and are listed on p. 39 of the CSL manual.
These assignments can be modified or supplemented by the user by single
key assignments or by running a different key file. (These assignments
are internal to CSL and are independent of the fact that some of our computer
keyboards can be programmed.)
-
Assign a key on the fly: press the "insert" key, type the key to
be defined, then enter the command (a single command, or the name of a
command file) to be assigned to that key.
-
filename.key files contain sets of key definitions. Each such definition
is one or more commands and can even consist of a call to a command file.
Put either one tab OR one space between the two parts of each line. Use
quotes around defs.
-
The mouse buttons can also be defined but I have never done this.
See manual p. 77.
The key file from a 104 class:
It takes
the precaution of defining keys in both upper and lower case.
DEFINE [F5] "RUN 104LOAD.CMD"
DEFINE M "USE A;SHOW M1 M2"
DEFINE m "USE A;SHOW M1 M2"
DEFINE A "USE A; SHOW 0 *"
DEFINE a "USE A; SHOW 0 *"
DEFINE 1 "RUN SPECTR2.CMD"
DEFINE 2 "RUN SPECTR1.CMD"
DEFINE 3 "RUN FMT10.CMD"
DEFINE 5 "RUN FMT12.CMD"
DEFINE 7 "RUN FMT14.CMD"
DEFINE 4 "RUN LPC10.CMD"
DEFINE 6 "RUN LPC12.CMD"
DEFINE 8 "RUN LPC14.CMD"
DEFINE F "RUN FFT.CMD"
DEFINE f "RUN FFT.CMD"
DEFINE P "USE D; PURGE D; PITCH A < >; LINK A"
DEFINE p "USE D; PURGE D: PITCH A < >; LINK A"
[Back to Top]
4. CSL configuration files (filename.cfg)
-
Cfg files control what the screen display looks like, (indirectly) what
the computer keys do, and how all the options of all the commands are set.
Cfg files are command files consisting mostly of dozens of SET PARAMETER
commands. CSL comes with a default (called csl.cfg, listed in Appendix
D of the manual), which you should NEVER touch. It also comes with a separate
usercsl.cfg,
which is kept in the Library subdirectory, and this you may touch, as follows.
-
Suppose you have set up everything the way you want it for some task. This
includes the view screens, the key definitions, and the command settings.
First select System-Save User Setup from the CSL menu to save all the current
settings into usercsl.cfg. Then exit CSL into your own directory, and type
>copy c:\csl50\lib\usercsl.cfg newname.cfg
-
Then whenever you start CSL you can type "run newname.cfg" on the
command line to restore your settings. (Until the next user comes along
to do the same thing, menu item System-Restore User Setup will also restore
your setting.) (There are files called csl.cfg and usercsl.cfg in the Macro
subdirectory too, as deeper backups which should NOT be changed; this usercsl.cfg
is not affected by Save User Setup.)
-
Once you have a newname.cfg, you can open it in a text editor and look
at it, modify it further, or make near-copies of it for other purposes.
-
"View screens" (windows) specifications appear in the .cfg file as values
of the corners of the boxes plus various settings. If you want to type
in values for view screens then see pp. 313-316 in the manual. I have avoided
ever doing this by using the Record method just described. The things to
know about windows are: each window has a declared source, which is the
window you used to clone it from, or otherwise "a" by default; each window
is set to either automatically clear between displays, or overwrite; each
window is set with its y-scale either as "normalized" (display is scaled
to its own highest value), or not (display is ±32k). "Relative"
means that you can make difference measures (the "delta").
-
A key file can be loaded by a .cfg file. Put the line "run
filename.key" into the .cfg file.
5. Two sample .key files that bypass cmd files:
-
This is my file vot.key, plus added comments in italics:
DEFINE n "use a; purge
a; set dir f:; set ext .nsp; ldspl; use c; palate a"
assumes some window a exists,
which is activated and purged; a list of .nsp files in directory f: will
be brought up in a dialog box so that I can choose one to display in the
window; then window c (which must exist) is activated and the palate data
from the file now in window a is displayed there
DEFINE t "use b; purge b; set
dir f:; set ext .tr0; ldspl"
lists the .tr0 files in f: so that one can be displayed in window b
DEFINE a "use a; unlink;
logadd; unmark; mark =; link b"
window a is activated and unlinked
from any other windows (important for keeping values from other windows
out of the log file) and the current value (of whatever parameter) is logged;
then the left mark is set at the location of the right mark and a is linked
to b
DEFINE b "use b; unlink; logadd;
link a"
DEFINE w "logwrt"
write the log entries to the
log
DEFINE s "show ? m1 m2"
display the part of the file
in the active window between the two marks m1 and m2
DEFINE x "show ? 0 *"
display the whole file in the
active window (from point 0 to the last point *)
-
Here is my file "pal.key". It defines
a key to display the second channel of the file in window a in window b
(this is a pressure signal, hence assigned to key p), but no key is defined
for logging any measurements from this window.
DEFINE s "show m1 m2"
DEFINE S "show m1 m2"
DEFINE x "show 0 *"
DEFINE X "show 0 *"
DEFINE a "use a;unlink;logadd;unmark;mark
="
DEFINE A "use a;unlink;logadd;unmark;mark
="
DEFINE w "logwrt"
DEFINE W "logwrt"
DEFINE L "use a;purge a;LOAD "
DEFINE l "use a;purge a;LOAD "
DEFINE p "use b;purge b;split a;link
a"
DEFINE P "use b;purge b;split
a;link a"
[Back to Top]
6. Here is my cfg file "pk1tr.cfg".
Most of it is copied blindly from csl.cfg; the changes are at the end:
it sets up 4 view screens (3 wide and short ones for audio, energy, and
a separate epg trajectory file; 1 box for epg display), runs pal.key, and
sets my directories.
*
SET FFT.LENGTH 512
SET FFT.PREEMPH 0.900 ON
SET FFT.DISPLAY 0 70
SET FFT.WINDOW BLACKMAN
SET FFT.SMOOTHING NONE
SET FFT.FREQUENCY 0 0
*
SET SPG.LENGTH 100
SET SPG.LEVEL 0
SET SPG.SCALE 18.00 21.29 24.62
28.00 31.29 34.65 38.00 41.33 44.65 8.00 SET SPG.PREEMPH 0.800 ON
SET SPG.WINDOW BLACKMAN
SET SPG.DISPLAY 0 80 %
SET SPG.CELL 4 4
SET SPG.PALETTE 1
*
SET LPC.LENGTH 20
SET LPC.ORDER 12
SET LPC.PREEMPH 0.900 ON
SET LPC.WINDOW ON
SET LPC.TYPE AUTOCORRELATION
SET LPC.FREQUENCY 0 0
*
SET FMT.CUTOFF 500
SET FMT.LENGTH 10
SET FMT.ORDER 12
SET FMT.PREEMPH 0.900 ON
SET FMT.WINDOW ON
SET FMT.TYPE AUTOCORRELATION
SET FMT.BWIDTH OFF
SET FMT.DISPLAY 0 80 %
*
SET PITCH.CLIPPING 15
SET PITCH.CUTOFF 25
SET PITCH.LENGTH 20
SET PITCH.ADVANCE 20
SET PITCH.RANGE 70 225
SET PITCH.DISPLAY 50 250
SET PITCH.PEAK 100
SET PITCH.PLOT LINE
*
SET VX.FRAMING SIGNAL
SET VX.TOLERANCE 1
SET VX.OFFSET 12
*
SET ENERGY.LENGTH 10
SET ENERGY.ADVANCE 10
SET ENERGY.SMOOTHING NONE
SET ENERGY.DISPLAY 30 80
*
SET CAPTURE.RATE 10000
SET CAPTURE.ECHO OFF
SET CAPTURE.LENGTH 6
*
SET SPK.MODE STEREO
SET SPK.MUTE OFF
SET SPK.REPEAT SINGLE
*
SET PRTSCRN TO SCRNDUMP
*
SET NORMALIZE ON
SET CLEAR ON
SET RELATIVE ON
SET GRID OFF
*
SET COLOUR RED
SET DIRECTORY C:\USERS\PAT
SET EXTENSION .NSP
*
DELETE ALL
VIEW 0 22 639 101 3 +n +c +r -h
-v
VIEW 0 103 639 192 3 +n +c +r
-h -v
VIEW 0 195 639 273 3 +n +c +r
-h -v
VIEW 192 278 439 478 3 +n +c +r
-h -v
USE a
run pal.key
set log.dir c:\users\pat\
[Back to Top]
[Back to Phonetics Lab Home Page]