Previous Section | Next Section | Table of Contents | Index | Title Page

Nyquist Globals

There are many global variables in Nyquist. A convention in Lisp is to place asterisks (*) around global variables, e.g. *table*. This is only a convention, and the asterisks are just like any other letter as far as variable names are concerned. Here are some globals users should know about:

*table*
Default table used by osc and other oscillators.

*A4-Hertz*
Frequency of A4 in Hertz.. Note: you must call (set-pitch-names) to recompute pitches after changing *A4-Hertz*.

*autonorm*
The normalization factor to be applied to the next sound when *autonorm-type* is 'previous. See Sections "Memory Space and Normalization" and "Sound File Input and Output".

*autonormflag*
Enables the automatic normalization feature of the play command. You should use (autonorm-on) and (autonorm-off) rather than setting *autonormflag* directly. See Sections "Memory Space and Normalization" and "Sound File Input and Output".

*autonorm-max-samples*
Specifies how many samples will be computed searching for a peak value when *autonorm-type* is 'lookahead. See Sections "Memory Space and Normalization" and "Sound File Input and Output".

*autonorm-previous-peak*
The peak of the previous sound generated by play. This is used to compute the scale factor for the next sound when *autonorm-type* is 'previous. See Sections "Memory Space and Normalization" and "Sound File Input and Output".

*autonorm-target*
The target peak amplitude for the autonorm feature. The default value is 0.9. See Sections "Memory Space and Normalization" and "Sound File Input and Output".

*autonorm-type*
Determines how the autonorm feature is implemented. Valid values are 'lookahead (the default) and 'previous. See Sections "Memory Space and Normalization" and "Sound File Input and Output".

*breakenable*
Controls whether XLISP enters a break loop when an error is encountered. See Section "Profiling".

*clipping-error*
If the peak absolute amplitude value of a sound saved or played exceeds *clipping-threshold*, an XLISP error is raised. See *clipping-threshold* for more detail.

*clipping-threshold*
See *clipping-error* for a description of this variable. *clipping-threshold* is initialized to 127/128. This number is conservative, and it is possible to slightly exceed this value, even with 8-bit files without actual clipping (consider rounding. Also, floating point format files will not clip even when the amplitude exceeds 1.0. Note that a "clipping" threshold of 1.0 is optimistic: 1.0 corresponds to a 16-bit integer value of 32,768 (2^15), but the maximum positive 16-bit integer is 32,767. Thus, a positive sample of 1.0 will clip when written or played as 16-bit audio.

*control-srate*
Part of the environment, establishes the control sample rate. See Section "The Environment" for details.

*default-sf-bits*
The default bits-per-sample for sound files. Typically 16.

*default-sf-dir*
The default sound file directory. Unless you give a full path for a file, audio files are assumed to be in this directory. (Applies to many functions that deal with sound files. Check the function description to see if *default-sf-dir* applies.)

*default-sf-format*
The default sound file format. When you write a file, this will be the default format: AIFF for Mac and most Unix systems, NeXT for NeXT systems, and WAV for Win32.

*default-sf-srate*
The default sample rate for sound files. Typically 44100.0, but often set to 22050.0 for speed in non-critical tasks.

*default-control-srate*
Default value for *control-srate*. This value is restored when you execute (top) to pop out of a debugging session. Change it by calling (set-control-srate value).

*default-sound-srate*
Default value for *sound-srate*. This value is restored when you execute (top) to pop out of a debugging session. Change it by calling (set-sound-srate value).

*file-separator*
The character that separates directories in a path, e.g. "/" for Unix, ":" for Mac, and "\" for Win32. This is normally set in system.lsp.

*rslt*
When a function returns more than one value, *rslt* is set to a list of the "extra" values. This provides a make-shift version of the multiple-value-return facility in Common Lisp.

*sound-srate*
Part of the environment, establishes the audio sample rate. See Section "The Environment" for details.

*soundenable*
Controls whether writes to a sound file will also be played as audio. Set this variable by calling (sound-on) or (sound-off).

*tracenable*
Controls whether XLISP prints a backtrace when an error is encountered.

XLISP variables
See Section "Profiling" for a list of global variables defined by XLISP.

Environment variables
See Section "The Environment" for definitions of variables used in the environment for behaviors. In general, you should never set or access these variables directly.

Various constants
See Section "Predefined Constants" for definitions of predefined constants for loudness, duration, and pitch.


Previous Section | Next Section | Table of Contents | Index | Title Page