SOURCE_DIR = interpretor
PREPROCESSOR_DIR = $(SOURCE_DIR)/faust-0.9.47mr3
-all: MRFausti
+all: Faustine
-MRFausti:
+Faustine:
@(cp $(SNDFILE_PATH)/sndfile_stub.o $(SOURCE_DIR))
@(cd $(SOURCE_DIR) && $(MAKE) opt OCAML_INCLUDE_PATH=$(OCAML_INCLUDE_PATH) SNDFILE_PATH=$(SNDFILE_PATH))
@(cd $(SOURCE_DIR) && $(MAKE) clean)
SOURCE_DIR = interpretor
PREPROCESSOR_DIR = $(SOURCE_DIR)/faust-0.9.47mr3
-all: MRFausti
+all: Faustine
-MRFausti:
+Faustine:
@(cp $(SNDFILE_PATH)/sndfile_stub.o $(SOURCE_DIR))
@(cd $(SOURCE_DIR) && $(MAKE) opt OCAML_INCLUDE_PATH=$(OCAML_INCLUDE_PATH) SNDFILE_PATH=$(SNDFILE_PATH))
@(cd $(SOURCE_DIR) && $(MAKE) clean)
//fft2d(x, y) = matricize(x, y) : output(x, y);
fft2d(x, y) = normalize(GREY_MAX) : matricize(x, y) : lines_fft(x, y) : matrix_transpose(x, y) : lines_fftc(y, x) : matrix_transpose(y, x) : norm_out(x, y);
+new_fft2d(x, y) = normalize(GREY_MAX) : vectorize(x) : lines_fft(x, y) : matrix_transpose(x, y) : lines_fftc(y, x) : matrix_transpose(y, x) : norm_out(x, y);
+
//safer with x=y because tests and zero padding are still to implement
-process = fft2d(32,32);
+//process = fft2d(32,32);
+process = new_fft2d(32,32);
+
+
let n3 = Array.length c in
if n1 = n2 && n1 = n3 then Array.init n1 (fun i -> f a.(i) b.(i) c.(i))
else raise (Invalid_argument "Array.map3 size not matched.");;
+
+let decorate = fun s -> " Faustine -> " ^ s;;
method output : int -> float array array array =
fun (length_max : int) ->
+ let () = print_string(" Faustine -> Calculating...") in
+ let tic = Sys.time () in
+
let transpose : 'a array array -> 'a array array =
fun matrix ->
let get_element = fun i -> fun array -> array.(i) in
container.(!index) <- Array.map value2float (self#at !index);
incr index;
done;
- transpose container
+ let result = transpose container in
+ let toc = Sys.time () in
+ let () = print_endline (" Done. (duration: " ^ (string_of_float (toc -. tic)) ^ "s.)") in
+ result
with x ->
let error_message =
| Basic_operation s -> "Basic_operation: " ^ s
| Signal_operation s -> "Signal_operation: " ^ s
| Beam_matching s -> "Beam_Matching_Error: " ^ s
- | Invalid_argument s -> "Compute finished."
+ | Invalid_argument s -> ""
| _ -> "Unknown error"
in
- let () = print_string error_message in
- transpose (Array.sub container 0 !index)
+ let () = print_string (error_message) in
+ let result = transpose (Array.sub container 0 !index) in
+ let toc = Sys.time () in
+ let () = print_endline (" Done. (duration: " ^ (string_of_float (toc -. tic)) ^ "s.)") in
+ result
method frequency : int array =
let each_rate : signal -> int =
Created: 15/05/2013 Modified: 14/08/2013
*)
+open Aux;;
open Process;;
open Faustio;;
let wave = new waveio in
let csv = new csvio in
- let input = wave#read (Array.of_list !inwavs) in
+ let input_wave = wave#read (Array.of_list !inwavs) in
+ let input_csv = csv#read (Array.of_list !incsvs) in
+ let input = input_wave#append input_csv in
+
+ let () = print_string(" Faustine -> Preprocessing...") in
+ let tic1 = Sys.time () in
let faust_core = Preprocess.preprocess !path_dsp in
+ let toc1 = Sys.time () in
+ let () = print_endline(" Done. (duration: " ^ (string_of_float (toc1 -. tic1)) ^ "s.)") in
+
+
+ let () = print_string(" Faustine -> Interpretation...") in
+ let tic2 = Sys.time () in
let faust_exp = exp_of_string faust_core in
let proc = (new proc_factory)#make faust_exp in
+ let toc2 = Sys.time () in
+ let () = print_endline(" Done. (duration: " ^ (string_of_float (toc2 -. tic2)) ^ "s.)") in
+
+
let output = proc#eval input in
let data = output#output time_maximum in
let rates = output#frequency in
let output_wave_paths = wave#write rates data in
- let _ = csv#write rates data in
- let _ = Array.map print_endline output_wave_paths in
+ let output_csv_paths = csv#write rates data in
+ let _ = Array.map print_endline
+ (Array.map decorate output_wave_paths) in
+ let _ = Array.map print_endline
+ (Array.map decorate output_csv_paths) in
();;