*)
open Types;;
+open Basic;;
+open Value;;
+open Signal;;
open Beam;;
open Aux;;
else
let signals =
let files = Array.map Sndfile.openfile paths in
- let frames = Array.map Int64.to_int (Array.map Sndfile.frames files) in
+ let frames = Array.map Int64.to_int
+ (Array.map Sndfile.frames files) in
let rates = Array.map Sndfile.samplerate files in
let create_container = fun l -> Array.create l 1. in
let containers = Array.map create_container frames in
let _ = array_map2 Sndfile.read files containers in
let _ = Array.map Sndfile.close files in
- array_map2 (new signal) rates containers in
+ let stream2func =
+ fun stream -> fun t -> new value (R stream.(t)) in
+ array_map2 (new signal) rates (Array.map stream2func containers) in
new beam signals
method write : int array -> value_type array array -> string array =
let n = Array.length output in
let paths = Array.init n (fun i ->
- default_output_path ^ "output" ^ (string_of_int i) ^ ".wav") in
+ default_output_path ^ "output" ^ (string_of_int (i + 1)) ^ ".wav") in
let files =
let channels =
- let get_channel = fun l -> fun s ->
+ let get_channel = fun s ->
+ let l = Array.length s in
match s.(l - 1)#get with
| Vec vec -> vec#size
| _ -> 1 in
- Array.map (get_channel n) output in
- let format = Sndfile.format Sndfile.MAJOR_WAV Sndfile.MINOR_PCM_16 in
+ Array.map get_channel output in
+ let file_format = Sndfile.format
+ Sndfile.MAJOR_WAV Sndfile.MINOR_PCM_16 in
let openwr = fun path -> fun channel -> fun rate ->
- Sndfile.openfile ~info:(Sndfile.RDWR, format, channel, rate) path in
- array_map3 openwr paths channels rates in
-
+ Sndfile.openfile ~info:(Sndfile.RDWR, file_format, channel, rate) path in
+ array_map3 openwr paths channels rates in
let () =
let data = self#to_float output in
let _ = array_map2 Sndfile.write files data in
let _ = Array.map Sndfile.close files in
let toc = Sys.time () in
let duration = toc -. tic in
- Print_endline
+ print_endline
(" Done. (duration: " ^ (string_of_float duration) ^ "s)") in
paths
end;;
+
(*
class csvio : io_type =
object (self)
end;;
*)
+
+(*
let csvread = fun (ic : in_channel) ->
let string_list = ref [] in
try
let read_input_csv = fun argv ->
let n_input = (Array.length argv) - 4 in
if n_input < 0 then
- raise Missing_Expression
+ raise (Invalid_argument "xxx")
else if n_input = 0 then
([], [])
else
let toc = Sys.time () in
print_endline(" Done. (duration: " ^ (string_of_float (toc -. tic)) ^ "s)");;
+*)