Library
Module
Module type
Parameter
Class
Class type
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: * - Exceptions raised by the callbacks should be treated * as fatal. The behaviour of the FLAC encoding library is * unknown after interrupted by an exception. * - Encoded data should have the same number of channels as * specified in encoder's parameters and the same number of * samples in each channels. * - See FLAC documentation for informations about the callbacks. * Note in particular that some information about encoded data * such as md5 sum and total samples are only written when a * seek
callback is given. * - Variant types for callbacks and encoder are used to make sure * that different type of callbacks (generic, file, ogg) are always * used with the corresponding decoder type.
type params = {
channels : int;
bits_per_sample : int;
sample_rate : int;
compression_level : int option;
total_samples : int64 option;
}
Type of encoding parameters
Raised when initiating an encoder with * invalid metadata. You can use `vorbiscomment_entry_name_is_legal` * and `vorbiscomment_entry_value_is_legal` to check submitted metadata.
Create a set of encoding callbacks
Terminate an encoder. Causes the encoder to * flush remaining encoded data. The encoder should * not be used anymore afterwards.
Convert S16LE pcm data to an audio array for * encoding WAV and raw PCM to flac.
module File : sig ... end
Encode to a local file