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:

`*~=tolerance*`
  The tolerance used by the SAL "approximately equal" operator (`~=`) to determine if two numbers are approximately equal.
`*table*`
  Default table used by `osc` and other oscillators. Initially set to the sinusoid in `*sine-table*`.
`*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 (215), 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-plot-file*`
  The default file for plot data (written by Nyquist, read by NyquistIDE). Default value is `"points.dat"`.
`*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`.
`*lpslider-cutoff*`
  The cutoff frequency used by `lpslider`, described in Section "Accessing Control Values". The default value is 20Hz. If unbound, this variable is set when you load `sliders.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.
`*saw-table*`
  A single cycle sawtooth wave intended for use by table-lookup oscillators such as `osc`. This is the waveform used by `osc-saw`. Note that some aliasing will normally occur when using this waveform, which is not band-limited.
`*sine-table*`
  A single cycle sinusoid intended for use by table-lookup oscillators such as `osc`.
`*snd-device*`
  Select the audio output device by setting this to a `FIXNUM` to select a device by index number or to a `STRING` to select a device by name. If a `STRING` is provided, the first device whose name contains the `STRING` (as a substring) is selected. (See `*snd-list-devices*` below.) If the value is unbound or NULL, the default PortAudio device is used.
`*snd-list-devices*`
  List all audio output devices (as text output) when a sound is played. By inspecting this list, one can determine possible values for `*snd-device*` and see what device is being selected by Nyquist. One cannot (currently) obtain the list of devices as an `XLISP` value. The default behavior is to list the devices and some instructions only the first time any sound is played. Setting `*snd-list-devices*` to a value (`t` or `nil`) before playing a sound will override this behavior.
`*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.
`*tri-table*`
  A single cycle triangle wave intended for use by table-lookup oscillators such as `osc`. This is the waveform used by `osc-tri`. Note that some aliasing will normally occur when using this waveform, which is not band-limited.
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