1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85
|
<html><head><title>Nyquist Globals</title>
<link rel="stylesheet" type="text/css" href="nyquiststyle.css">
</head>
<body bgcolor="ffffff">
<a href = "part8.html">Previous Section</a> | <a href = "part10.html">Next Section</a> | <a href = "title.html#toc">Table of Contents</a> | <a href = "indx.html">Index</a> | <a href = "title.html">Title Page</a>
<hr>
<a name = "108"><h2>Nyquist Globals</h2></a>
<a name="index829"></a>
There are many global variables in Nyquist. A convention in Lisp is to place asterisks (*) around global variables, e.g. <code>*table*</code>. 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:
<p>
<dl>
<dt>
<code>*~=tolerance*</code><a name="index830"></a><dd>The tolerance used by the
SAL "approximately equal" operator (<code>~=</code>) to determine if two
numbers are approximately equal.<br><br>
<dt><code>*table*</code><a name="index831"></a><dd>Default table used by <code>osc</code> and other oscillators. Initially set to the sinusoid in <code>*sine-table*</code>.<br><br>
<dt><code>*A4-Hertz*</code><a name="index832"></a><dd>Frequency of A4 in Hertz.. Note: you must call <code>(set-pitch-names)</code> to recompute pitches after changing <code>*A4-Hertz*</code>.<br><br>
<dt><code>*autonorm*</code><a name="index833"></a><dd>The normalization factor to be applied to the next sound when <code>*autonorm-type*</code> is <code>'previous</code>. See Sections <a href = "part6.html#45">"Memory Space and Normalization"</a> and <a href = "part8.html#99">"Sound File Input and Output"</a>.<br><br>
<dt><code>*autonormflag*</code><a name="index834"></a><dd>Enables the automatic normalization feature of the <code>play</code> command. You should use <code>(autonorm-on)</code> and <code>(autonorm-off)</code> rather than setting <code>*autonormflag*</code> directly. See Sections <a href = "part6.html#45">"Memory Space and Normalization"</a> and <a href = "part8.html#99">"Sound File Input and Output"</a>.<br><br>
<dt><code>*autonorm-max-samples*</code><a name="index835"></a><dd>Specifies how many samples will be computed searching for a peak value when <code>*autonorm-type*</code> is <code>'lookahead</code>. See Sections <a href = "part6.html#45">"Memory Space and Normalization"</a> and <a href = "part8.html#99">"Sound File Input and Output"</a>.<br><br>
<dt><code>*autonorm-previous-peak*</code><a name="index836"></a><dd>The peak of the previous sound generated by <code>play</code>. This is used to compute the scale factor for the next sound when <code>*autonorm-type*</code> is <code>'previous</code>. See Sections <a href = "part6.html#45">"Memory Space and Normalization"</a> and <a href = "part8.html#99">"Sound File Input and Output"</a>.<br><br>
<dt><code>*autonorm-target*</code><a name="index837"></a><dd>The target peak amplitude for the autonorm feature. The default value is 0.9. See Sections <a href = "part6.html#45">"Memory Space and Normalization"</a> and <a href = "part8.html#99">"Sound File Input and Output"</a>.<br><br>
<dt><code>*autonorm-type*</code><a name="index838"></a><dd>Determines how the autonorm feature is implemented. Valid values are <code>'lookahead</code> (the default) and <code>'previous</code>. See Sections <a href = "part6.html#45">"Memory Space and Normalization"</a> and <a href = "part8.html#99">"Sound File Input and Output"</a>.<br><br>
<dt><code>*breakenable*</code><a name="index839"></a><dd>Controls whether XLISP enters a break loop when an error is encountered. See Section <a href = "part19.html#241">"Profiling"</a>.<br><br>
<dt><code>*clipping-error*</code><a name="index840"></a><a name="index841"></a><dd>If
the peak absolute amplitude value of a sound saved or played exceeds
<code>*clipping-threshold*</code>, an XLISP error is raised. See
<code>*clipping-threshold* for more detail.<br><br>
<dt><code>*clipping-threshold*</code><a name="index842"></a><dd>See
<code>*clipping-error*</code> for a description of this
variable. <code>*clipping-threshold*</code> 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</code>. 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<sup T>15</sup>), 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.<br><br>
<dt><code>*control-srate*</code><a name="index843"></a><dd>Part of the environment, establishes the control sample rate. See Section <a href = "part4.html#27">"The Environment"</a> for details.<br><br>
<dt><code>*default-plot-file*</code><a name="index844"></a><dd>The default file for plot data (written by Nyquist, read by NyquistIDE). Default value is <code>"points.dat"</code>.<br><br>
<dt><code>*default-sf-bits*</code><a name="index845"></a><dd>The default bits-per-sample for sound files. Typically 16.<br><br>
<dt><code>*default-sf-dir*</code><a name="index846"></a><dd>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 <code>*default-sf-dir*</code> applies.)<br><br>
<dt><code>*default-sf-format*</code><a name="index847"></a><dd>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.<br><br>
<dt><code>*default-sf-srate*</code><a name="index848"></a><dd>The default sample rate for sound files. Typically 44100.0, but often set to 22050.0 for speed in non-critical tasks.<br><br>
<dt><code>*default-control-srate*</code><a name="index849"></a><dd>Default value for <code>*control-srate*</code>. This value is restored when you execute <code>(top)</code> to pop out of a debugging session. Change it by calling <code>(set-control-srate <i>value</i>)</code>.<br><br>
<dt><code>*default-sound-srate*</code><a name="index850"></a><dd>Default value for <code>*sound-srate*</code>. This value is restored when you execute <code>(top)</code> to pop out of a debugging session. Change it by calling <code>(set-sound-srate <i>value</i>)</code>.<br><br>
<dt><code>*file-separator*</code><a name="index851"></a><dd>The character that separates directories in a path,
e.g. "<code>/</code>" for Unix, "<code>:</code>" for Mac, and "<code>\</code>" for Win32.
This is normally set in <code>system.lsp</code>.<br><br>
<dt><code>*lpslider-cutoff*</code><a name="index852"></a><dd>The
cutoff frequency used by <code>lpslider</code>, described in Section
<a href = "part10.html#113">"Accessing Control Values"</a>. The default value is 20Hz. If unbound, this variable is set
when you load <code>sliders.lsp</code>.<br><br>
<dt><code>*rslt*</code><a name="index853"></a><dd>When a function returns more than one value, <code>*rslt*</code> is set to a list of the "extra" values. This provides a make-shift version of the <code>multiple-value-return</code> facility in Common Lisp.<br><br>
<dt><code>*saw-table*</code><a name="index854"></a><a name="index855"></a><dd>A single cycle sawtooth wave intended for use by table-lookup oscillators such as <code>osc</code>. This is the waveform used by <code>osc-saw</code>. Note that some aliasing will normally occur when using this waveform, which is not band-limited.<br><br>
<dt><code>*sine-table*</code><a name="index856"></a><a name="index857"></a><dd>A single cycle sinusoid intended for use by table-lookup oscillators such as <code>osc</code>.<br><br>
<dt><code>*snd-device*</code><a name="index858"></a><a name="index859"></a><a name="index860"></a><a name="index861"></a><a name="index862"></a><dd>Select the audio
output device by setting this to a <code>FIXNUM</code> to select a device by
index number or to a <code>STRING</code> to select a device by name. If a
<code>STRING</code> is provided, the first device whose name contains the
<code>STRING</code> (as a substring) is selected. (See <code>*snd-list-devices*</code>
below.) If the value is unbound or NULL, the default PortAudio device
is used.<br><br>
<dt><code>*snd-list-devices*</code><a name="index863"></a><a name="index864"></a><a name="index865"></a><a name="index866"></a><dd>List all audio
output devices (as text output) when a sound is played. By inspecting this
list, one can determine possible values for <code>*snd-device*</code> and see
what device is being selected by Nyquist. One cannot (currently) obtain
the list of devices as an <code>XLISP</code> value. The default behavior is to
list the devices and some instructions only the first time any sound is
played. Setting <code>*snd-list-devices*</code> to a value (<code>t</code> or <code>nil</code>)
before playing a sound will override this behavior.<br><br>
<dt><code>*sound-srate*</code><a name="index867"></a><dd>Part of the environment, establishes the audio sample rate. See Section <a href = "part4.html#27">"The Environment"</a> for details.<br><br>
<dt><code>*soundenable*</code><a name="index868"></a><dd>Controls whether writes to a sound file will also be played as audio. Set this variable by calling <code>(sound-on)</code> or <code>(sound-off)</code>.<br><br>
<dt><code>*tracenable*</code><a name="index869"></a><dd>Controls whether XLISP prints a backtrace when an error is encountered.<br><br>
<dt><code>*tri-table*</code><a name="index870"></a><a name="index871"></a><dd>A single cycle triangle wave intended for use by table-lookup oscillators such as <code>osc</code>. This is the waveform used by <code>osc-tri</code>. Note that some aliasing will normally occur when using this waveform, which is not band-limited.<br><br>
<dt><b>XLISP variables</b><dd>See Section <a href = "part19.html#241">"Profiling"</a> for a list of
global variables defined by XLISP.<br><br>
<dt><b>Environment variables</b><dd>See Section <a href = "part4.html#27">"The Environment"</a> for definitions of variables used in the environment for behaviors. In general, you should never set or access these variables directly.<br><br>
<dt><b>Various constants</b><dd>See Section <a href = "part2.html#16">"Predefined Constants"</a> for definitions of predefined constants for loudness, duration, and pitch.
</dl>
<p>
<hr>
<a href = "part8.html">Previous Section</a> | <a href = "part10.html">Next Section</a> | <a href = "title.html#toc">Table of Contents</a> | <a href = "indx.html">Index</a> | <a href = "title.html">Title Page</a>
</body></html>
|