IMGIN = letter_j.png
LINES = 150
-BASENAME = output
-FORMAT = csv
+CSVOUT = dilation.csv
CSVIN = $(IMGIN:.png=.csv)
-CSVOUT = $(BASENAME)1.$(FORMAT)
IMGOUT = $(SRC:.dsp=.png)
all: $(IMGOUT)
octave -qf img_write.m
$(CSVOUT): $(SRC) $(CSVIN)
- faustine -f $(SRC) -i $(CSVIN) -l $(LINES) --oformat $(FORMAT) --obasename $(BASENAME)
+ faustine -f $(SRC) -l $(LINES) < $(CSVIN) 1> $@
$(CSVIN): $(IMGIN)
octave -qf img_read.m
clean::
- rm -f gmon.out $(IMGOUT) $(BASENAME)*
+ rm -f gmon.out $(IMGOUT) $(CSVOUT)
Array.init n (fun i ->
_dir ^ _basename ^ (string_of_int (i + 1)) ^ ".wav")
else if n = 1 then
- let () = Unix.unlink "_filename" in [|(_filename ^ ".wav")|]
+ let () = Unix.unlink _filename in [|_filename|]
else raise (Faustine_IO_Error ("The process has several output signals,
however stdout supports only one output signal. Please remove
the '> " ^ _filename ^ "'.")) in
Array.init n (fun i ->
_dir ^ _basename ^ (string_of_int (i + 1)) ^ ".csv")
else if n = 1 then
- let () = Unix.unlink _filename in [|(_filename ^ ".csv")|]
+ let () = Unix.unlink _filename in [|_filename|]
else raise (Faustine_IO_Error ("The process has several output signals,
however stdout supports only one output signal. Please remove
the '> " ^ _filename ^ "'.")) in
val mutable _format = ""
val mutable _basename = ""
- method private grab_format : string -> string =
- fun (path : string) ->
- let fragments = Str.split (Str.regexp "\.") path in
- let n = List.length fragments in
- List.nth fragments (n - 1)
-
method read : string list -> beam_type =
fun (paths : string list) ->
- let formats = List.map self#grab_format paths in
+ let formats = List.map format_of_file paths in
let read_one : string -> string -> beam_type =
fun (format : string) ->
fun (path : string) ->
method write : rate array -> data -> string array =
fun (rates : rate array) ->
fun (data : data) ->
- if _format = "" then
- raise (Invalid_argument "output format unset.")
- else if _format = "wav" then
- wave#write rates data
- else if _format = "csv" then
- csv#write rates data
- else raise (Invalid_argument "unknown format.")
-
+ if _output_filename = "" then (
+ if _format = "" then
+ raise (Invalid_argument "output format unset.")
+ else if _format = "wav" then
+ wave#write rates data
+ else if _format = "csv" then
+ csv#write rates data
+ else raise (Invalid_argument "unknown format."))
+ else (
+ let format = format_of_file _output_filename in
+ if format = "wav" then
+ wave#write rates data
+ else if format = "csv" then
+ csv#write rates data
+ else raise (Invalid_argument ("unknown format" ^ format)))
end;;