Debian Codegraph @

doc/part9.html

raw
1 <!DOCTYPE html>
2 <html><head><title>Nyquist Globals</title>
3 <link rel="stylesheet" type="text/css" href="nyquiststyle.css">
4 <link rel="icon" href="nyquist-icon.png" />
5 <link rel="shortcut icon" href="nyquist-icon.png" />
6 </head>
7 <body bgcolor="ffffff">
8 <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>
9 <hr>
10 <a name = "109"><h2>Nyquist Globals</h2></a><a name="index855"></a>
11 <p>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>
12 <dl>
13 <dt>
14 <code>*~=tolerance*</code><a name="index856"></a></dt>
15 <dd>The tolerance used by the
16 SAL "approximately equal" operator (<code>~=</code>) to determine if two
17 numbers are approximately equal.<br><br>
18 <dt><code>*table*</code><a name="index857"></a></dt>
19 <dd>Default table used by <code>osc</code> and other oscillators. Initially set to the sinusoid in <code>*sine-table*</code>.<br><br>
20 <dt><code>*A4-Hertz*</code><a name="index858"></a></dt>
21 <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>
22 <dt><code>*autonorm*</code><a name="index859"></a></dt>
23 <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#46">Memory Space and Normalization</a> and <a href = "part8.html#100">Sound File Input and Output</a>.<br><br>
24 <dt><code>*autonormflag*</code><a name="index860"></a></dt>
25 <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#46">Memory Space and Normalization</a> and <a href = "part8.html#100">Sound File Input and Output</a>.<br><br>
26 <dt><code>*autonorm-max-samples*</code><a name="index861"></a></dt>
27 <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#46">Memory Space and Normalization</a> and <a href = "part8.html#100">Sound File Input and Output</a>.<br><br>
28 <dt><code>*autonorm-previous-peak*</code><a name="index862"></a></dt>
29 <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#46">Memory Space and Normalization</a> and <a href = "part8.html#100">Sound File Input and Output</a>.<br><br>
30 <dt><code>*autonorm-target*</code><a name="index863"></a></dt>
31 <dd>The target peak amplitude for the autonorm feature. The default value is 0.9. See Sections <a href = "part6.html#46">Memory Space and Normalization</a> and <a href = "part8.html#100">Sound File Input and Output</a>.<br><br>
32 <dt><code>*autonorm-type*</code><a name="index864"></a></dt>
33 <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#46">Memory Space and Normalization</a> and <a href = "part8.html#100">Sound File Input and Output</a>.<br><br>
34 <dt><code>*breakenable*</code><a name="index865"></a></dt>
35 <dd>Controls whether XLISP enters a break loop when an error is encountered. See Section <a href = "part19.html#239">Symbols</a>.<br><br>
36 <dt><code>*clipping-error*</code><a name="index866"></a><a name="index867"></a></dt>
37 <dd>If
38 the peak absolute amplitude value of a sound saved or played exceeds
39 <code>*clipping-threshold*</code>, an XLISP error is raised. See
40 <code>*clipping-threshold* for more detail.<br><br>
41 <dt><code>*clipping-threshold*</code><a name="index868"></a></dt>
42 <dd>See
43 <code>*clipping-error*</code> for a description of this
44 variable. <code>*clipping-threshold*</code> is initialized to 127/128. This
45 number is conservative,
46 and it is possible to slightly exceed this value, even with 8-bit
47 files without actual clipping (consider rounding</code>. Also, floating point
48 format files will not clip even when the amplitude exceeds 1.0. Note
49 that a &ldquo;clipping&rdquo; threshold of 1.0 is optimistic: 1.0 corresponds to
50 a 16-bit integer value of 32,768 (2<sup T>15</sup>), but the maximum positive
51 16-bit integer is 32,767. Thus, a positive sample of 1.0 will clip
52 when written or played as 16-bit audio.<br><br>
53 <dt><code>*control-srate*</code><a name="index869"></a></dt>
54 <dd>Part of the environment, establishes the control sample rate. See Section <a href = "part4.html#28">The Environment</a> for details.<br><br>
55 <dt><code>*default-plot-file*</code><a name="index870"></a></dt>
56 <dd>The default file for plot data (written by Nyquist, read by NyquistIDE). Default value is <code>"points.dat"</code>.<br><br>
57 <dt><code>*default-sf-bits*</code><a name="index871"></a></dt>
58 <dd>The default bits-per-sample for sound files. Typically 16.<br><br>
59 <dt><code>*default-sf-dir*</code><a name="index872"></a></dt>
60 <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>
61 <dt><code>*default-sf-format*</code><a name="index873"></a></dt>
62 <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>
63 <dt><code>*default-sf-srate*</code><a name="index874"></a></dt>
64 <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>
65 <dt><code>*default-control-srate*</code><a name="index875"></a></dt>
66 <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>
67 <dt><code>*default-sound-srate*</code><a name="index876"></a></dt>
68 <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>
69 <dt><code>*file-separator*</code><a name="index877"></a></dt>
70 <dd>The character that separates directories in a path,
71 e.g. &ldquo;<code>/</code>&rdquo; for Unix, &ldquo;<code>:</code>&rdquo; for Mac, and &ldquo;<code>\</code>&rdquo; for Win32.
72 This is normally set in <code>system.lsp</code>.<br><br>
73 <dt><code>*lpslider-cutoff*</code><a name="index878"></a></dt>
74 <dd>The
75 cutoff frequency used by <code>lpslider</code>, described in Section
76 <a href = "part10.html#114">Accessing Control Values</a>. The default value is 20Hz. If unbound, this variable is set
77 when you load <code>sliders.lsp</code>.<br><br>
78 <dt><code>*rslt*</code><a name="index879"></a></dt>
79 <dd>When a function returns more than one value, <code>*rslt*</code> is set to a list of the &ldquo;extra&rdquo; values. This provides a make-shift version of the <code>multiple-value-return</code> facility in Common Lisp.<br><br>
80 <dt><code>*saw-table*</code><a name="index880"></a><a name="index881"></a></dt>
81 <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>
82 <dt><code>*sine-table*</code><a name="index882"></a><a name="index883"></a></dt>
83 <dd>A single cycle sinusoid intended for use by table-lookup oscillators such as <code>osc</code>.<br><br>
84 <dt><code>*snd-device*</code><a name="index884"></a><a name="index885"></a><a name="index886"></a><a name="index887"></a><a name="index888"></a></dt>
85 <dd>Normally, this is set by NyquistIDE. Select the audio
86 output device by setting this to a <code>FIXNUM</code> to select a device by
87 index number or to a <code>STRING</code> to select a device by name. If a
88 <code>STRING</code> is provided, the first device whose name contains the
89 <code>STRING</code> (as a substring) is selected. (See <code>*snd-list-devices*</code>
90 below.) If the value is unbound or NULL, <code>*snd-device-default*</code>
91 is used (see below).<br><br>
92 <dt><code>*snd-device-default*</code><a name="index889"></a><a name="index890"></a><a name="index891"></a><a name="index892"></a><a name="index893"></a></dt>
93 <dd>If <code>*snd-device*</code> is unbound or null, this variable
94 can select the audio
95 output device in the same way as <code>*snd-device*</code>. Normally, this variable
96 would be set in an initialization file that provides a default value that
97 can be overridden by the NyquistIDE preferences.
98 If both <code>*snd-device*</code> and <code>*snd-device-default*</code> are null,
99 the default PortAudio device is used.<br><br>
100 <dt><code>*snd-list-devices*</code><a name="index894"></a><a name="index895"></a><a name="index896"></a><a name="index897"></a></dt>
101 <dd>List all audio
102 output devices (as text output) when a sound is played. By inspecting this
103 list, one can determine possible values for <code>*snd-device*</code> and see
104 what device is being selected by Nyquist. One cannot (currently) obtain
105 the list of devices as an <code>XLISP</code> value. The default behavior is to
106 list the devices and some instructions only the first time any sound is
107 played. Setting <code>*snd-list-devices*</code> to a value (<code>t</code> or <code>nil</code>)
108 before playing a sound will override this behavior.<br><br>
109 <dt><code>*sound-srate*</code><a name="index898"></a></dt>
110 <dd>Part of the environment, establishes the audio sample rate. See Section <a href = "part4.html#28">The Environment</a> for details.<br><br>
111 <dt><code>*soundenable*</code><a name="index899"></a></dt>
112 <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>
113 <dt><code>*tracenable*</code><a name="index900"></a></dt>
114 <dd>Controls whether XLISP prints a backtrace when an error is encountered.<br><br>
115 <dt><code>*tri-table*</code><a name="index901"></a><a name="index902"></a></dt>
116 <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>
117 <dt><b>XLISP variables</b></dt>
118 <dd>See Section <a href = "part19.html#239">Symbols</a> for a list of
119 global variables defined by XLISP.<br><br>
120 <dt><b>Environment variables</b></dt>
121 <dd>See Section <a href = "part4.html#28">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>
122 <dt><b>Various constants</b></dt>
123 <dd>See Section <a href = "part2.html#16">Predefined Constants</a> for definitions of predefined constants for loudness, duration, and pitch.
124 </dd></dl><hr>
125 <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>
126 </body></html>