Erosion and dilasion by square successfully tested.
[Faustine.git] / documentation / Signal.html
1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
2 <html>
3 <head>
4 <link rel="stylesheet" href="style.css" type="text/css">
5 <meta content="text/html; charset=iso-8859-1" http-equiv="Content-Type">
6 <link rel="Start" href="index.html">
7 <link rel="previous" href="Value.html">
8 <link rel="next" href="Faustexp.html">
9 <link rel="Up" href="index.html">
10 <link title="Index of types" rel=Appendix href="index_types.html">
11 <link title="Index of exceptions" rel=Appendix href="index_exceptions.html">
12 <link title="Index of values" rel=Appendix href="index_values.html">
13 <link title="Index of modules" rel=Appendix href="index_modules.html">
14 <link title="Types" rel="Chapter" href="Types.html">
15 <link title="Parser" rel="Chapter" href="Parser.html">
16 <link title="Lexer" rel="Chapter" href="Lexer.html">
17 <link title="Value" rel="Chapter" href="Value.html">
18 <link title="Signal" rel="Chapter" href="Signal.html">
19 <link title="Faustexp" rel="Chapter" href="Faustexp.html">
20 <link title="Interpreter" rel="Chapter" href="Interpreter.html">
21 <link title="Preprocess" rel="Chapter" href="Preprocess.html">
22 <link title="Main" rel="Chapter" href="Main.html"><title>Signal</title>
23 </head>
24 <body>
25 <div class="navbar"><a href="Value.html">Previous</a>
26 &nbsp;<a href="index.html">Up</a>
27 &nbsp;<a href="Faustexp.html">Next</a>
28 </div>
29 <center><h1>Module <a href="type_Signal.html">Signal</a></h1></center>
30 <br>
31 <pre><span class="keyword">module</span> Signal: <code class="code">sig</code> <a href="Signal.html">..</a> <code class="code">end</code></pre>Module: Signal
32 Description: type signal = rate * (int -&gt; value), operations of signals.<br>
33 <b>Author(s):</b> WANG Haisheng
34 Created: 03/06/2013 Modified: 03/06/2013<br>
35 <hr width="100%">
36 <pre><span id="EXCEPTIONSignal_operation"><span class="keyword">exception</span> Signal_operation</span> <span class="keyword">of</span> <code class="type">string</code></pre>
37 <div class="info">
38 Exception raised in operations of signals.<br>
39 </div>
40 <br><code><span id="TYPEsignal_macro"><span class="keyword">type</span> <code class="type"></code>signal_macro</span> = </code><table class="typetable">
41 <tr>
42 <td align="left" valign="top" >
43 <code><span class="keyword">|</span></code></td>
44 <td align="left" valign="top" >
45 <code><span class="constructor">Delay_Memory_Length_int</span></code></td>
46
47 </tr></table>
48
49 <div class="info">
50 Macro constants of the file.<br>
51 </div>
52
53 <pre><span id="VALsignal_macro_to_int"><span class="keyword">val</span> <a href="code_VALSignal.signal_macro_to_int.html">signal_macro_to_int</a></span> : <code class="type"><a href="Signal.html#TYPEsignal_macro">signal_macro</a> -> int</code></pre><div class="info">
54 val signal_macro_to_int : signal_macro -&gt; int.<br>
55 </div>
56 <pre><span id="VALfrequency"><span class="keyword">val</span> <a href="code_VALSignal.frequency.html">frequency</a></span> : <code class="type">'a * 'b -> 'a</code></pre><div class="info">
57 val frequency : signal -&gt; int, returns the frequency of a signal.<br>
58 </div>
59 <pre><span id="VALsignal_fun"><span class="keyword">val</span> <a href="code_VALSignal.signal_fun.html">signal_fun</a></span> : <code class="type">'a * 'b -> 'b</code></pre><div class="info">
60 val signal_fun : signal -&gt; (int -&gt; value), returns the functional part of a signal.<br>
61 </div>
62 <pre><span id="VALcheck_frequency"><span class="keyword">val</span> <a href="code_VALSignal.check_frequency.html">check_frequency</a></span> : <code class="type">int -> int -> int</code></pre><div class="info">
63 val check_frequency : int -&gt; int -&gt; int, returns the correction of frequency.<br>
64 </div>
65 <pre><span id="VALsignal_check_frequency"><span class="keyword">val</span> <a href="code_VALSignal.signal_check_frequency.html">signal_check_frequency</a></span> : <code class="type">int * 'a -> int * 'b -> int</code></pre><div class="info">
66 val signal_check_frequency : signal -&gt; signal -&gt; int,
67 checks the frequencies of two input signals, and returns common frequency or raise an exception.<br>
68 </div>
69 <pre><span id="VALsignal_check_frequency3"><span class="keyword">val</span> <a href="code_VALSignal.signal_check_frequency3.html">signal_check_frequency3</a></span> : <code class="type">int * 'a -> int * 'b -> int * 'c -> int</code></pre><div class="info">
70 val signal_check_frequency3 : signal -&gt; signal -&gt; signal -&gt; int,
71 checks the frequencies of three input signal, and returns common frequency or raise an exception.<br>
72 </div>
73 <pre><span id="VALsignal_check_frequency4"><span class="keyword">val</span> <a href="code_VALSignal.signal_check_frequency4.html">signal_check_frequency4</a></span> : <code class="type">int * 'a -> int * 'b -> int * 'c -> int * 'd -> int</code></pre><div class="info">
74 val signal_check_frequency4 : signal -&gt; signal -&gt; signal -&gt; signal -&gt; int,
75 checks the frequencies of three input signal, and returns common frequency or raise an exception.<br>
76 </div>
77 <pre><span id="VALsignal_add_one_memory"><span class="keyword">val</span> <a href="code_VALSignal.signal_add_one_memory.html">signal_add_one_memory</a></span> : <code class="type">'a * (int -> 'b) -> 'a * (int -> 'b)</code></pre><div class="info">
78 val signal_add_one_memory : signal -&gt; signal,
79 returns the signal with memory of one latest sample.<br>
80 </div>
81 <pre><span id="VALbeam_add_one_memory"><span class="keyword">val</span> <a href="code_VALSignal.beam_add_one_memory.html">beam_add_one_memory</a></span> : <code class="type">('a * (int -> 'b)) list -> ('a * (int -> 'b)) list</code></pre><div class="info">
82 val beam_add_one_memory : signal list -&gt; signal list,
83 adds memory of one latest sample for each element in signal list.<br>
84 </div>
85 <pre><span id="VALsignal_add"><span class="keyword">val</span> <a href="code_VALSignal.signal_add.html">signal_add</a></span> : <code class="type">int * ('a -> <a href="Types.html#TYPEvalue">Types.value</a>) -><br> int * ('a -> <a href="Types.html#TYPEvalue">Types.value</a>) -> int * ('a -> <a href="Types.html#TYPEvalue">Types.value</a>)</code></pre><div class="info">
86 val signal_add : signal -&gt; signal -&gt; signal, output(t) = input1(t) + input2(t),
87 frequency consistent.<br>
88 </div>
89 <pre><span id="VALsignal_neg"><span class="keyword">val</span> <a href="code_VALSignal.signal_neg.html">signal_neg</a></span> : <code class="type">'a * ('b -> <a href="Types.html#TYPEvalue">Types.value</a>) -> 'a * ('b -> <a href="Types.html#TYPEvalue">Types.value</a>)</code></pre><div class="info">
90 val signal_neg : signal -&gt; signal, output(t) = -input(t), frequency consistent.<br>
91 </div>
92 <pre><span id="VALsignal_sub"><span class="keyword">val</span> <a href="code_VALSignal.signal_sub.html">signal_sub</a></span> : <code class="type">int * ('a -> <a href="Types.html#TYPEvalue">Types.value</a>) -><br> int * ('a -> <a href="Types.html#TYPEvalue">Types.value</a>) -> int * ('a -> <a href="Types.html#TYPEvalue">Types.value</a>)</code></pre><div class="info">
93 val signal_sub : signal -&gt; signal -&gt; signal, output(t) = input1(t) - input2(t),
94 frequency consistent.<br>
95 </div>
96 <pre><span id="VALsignal_mul"><span class="keyword">val</span> <a href="code_VALSignal.signal_mul.html">signal_mul</a></span> : <code class="type">int * ('a -> <a href="Types.html#TYPEvalue">Types.value</a>) -><br> int * ('a -> <a href="Types.html#TYPEvalue">Types.value</a>) -> int * ('a -> <a href="Types.html#TYPEvalue">Types.value</a>)</code></pre><div class="info">
97 val signal_mul : signal -&gt; signal -&gt; signal, output(t) = input1(t) * input2(t),
98 frequency consistent.<br>
99 </div>
100 <pre><span id="VALsignal_div"><span class="keyword">val</span> <a href="code_VALSignal.signal_div.html">signal_div</a></span> : <code class="type">int * ('a -> <a href="Types.html#TYPEvalue">Types.value</a>) -><br> int * ('a -> <a href="Types.html#TYPEvalue">Types.value</a>) -> int * ('a -> <a href="Types.html#TYPEvalue">Types.value</a>)</code></pre><div class="info">
101 val signal_div : signal -&gt; signal -&gt; signal, output(t) = input1(t) / input2(t),
102 frequency consistent.<br>
103 </div>
104 <pre><span id="VALsignal_delay"><span class="keyword">val</span> <a href="code_VALSignal.signal_delay.html">signal_delay</a></span> : <code class="type">'a * (int -> <a href="Types.html#TYPEvalue">Types.value</a>) -><br> 'b * (int -> <a href="Types.html#TYPEvalue">Types.value</a>) -> 'a * (int -> <a href="Types.html#TYPEvalue">Types.value</a>)</code></pre><div class="info">
105 val signal_delay : signal -&gt; signal -&gt; signal, output(t) = input1(t - input2(t)),
106 Attention: delay dynamic, frequency of output signal equals to that of first input signal.<br>
107 </div>
108 <pre><span id="VALsignal_mem"><span class="keyword">val</span> <a href="code_VALSignal.signal_mem.html">signal_mem</a></span> : <code class="type">'a * (int -> <a href="Types.html#TYPEvalue">Types.value</a>) -> 'a * (int -> <a href="Types.html#TYPEvalue">Types.value</a>)</code></pre><div class="info">
109 val signal_mem : signal -&gt; signal, equivalent to signal_delay with constant delay 1.<br>
110 </div>
111 <pre><span id="VALsignal_vectorize"><span class="keyword">val</span> <a href="code_VALSignal.signal_vectorize.html">signal_vectorize</a></span> : <code class="type">int * (int -> <a href="Types.html#TYPEvalue">Types.value</a>) -><br> 'a * (int -> <a href="Types.html#TYPEvalue">Types.value</a>) -> int * (int -> <a href="Types.html#TYPEvalue">Types.value</a>)</code></pre><div class="info">
112 val signal_vectorize : signal -&gt; signal -&gt; signal, output(t)(i) = input1(input2(0) * t + i),
113 Attention: vector size n static, frequency of output signal is (1/n * frequency of input1)<br>
114 </div>
115 <pre><span id="VALsignal_serialize"><span class="keyword">val</span> <a href="code_VALSignal.signal_serialize.html">signal_serialize</a></span> : <code class="type">int * (int -> <a href="Types.html#TYPEvalue">Types.value</a>) -> int * (int -> <a href="Types.html#TYPEvalue">Types.value</a>)</code></pre><div class="info">
116 val signal_serialize : signal -&gt; signal, output(t) = input(floor(t/n))(t%n),
117 with n = size of input(0).
118 Attention: input size unknown in the cas of "rec".<br>
119 </div>
120 <pre><span id="VALsignal_append"><span class="keyword">val</span> <a href="code_VALSignal.signal_append.html">signal_append</a></span> : <code class="type">int * ('a -> <a href="Types.html#TYPEvalue">Types.value</a>) -><br> int * ('a -> <a href="Types.html#TYPEvalue">Types.value</a>) -> int * ('a -> <a href="Types.html#TYPEvalue">Types.value</a>)</code></pre><div class="info">
121 val signal_append : signal -&gt; signal -&gt; signal, symbol "#",
122 appends vectors of the two input signals at each time, frequency consistent.<br>
123 </div>
124 <pre><span id="VALsignal_nth"><span class="keyword">val</span> <a href="code_VALSignal.signal_nth.html">signal_nth</a></span> : <code class="type">int * ('a -> <a href="Types.html#TYPEvalue">Types.value</a>) -><br> int * ('a -> <a href="Types.html#TYPEvalue">Types.value</a>) -> int * ('a -> <a href="Types.html#TYPEvalue">Types.value</a>)</code></pre><div class="info">
125 val signal_nth : signal -&gt; signal -&gt; signal, symbol "[]", output(t) = input1(t)(input2(t)),
126 frequency consistent. Attention: selection index dynamic.<br>
127 </div>
128 <pre><span id="VALsignal_floor"><span class="keyword">val</span> <a href="code_VALSignal.signal_floor.html">signal_floor</a></span> : <code class="type">'a * ('b -> <a href="Types.html#TYPEvalue">Types.value</a>) -> 'a * ('b -> <a href="Types.html#TYPEvalue">Types.value</a>)</code></pre><div class="info">
129 val signal_floor : signal -&gt; signal, output(t) = v_floor(input(t)), frequency consistent.<br>
130 </div>
131 <pre><span id="VALsignal_int"><span class="keyword">val</span> <a href="code_VALSignal.signal_int.html">signal_int</a></span> : <code class="type">'a * ('b -> <a href="Types.html#TYPEvalue">Types.value</a>) -> 'a * ('b -> <a href="Types.html#TYPEvalue">Types.value</a>)</code></pre><div class="info">
132 val signal_int : signal -&gt; signal, output(t) = v_int(input(t)), frequency consistent.<br>
133 </div>
134 <pre><span id="VALsignal_sin"><span class="keyword">val</span> <a href="code_VALSignal.signal_sin.html">signal_sin</a></span> : <code class="type">'a * ('b -> <a href="Types.html#TYPEvalue">Types.value</a>) -> 'a * ('b -> <a href="Types.html#TYPEvalue">Types.value</a>)</code></pre><div class="info">
135 val signal_sin : signal -&gt; signal, output(t) = v_sin(input(t)), frequency consistent.<br>
136 </div>
137 <pre><span id="VALsignal_cos"><span class="keyword">val</span> <a href="code_VALSignal.signal_cos.html">signal_cos</a></span> : <code class="type">'a * ('b -> <a href="Types.html#TYPEvalue">Types.value</a>) -> 'a * ('b -> <a href="Types.html#TYPEvalue">Types.value</a>)</code></pre><div class="info">
138 val signal_cos : signal -&gt; signal, output(t) = v_cos(input(t)), frequency consistent.<br>
139 </div>
140 <pre><span id="VALsignal_atan"><span class="keyword">val</span> <a href="code_VALSignal.signal_atan.html">signal_atan</a></span> : <code class="type">'a * ('b -> <a href="Types.html#TYPEvalue">Types.value</a>) -> 'a * ('b -> <a href="Types.html#TYPEvalue">Types.value</a>)</code></pre><div class="info">
141 val signal_atan : signal -&gt; signal, output(t) = v_atan(input(t)), frequency consistent.<br>
142 </div>
143 <pre><span id="VALsignal_atantwo"><span class="keyword">val</span> <a href="code_VALSignal.signal_atantwo.html">signal_atantwo</a></span> : <code class="type">'a * ('b -> <a href="Types.html#TYPEvalue">Types.value</a>) -><br> 'c * ('b -> <a href="Types.html#TYPEvalue">Types.value</a>) -> 'a * ('b -> <a href="Types.html#TYPEvalue">Types.value</a>)</code></pre><pre><span id="VALsignal_sqrt"><span class="keyword">val</span> <a href="code_VALSignal.signal_sqrt.html">signal_sqrt</a></span> : <code class="type">'a * ('b -> <a href="Types.html#TYPEvalue">Types.value</a>) -> 'a * ('b -> <a href="Types.html#TYPEvalue">Types.value</a>)</code></pre><div class="info">
144 val signal_sqrt : signal -&gt; signal, output(t) = v_sqrt(input(t)), frequency consistent.<br>
145 </div>
146 <pre><span id="VALsignal_rdtable"><span class="keyword">val</span> <a href="code_VALSignal.signal_rdtable.html">signal_rdtable</a></span> : <code class="type">'a * (int -> <a href="Types.html#TYPEvalue">Types.value</a>) -><br> 'b * (int -> 'c) -> 'd * ('e -> <a href="Types.html#TYPEvalue">Types.value</a>) -> 'd * ('e -> 'c)</code></pre><div class="info">
147 val signal_rdtable : signal -&gt; signal -&gt; signal,
148 output(t) = input1(input2(t)), frequency equals to that of input2.
149 Attention: no memory implemented, very expensive when input1 comes from rec or delays.<br>
150 </div>
151 <pre><span id="VALsignal_mod"><span class="keyword">val</span> <a href="code_VALSignal.signal_mod.html">signal_mod</a></span> : <code class="type">int * ('a -> <a href="Types.html#TYPEvalue">Types.value</a>) -><br> int * ('a -> <a href="Types.html#TYPEvalue">Types.value</a>) -> int * ('a -> <a href="Types.html#TYPEvalue">Types.value</a>)</code></pre><div class="info">
152 val signal_mod : signal -&gt; signal -&gt; signal,
153 output(t) = input1(t) % input2(t), frequency consistent.<br>
154 </div>
155 <pre><span id="VALsignal_sup"><span class="keyword">val</span> <a href="code_VALSignal.signal_sup.html">signal_sup</a></span> : <code class="type">int * ('a -> <a href="Types.html#TYPEvalue">Types.value</a>) -><br> int * ('a -> <a href="Types.html#TYPEvalue">Types.value</a>) -> int * ('a -> <a href="Types.html#TYPEvalue">Types.value</a>)</code></pre><div class="info">
156 val signal_sup : signal -&gt; signal -&gt; signal,
157 output(t) = input1(t) &gt; input2(t), frequency consistent.<br>
158 </div>
159 <pre><span id="VALsignal_inf"><span class="keyword">val</span> <a href="code_VALSignal.signal_inf.html">signal_inf</a></span> : <code class="type">int * ('a -> <a href="Types.html#TYPEvalue">Types.value</a>) -><br> int * ('a -> <a href="Types.html#TYPEvalue">Types.value</a>) -> int * ('a -> <a href="Types.html#TYPEvalue">Types.value</a>)</code></pre><div class="info">
160 val signal_inf : signal -&gt; signal -&gt; signal,
161 output(t) = input1(t) &lt; input2(t), frequency consistent.<br>
162 </div>
163 <pre><span id="VALsignal_select2"><span class="keyword">val</span> <a href="code_VALSignal.signal_select2.html">signal_select2</a></span> : <code class="type">int * ('a -> <a href="Types.html#TYPEvalue">Types.value</a>) -><br> int * ('a -> 'b) -> int * ('a -> 'b) -> int * ('a -> 'b)</code></pre><div class="info">
164 val signal_select2 : signal -&gt; signal -&gt; signal -&gt; signal,
165 <code class="code">signal_select2 si s0 s1</code> selects s0 or s1 by index si, frequency consistent.<br>
166 </div>
167 <pre><span id="VALsignal_select3"><span class="keyword">val</span> <a href="code_VALSignal.signal_select3.html">signal_select3</a></span> : <code class="type">int * ('a -> <a href="Types.html#TYPEvalue">Types.value</a>) -><br> int * ('a -> 'b) -> int * ('a -> 'b) -> int * ('a -> 'b) -> int * ('a -> 'b)</code></pre><div class="info">
168 val signal_select3 : signal -&gt; signal -&gt; signal -&gt; signal -&gt; signal,
169 <code class="code">signal_select3 si s0 s1 s2</code> selects s0 or s1 or s2 by index si, frequency consistent.<br>
170 </div>
171 <pre><span id="VALsignal_prefix"><span class="keyword">val</span> <a href="code_VALSignal.signal_prefix.html">signal_prefix</a></span> : <code class="type">'a * (int -> 'b) -> 'c * (int -> 'b) -> 'c * (int -> 'b)</code></pre><div class="info">
172 val signal_prefix : signal -&gt; signal -&gt; signal,
173 <code class="code">signal_prefix s0 s1</code> returns s0(0) if t = 0, s1(t-1) if t &gt; 0, frequency same to s1.<br>
174 </div>
175 </body></html>