module Encoder:sig..end
Encode native FLAC data
A typical use of the FLAC encoder is the following:
(* A function to write encoded data *)
let write = (..a function of type write..) in
(* Create the encoding callbacks *)
let callbacks = Flac.Encoder.get_callbacks write in
(* Define the parameters and comments *)
let params = (..a value of type params ..) in
let comments = [("title","FLAC encoding example")] in
(* Create an encoder *)
let enc = Flac.Encoder.create ~comments params callbacks in
(* Encode data *)
let data = (..a value of type float array array.. in
Flac.Encoder.process enc callbacks data ;
(..repeat encoding process..)
(* Close encoder *)
Flac.Encoder.finish enc callbacks
Remarks:
seek callback is given. type 'a t
Type of an encoder.
typewrite =bytes -> unit
Type of a write callback
type 'a callbacks
Type of a set of callbacks
type generic
Generic type for an encoder
type params = {
|
channels : |
|
bits_per_sample : |
|
sample_rate : |
|
compression_level : |
|
total_samples : |
Type of encoding parameters
typecomments =(string * string) list
(Vorbis) comments for encoding
exception Invalid_data
Raised when submiting invalid data to encode
val get_callbacks : ?seek:(int64 -> unit) ->
?tell:(unit -> int64) ->
write -> generic callbacksCreate a set of encoding callbacks
val create : ?comments:comments ->
params -> 'a callbacks -> 'a tCreate an encoder
val process : 'a t -> 'a callbacks -> float array array -> unitEncode some data
val finish : 'a t -> 'a callbacks -> unitTerminate an encoder. Causes the encoder to flush remaining encoded data. The encoder should not be used anymore afterwards.
val from_s16le : string -> int -> float array arrayConvert S16LE pcm data to an audio array for encoding WAV and raw PCM to flac.
module File:sig..end
Encode to a local file