1 <!DOCTYPE HTML PUBLIC
"-//W3C//DTD HTML 4.01 Transitional//EN">
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>
25 <div class=
"navbar"><a href=
"Value.html">Previous
</a>
26 <a href=
"index.html">Up
</a>
27 <a href=
"Faustexp.html">Next
</a>
29 <center><h1>Module
<a href=
"type_Signal.html">Signal
</a></h1></center>
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 -
> value), operations of signals.
<br>
33 <b>Author(s):
</b> WANG Haisheng
34 Created:
03/
06/
2013 Modified:
03/
06/
2013<br>
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>
38 Exception raised in operations of signals.
<br>
40 <br><code><span id=
"TYPEsignal_macro"><span class=
"keyword">type
</span> <code class=
"type"></code>signal_macro
</span> =
</code><table class=
"typetable">
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>
50 Macro constants of the file.
<br>
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 -
> int.
<br>
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 -
> int, returns the frequency of a signal.
<br>
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 -
> (int -
> value), returns the functional part of a signal.
<br>
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 -
> int -
> int, returns the correction of frequency.
<br>
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 -
> signal -
> int,
67 checks the frequencies of two input signals, and returns common frequency or raise an exception.
<br>
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 -
> signal -
> signal -
> int,
71 checks the frequencies of three input signal, and returns common frequency or raise an exception.
<br>
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 -
> signal -
> signal -
> signal -
> int,
75 checks the frequencies of three input signal, and returns common frequency or raise an exception.
<br>
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 -
> signal,
79 returns the signal with memory of one latest sample.
<br>
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 -
> signal list,
83 adds memory of one latest sample for each element in signal list.
<br>
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 -
> signal -
> signal, output(t) = input1(t) + input2(t),
87 frequency consistent.
<br>
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 -
> signal, output(t) = -input(t), frequency consistent.
<br>
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 -
> signal -
> signal, output(t) = input1(t) - input2(t),
94 frequency consistent.
<br>
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 -
> signal -
> signal, output(t) = input1(t) * input2(t),
98 frequency consistent.
<br>
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 -
> signal -
> signal, output(t) = input1(t) / input2(t),
102 frequency consistent.
<br>
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 -
> signal -
> signal, output(t) = input1(t - input2(t)),
106 Attention: delay dynamic, frequency of output signal equals to that of first input signal.
<br>
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 -
> signal, equivalent to signal_delay with constant delay
1.
<br>
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 -
> signal -
> 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>
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 -
> 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>
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 -
> signal -
> signal, symbol
"#",
122 appends vectors of the two input signals at each time, frequency consistent.
<br>
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 -
> signal -
> signal, symbol
"[]", output(t) = input1(t)(input2(t)),
126 frequency consistent. Attention: selection index dynamic.
<br>
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 -
> signal, output(t) = v_floor(input(t)), frequency consistent.
<br>
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 -
> signal, output(t) = v_int(input(t)), frequency consistent.
<br>
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 -
> signal, output(t) = v_sin(input(t)), frequency consistent.
<br>
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 -
> signal, output(t) = v_cos(input(t)), frequency consistent.
<br>
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 -
> signal, output(t) = v_atan(input(t)), frequency consistent.
<br>
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 -
> signal, output(t) = v_sqrt(input(t)), frequency consistent.
<br>
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 -
> signal -
> 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>
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 -
> signal -
> signal,
153 output(t) = input1(t) % input2(t), frequency consistent.
<br>
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 -
> signal -
> signal,
157 output(t) = input1(t)
> input2(t), frequency consistent.
<br>
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 -
> signal -
> signal,
161 output(t) = input1(t)
< input2(t), frequency consistent.
<br>
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 -
> signal -
> signal -
> signal,
165 <code class=
"code">signal_select2 si s0 s1
</code> selects s0 or s1 by index si, frequency consistent.
<br>
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 -
> signal -
> signal -
> signal -
> signal,
169 <code class=
"code">signal_select3 si s0 s1 s2
</code> selects s0 or s1 or s2 by index si, frequency consistent.
<br>
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 -
> signal -
> signal,
173 <code class=
"code">signal_prefix s0 s1
</code> returns s0(
0) if t =
0, s1(t-
1) if t
> 0, frequency same to s1.
<br>