File: part9.html

package info (click to toggle)
nyquist 3.24%2Bds-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 58,156 kB
  • sloc: ansic: 74,757; lisp: 18,169; java: 10,942; cpp: 6,688; sh: 175; xml: 58; makefile: 40; python: 15
file content (126 lines) | stat: -rw-r--r-- 11,694 bytes parent folder | download | duplicates (2)
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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
<!DOCTYPE html>
<html><head><title>Nyquist Globals</title>
<link rel="stylesheet" type="text/css" href="nyquiststyle.css">
<link rel="icon" href="nyquist-icon.png" />
<link rel="shortcut icon" href="nyquist-icon.png" />
</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 = "109"><h2>Nyquist Globals</h2></a><a name="index855"></a>
<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>
<dl>
<dt>
<code>*~=tolerance*</code><a name="index856"></a></dt>
<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="index857"></a></dt>
<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="index858"></a></dt>
<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="index859"></a></dt>
<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>
<dt><code>*autonormflag*</code><a name="index860"></a></dt>
<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>
<dt><code>*autonorm-max-samples*</code><a name="index861"></a></dt>
<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>
<dt><code>*autonorm-previous-peak*</code><a name="index862"></a></dt>
<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>
<dt><code>*autonorm-target*</code><a name="index863"></a></dt>
<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>
<dt><code>*autonorm-type*</code><a name="index864"></a></dt>
<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>
<dt><code>*breakenable*</code><a name="index865"></a></dt>
<dd>Controls whether XLISP enters a break loop when an error is encountered. See Section <a href = "part19.html#239">Symbols</a>.<br><br>
<dt><code>*clipping-error*</code><a name="index866"></a><a name="index867"></a></dt>
<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="index868"></a></dt>
<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 &ldquo;clipping&rdquo; 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="index869"></a></dt>
<dd>Part of the environment, establishes the control sample rate. See Section <a href = "part4.html#28">The Environment</a> for details.<br><br>
<dt><code>*default-plot-file*</code><a name="index870"></a></dt>
<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="index871"></a></dt>
<dd>The default bits-per-sample for sound files. Typically 16.<br><br>
<dt><code>*default-sf-dir*</code><a name="index872"></a></dt>
<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="index873"></a></dt>
<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="index874"></a></dt>
<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="index875"></a></dt>
<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="index876"></a></dt>
<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="index877"></a></dt>
<dd>The character that separates directories in a path,
e.g. &ldquo;<code>/</code>&rdquo; for Unix, &ldquo;<code>:</code>&rdquo; for Mac, and &ldquo;<code>\</code>&rdquo; for Win32.
This is normally set in <code>system.lsp</code>.<br><br>
<dt><code>*lpslider-cutoff*</code><a name="index878"></a></dt>
<dd>The
cutoff frequency used by <code>lpslider</code>, described in Section
<a href = "part10.html#114">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="index879"></a></dt>
<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>
<dt><code>*saw-table*</code><a name="index880"></a><a name="index881"></a></dt>
<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="index882"></a><a name="index883"></a></dt>
<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="index884"></a><a name="index885"></a><a name="index886"></a><a name="index887"></a><a name="index888"></a></dt>
<dd>Normally, this is set by NyquistIDE. 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, <code>*snd-device-default*</code>
is used (see below).<br><br>
<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>
<dd>If <code>*snd-device*</code> is unbound or null, this variable
can select the audio 
output device in the same way as <code>*snd-device*</code>. Normally, this variable
would be set in an initialization file that provides a default value that
can be overridden by the NyquistIDE preferences.
If both <code>*snd-device*</code> and <code>*snd-device-default*</code> are null, 
the default PortAudio device is used.<br><br>
<dt><code>*snd-list-devices*</code><a name="index894"></a><a name="index895"></a><a name="index896"></a><a name="index897"></a></dt>
<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="index898"></a></dt>
<dd>Part of the environment, establishes the audio sample rate. See Section <a href = "part4.html#28">The Environment</a> for details.<br><br>
<dt><code>*soundenable*</code><a name="index899"></a></dt>
<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="index900"></a></dt>
<dd>Controls whether XLISP prints a backtrace when an error is encountered.<br><br>
<dt><code>*tri-table*</code><a name="index901"></a><a name="index902"></a></dt>
<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></dt>
<dd>See Section <a href = "part19.html#239">Symbols</a> for a list of 
global variables defined by XLISP.<br><br>
<dt><b>Environment variables</b></dt>
<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>
<dt><b>Various constants</b></dt>
<dd>See Section <a href = "part2.html#16">Predefined Constants</a> for definitions of predefined constants for loudness, duration, and pitch.
</dd></dl><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>