X-Git-Url: https://svn.cri.ensmp.fr/git/Faustine.git/blobdiff_plain/d8214dc258396483f72533504515a4e1d1b3deef..f59ac471aa5a080301d70e7d7e1e81f34151ba2f:/interpretor/faustio.ml?ds=sidebyside diff --git a/interpretor/faustio.ml b/interpretor/faustio.ml index 25a2868..b9c7598 100644 --- a/interpretor/faustio.ml +++ b/interpretor/faustio.ml @@ -17,13 +17,10 @@ let default_output_path = "../output_sounds/";; class virtual io = object method virtual read : string array -> beam - method virtual write : int array -> value_type array array -> string array - method private to_float : value_type array array -> float array array = - fun (origin : value_type array array) -> - let data = - let value2float = fun (v : value_type) -> v#to_float_array in - Array.map (Array.map value2float) origin in - Array.map Array.concat (Array.map Array.to_list data) + method virtual write : int array -> float array array array -> string array + method private concat : float array array array -> float array array = + fun (origin : float array array array) -> + Array.map Array.concat (Array.map Array.to_list origin) end;; class waveio : io_type = @@ -49,9 +46,9 @@ class waveio : io_type = array_map2 (new signal) rates (Array.map stream2func containers) in new beam signals - method write : int array -> value_type array array -> string array = + method write : int array -> float array array array -> string array = fun (rates : int array) -> - fun (output : value_type array array) -> + fun (output : float array array array) -> let () = print_string(" Faustine -> Writing wave files...") in let tic = Sys.time () in @@ -63,17 +60,16 @@ class waveio : io_type = let channels = let get_channel = fun s -> let l = Array.length s in - match s.(l - 1)#get with - | Vec vec -> vec#size - | _ -> 1 in + Array.length s.(l - 1) 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, file_format, channel, rate) path in array_map3 openwr paths channels rates in + let () = - let data = self#to_float output in + let data = self#concat output in let _ = array_map2 Sndfile.write files data in let _ = Array.map Sndfile.close files in let toc = Sys.time () in