2 <link rel=
"stylesheet" href=
"style.css" type=
"text/css">
3 <meta content=
"text/html; charset=iso-8859-1" http-equiv=
"Content-Type">
4 <link rel=
"Start" href=
"index.html">
5 <link title=
"Index of types" rel=Appendix
href=
"index_types.html">
6 <link title=
"Index of exceptions" rel=Appendix
href=
"index_exceptions.html">
7 <link title=
"Index of values" rel=Appendix
href=
"index_values.html">
8 <link title=
"Index of modules" rel=Appendix
href=
"index_modules.html">
9 <link title=
"Types" rel=
"Chapter" href=
"Types.html">
10 <link title=
"Parser" rel=
"Chapter" href=
"Parser.html">
11 <link title=
"Lexer" rel=
"Chapter" href=
"Lexer.html">
12 <link title=
"Value" rel=
"Chapter" href=
"Value.html">
13 <link title=
"Signal" rel=
"Chapter" href=
"Signal.html">
14 <link title=
"Faustexp" rel=
"Chapter" href=
"Faustexp.html">
15 <link title=
"Interpreter" rel=
"Chapter" href=
"Interpreter.html">
16 <link title=
"Preprocess" rel=
"Chapter" href=
"Preprocess.html">
17 <link title=
"Main" rel=
"Chapter" href=
"Main.html"><title>Main.read_input_wave
</title>
20 <code class=
"code"><span class=
"keyword">let
</span> read_input_wave
=
<span class=
"keyword">fun
</span> argv
<span class=
"keywordsign">-
></span><br>
21 <span class=
"keyword">let
</span> n_input
=
(
<span class=
"constructor">Array
</span>.length
argv)
-
3 <span class=
"keyword">in
</span><br>
22 <span class=
"keyword">if
</span> n_input
< 0 <span class=
"keyword">then
</span> <br>
23 raise
<span class=
"constructor">Missing_Expression
</span><br>
24 <span class=
"keyword">else
</span> <span class=
"keyword">if
</span> n_input
=
0 <span class=
"keyword">then
</span> <br>
25 ([],
[])
<br>
26 <span class=
"keyword">else
</span><br>
27 <span class=
"comment">(*
open
wave
file
*)
</span><br>
28 <span class=
"keyword">let
</span> file_string_array
=
<span class=
"constructor">Array
</span>.sub
argv
3 n_input
<span class=
"keyword">in
</span><br>
29 <span class=
"keyword">let
</span> make_chemin
s
=
io_macro_to_string
<span class=
"constructor">Input_Route_string
</span> ^
s
<span class=
"keyword">in
</span><br>
30 <span class=
"keyword">let
</span> file_chemin_string_array
=
<span class=
"constructor">Array
</span>.map
make_chemin
file_string_array
<span class=
"keyword">in
</span><br>
31 <span class=
"keyword">let
</span> file_array
=
<span class=
"constructor">Array
</span>.map
<span class=
"constructor">Sndfile
</span>.openfile
file_chemin_string_array
<span class=
"keyword">in
</span><br>
32 <span class=
"keyword">let
</span> file_list
=
<span class=
"constructor">Array
</span>.to_list
file_array
<span class=
"keyword">in
</span><br>
34 <span class=
"comment">(*
prepare
data
container
*)
</span><br>
35 <span class=
"keyword">let
</span> frames_array
=
<span class=
"constructor">Array
</span>.map
<span class=
"constructor">Int64
</span>.to_int
(
<span class=
"constructor">Array
</span>.map
<span class=
"constructor">Sndfile
</span>.frames
file_array)
<span class=
"keyword">in
</span><br>
36 <span class=
"keyword">let
</span> create_data_array
num
=
<span class=
"constructor">Array
</span>.create
num
1.
<span class=
"keyword">in
</span><br>
37 <span class=
"keyword">let
</span> data_float_array_array
=
<span class=
"constructor">Array
</span>.map
create_data_array
frames_array
<span class=
"keyword">in
</span><br>
38 <span class=
"keyword">let
</span> data_float_array_list
=
<span class=
"constructor">Array
</span>.to_list
data_float_array_array
<span class=
"keyword">in
</span><br>
39 <br>
40 <span class=
"comment">(*
read
sample
rates
and
data
*)
</span><br>
41 <span class=
"keyword">let
</span> rate_list
=
<span class=
"constructor">List
</span>.map
<span class=
"constructor">Sndfile
</span>.samplerate
file_list
<span class=
"keyword">in
</span><br>
42 <span class=
"keyword">let
</span> _
=
<span class=
"constructor">List
</span>.map2
<span class=
"constructor">Sndfile
</span>.read
file_list
data_float_array_list
<span class=
"keyword">in
</span><br>
43 <span class=
"keyword">let
</span> _
=
<span class=
"constructor">List
</span>.map
<span class=
"constructor">Sndfile
</span>.close
file_list
<span class=
"keyword">in
</span><br>
44 (rate_list,
data_float_array_list)
</code></body></html>