Module AFrame


module AFrame: sig .. end
Specialization of Frame for content kinds restricted to audio, with a fixed number of channels. All units are in audio samples instead of master clock ticks.


Types


type t = Frame.t 

Basic manipulation


val duration : unit -> float
Duration in seconds.

Breaks

Breaks are track limits. Everything below is in samples.
val size : unit -> int
Size of an audio frame.
val position : t -> int
Current position in frame.
val breaks : t -> int list
Breaks in frame.
val add_break : t -> int -> unit
Add a break.
val set_breaks : t -> int list -> unit
Change all the breaks.
val is_partial : t -> bool
Is it partially filled ?
val clear : t -> unit
Reset breaks.
val advance : t -> unit
Reset breaks and metadata, but leaves the last metadata at position -1.

Metadatas handling


exception No_metadata
type metadata = (string, string) Hashtbl.t 
val free_metadata : t -> int -> unit
val set_metadata : t -> int -> metadata -> unit
val get_metadata : t -> int -> metadata option
val free_all_metadata : t -> unit
val get_all_metadata : t -> (int * metadata) list
val set_all_metadata : t -> (int * metadata) list -> unit

Chunks


exception No_chunk
val get_chunk : t -> t -> unit

Helpers


val content : t -> int -> float array array
Get audio contents for access after a given offset. This requires that the frame currently has a purely audio layer at this position, until the end of the frame.
val content_of_type : channels:int -> t -> int -> float array array
Get audio contents for writing after a given offset. If necessary this creates an audio layer starting there.
val to_s16le : t -> string
Same as content with offset=0, converted to s16le.

Sound processing


val blankify : t -> int -> int -> unit
blankify frame off len blanks the frame at offset off for length len (in samples).
val multiply : t -> int -> int -> float -> unit
multiply frame off len x multiplies the audio data of the frame from offset off during length len by coefficent x.
val add : t -> int -> t -> int -> int -> unit
Add two portions of frames of same length.
val rms : t -> int -> int -> float array
RMS (root mean square) of a portion of a frame.