sig
val samples_of_seconds : int -> float -> int
val seconds_of_samples : int -> int -> float
val lin_of_dB : float -> float
val dB_of_lin : float -> float
module Sample :
sig type t = float val clip : Audio.Sample.t -> Audio.Sample.t end
module Note :
sig
type t = int
val a4 : int
val c5 : int
val c0 : int
val create : int -> int -> Audio.Note.t
val freq : Audio.Note.t -> float
val of_freq : float -> Audio.Note.t
val name : Audio.Note.t -> int
val octave : Audio.Note.t -> int
val modulo : Audio.Note.t -> int * int
val to_string : Audio.Note.t -> string
val of_string : string -> Audio.Note.t
end
module Mono :
sig
type buffer = float array
val create : int -> Audio.Mono.buffer
val blit :
Audio.Mono.buffer -> int -> Audio.Mono.buffer -> int -> int -> unit
val copy : Audio.Mono.buffer -> Audio.Mono.buffer
val duration : Audio.Mono.buffer -> int
val append :
Audio.Mono.buffer -> Audio.Mono.buffer -> Audio.Mono.buffer
val clear : Audio.Mono.buffer -> int -> int -> unit
val amplify : float -> Audio.Mono.buffer -> int -> int -> unit
val resample :
?mode:[ `Linear | `Nearest ] ->
float -> Audio.Mono.buffer -> int -> int -> Audio.Mono.buffer
val clip : Audio.Mono.buffer -> int -> int -> unit
val add :
Audio.Mono.buffer -> int -> Audio.Mono.buffer -> int -> int -> unit
val mult :
Audio.Mono.buffer -> int -> Audio.Mono.buffer -> int -> int -> unit
module Ringbuffer_ext :
sig
type elt = float
type buffer = elt array
type t
val create : int -> t
val read_space : t -> int
val write_space : t -> int
val read_advance : t -> int -> unit
val write_advance : t -> int -> unit
val read : t -> buffer -> int -> int -> unit
val peek : t -> buffer -> int -> int -> unit
val write : t -> buffer -> int -> int -> unit
val transmit : t -> (buffer -> int -> int -> int) -> int
end
module Ringbuffer :
sig
type elt = float
type buffer = elt array
type t
val create : int -> t
val read_space : t -> int
val write_space : t -> int
val read_advance : t -> int -> unit
val write_advance : t -> int -> unit
val read : t -> buffer -> int -> int -> unit
val peek : t -> buffer -> int -> int -> unit
val write : t -> buffer -> int -> int -> unit
val transmit : t -> (buffer -> int -> int -> int) -> int
end
module Buffer_ext :
sig
type t
val create : int -> Audio.Mono.Buffer_ext.t
val duration : Audio.Mono.Buffer_ext.t -> int
val prepare : Audio.Mono.Buffer_ext.t -> int -> Audio.Mono.buffer
end
module Analyze :
sig
val rms : Audio.Mono.buffer -> int -> int -> float
module FFT :
sig
type t
val init : int -> Audio.Mono.Analyze.FFT.t
val duration : Audio.Mono.Analyze.FFT.t -> int
val complex_create :
Audio.Mono.buffer -> int -> int -> Stdlib.Complex.t array
val fft :
Audio.Mono.Analyze.FFT.t -> Stdlib.Complex.t array -> unit
val band_freq : int -> Audio.Mono.Analyze.FFT.t -> int -> float
module Window :
sig
val cosine : Stdlib.Complex.t array -> unit
val hann : Stdlib.Complex.t array -> unit
val hamming : Stdlib.Complex.t array -> unit
val lanczos : Stdlib.Complex.t array -> unit
val triangular : Stdlib.Complex.t array -> unit
val bartlett_hann : Stdlib.Complex.t array -> unit
val blackman :
?alpha:float ->
Audio.Mono.Analyze.FFT.t ->
Stdlib.Complex.t array -> unit
val nuttall :
Audio.Mono.Analyze.FFT.t ->
Stdlib.Complex.t array -> unit
val blackman_harris :
Audio.Mono.Analyze.FFT.t ->
Stdlib.Complex.t array -> unit
val blackman_nuttall :
Audio.Mono.Analyze.FFT.t ->
Stdlib.Complex.t array -> unit
end
val notes :
int ->
Audio.Mono.Analyze.FFT.t ->
?window:(Stdlib.Complex.t array -> unit) ->
?note_min:int ->
?note_max:int ->
?volume_min:float ->
?filter_harmonics:bool ->
float array -> int -> int -> (Audio.Note.t * float) list
val loudest_note :
(Audio.Note.t * float) list -> (Audio.Note.t * float) option
end
end
module Effect :
sig
val compand_mu_law :
float -> Audio.Mono.buffer -> int -> int -> unit
class type t =
object
method process : Audio.Mono.buffer -> int -> int -> unit
end
class amplify : float -> t
class clip : float -> t
class biquad_filter :
int ->
[ `All_pass
| `Band_pass
| `High_pass
| `High_shelf
| `Low_pass
| `Low_shelf
| `Notch
| `Peaking ] -> ?gain:float -> float -> float -> t
module ADSR :
sig
type t
val make :
int ->
float * float * float * float -> Audio.Mono.Effect.ADSR.t
type state
val init : unit -> Audio.Mono.Effect.ADSR.state
val release :
Audio.Mono.Effect.ADSR.state -> Audio.Mono.Effect.ADSR.state
val dead : Audio.Mono.Effect.ADSR.state -> bool
val process :
Audio.Mono.Effect.ADSR.t ->
Audio.Mono.Effect.ADSR.state ->
Audio.Mono.buffer ->
int -> int -> Audio.Mono.Effect.ADSR.state
end
end
module Generator :
sig
class type t =
object
method dead : bool
method fill : Audio.Mono.buffer -> int -> int -> unit
method fill_add : Audio.Mono.buffer -> int -> int -> unit
method release : unit
method set_frequency : float -> unit
method set_volume : float -> unit
end
class sine : int -> ?volume:float -> ?phase:float -> float -> t
class square : int -> ?volume:float -> ?phase:float -> float -> t
class saw : int -> ?volume:float -> ?phase:float -> float -> t
class triangle : int -> ?volume:float -> ?phase:float -> float -> t
class white_noise : ?volume:float -> int -> t
class chain : Audio.Mono.Generator.t -> Audio.Mono.Effect.t -> t
class add : Audio.Mono.Generator.t -> Audio.Mono.Generator.t -> t
class mult : Audio.Mono.Generator.t -> Audio.Mono.Generator.t -> t
class adsr :
Audio.Mono.Effect.ADSR.t -> Audio.Mono.Generator.t -> t
end
end
type buffer = Audio.Mono.buffer array
val create : int -> int -> Audio.buffer
val create_same : Audio.buffer -> Audio.buffer
val clear : Audio.buffer -> int -> int -> unit
val copy : Audio.buffer -> Audio.buffer
val append : Audio.buffer -> Audio.buffer -> Audio.buffer
val channels : Audio.buffer -> int
val duration : Audio.buffer -> int
val to_mono : Audio.buffer -> Audio.Mono.buffer
val of_mono : Audio.Mono.buffer -> Audio.buffer
module U8 :
sig
val of_audio :
Audio.buffer -> int -> Stdlib.Bytes.t -> int -> int -> unit
val to_audio : string -> int -> Audio.buffer -> int -> int -> unit
end
module S16LE :
sig
val length : int -> int -> int
val duration : int -> int -> int
val of_audio :
Audio.buffer -> int -> Stdlib.Bytes.t -> int -> int -> unit
val make : Audio.buffer -> int -> int -> string
val to_audio : string -> int -> Audio.buffer -> int -> int -> unit
end
module S16BE :
sig
val length : int -> int -> int
val duration : int -> int -> int
val of_audio :
Audio.buffer -> int -> Stdlib.Bytes.t -> int -> int -> unit
val make : Audio.buffer -> int -> int -> string
val to_audio : string -> int -> Audio.buffer -> int -> int -> unit
end
module S24LE :
sig
val of_audio :
Audio.buffer -> int -> Stdlib.Bytes.t -> int -> int -> unit
val to_audio : string -> int -> Audio.buffer -> int -> int -> unit
end
module S32LE :
sig
val of_audio :
Audio.buffer -> int -> Stdlib.Bytes.t -> int -> int -> unit
val to_audio : string -> int -> Audio.buffer -> int -> int -> unit
end
val resample :
?mode:[ `Linear | `Nearest ] ->
float -> Audio.buffer -> int -> int -> Audio.buffer
val blit : Audio.buffer -> int -> Audio.buffer -> int -> int -> unit
val clip : Audio.buffer -> int -> int -> unit
val amplify : float -> Audio.buffer -> int -> int -> unit
val pan : float -> Audio.buffer -> int -> int -> unit
val add : Audio.buffer -> int -> Audio.buffer -> int -> int -> unit
val add_coeff :
Audio.buffer -> int -> float -> Audio.buffer -> int -> int -> unit
module Buffer_ext :
sig
type t
val create : int -> int -> Audio.Buffer_ext.t
val duration : Audio.Buffer_ext.t -> int
val prepare :
Audio.Buffer_ext.t -> ?channels:int -> int -> Audio.buffer
end
module Ringbuffer :
sig
type t
val create : int -> int -> Audio.Ringbuffer.t
val channels : Audio.Ringbuffer.t -> int
val read_space : Audio.Ringbuffer.t -> int
val write_space : Audio.Ringbuffer.t -> int
val read_advance : Audio.Ringbuffer.t -> int -> unit
val write_advance : Audio.Ringbuffer.t -> int -> unit
val peek : Audio.Ringbuffer.t -> Audio.buffer -> int -> int -> unit
val read : Audio.Ringbuffer.t -> Audio.buffer -> int -> int -> unit
val write : Audio.Ringbuffer.t -> Audio.buffer -> int -> int -> unit
val transmit :
Audio.Ringbuffer.t -> (Audio.buffer -> int -> int -> int) -> int
end
module Ringbuffer_ext :
sig
type t
val create : int -> int -> Audio.Ringbuffer_ext.t
val channels : Audio.Ringbuffer_ext.t -> int
val read_space : Audio.Ringbuffer_ext.t -> int
val write_space : Audio.Ringbuffer_ext.t -> int
val read_advance : Audio.Ringbuffer_ext.t -> int -> unit
val write_advance : Audio.Ringbuffer_ext.t -> int -> unit
val peek : Audio.Ringbuffer_ext.t -> Audio.buffer -> int -> int -> unit
val read : Audio.Ringbuffer_ext.t -> Audio.buffer -> int -> int -> unit
val write :
Audio.Ringbuffer_ext.t -> Audio.buffer -> int -> int -> unit
val transmit :
Audio.Ringbuffer_ext.t -> (Audio.buffer -> int -> int -> int) -> int
end
module Analyze :
sig val rms : Audio.buffer -> int -> int -> float array end
module Effect :
sig
class type t =
object method process : Audio.buffer -> int -> int -> unit end
class chain : Audio.Effect.t -> Audio.Effect.t -> t
class of_mono : int -> (unit -> Audio.Mono.Effect.t) -> t
class type delay_t =
object
method process : buffer -> int -> int -> unit
method set_delay : float -> unit
method set_feedback : float -> unit
end
val delay :
int ->
int ->
float ->
?once:bool -> ?ping_pong:bool -> float -> Audio.Effect.delay_t
class compress :
?attack:float ->
?release:float ->
?threshold:float ->
?ratio:float ->
?knee:float ->
?rms_window:float ->
?gain:float ->
int ->
int ->
object
method process : buffer -> int -> int -> unit
method reset : unit
method set_attack : float -> unit
method set_gain : float -> unit
method set_knee : float -> unit
method set_ratio : float -> unit
method set_release : float -> unit
method set_threshold : float -> unit
end
class biquad_filter :
int ->
int ->
[ `All_pass
| `Band_pass
| `High_pass
| `High_shelf
| `Low_pass
| `Low_shelf
| `Notch
| `Peaking ] -> ?gain:float -> float -> float -> t
val auto_gain_control :
int ->
int ->
?rms_target:float ->
?rms_window:float ->
?kup:float ->
?kdown:float ->
?rms_threshold:float ->
?volume_init:float ->
?volume_min:float -> ?volume_max:float -> unit -> Audio.Effect.t
end
module Generator :
sig
val white_noise : Audio.buffer -> int -> int -> unit
class type t =
object
method dead : bool
method fill : Audio.buffer -> int -> int -> unit
method fill_add : Audio.buffer -> int -> int -> unit
method release : unit
method set_frequency : float -> unit
method set_volume : float -> unit
end
class of_mono : Audio.Mono.Generator.t -> t
class chain : Audio.Generator.t -> Audio.Effect.t -> t
end
module IO :
sig
exception Invalid_file
exception Invalid_operation
exception End_of_stream
module Reader :
sig
class type t =
object
method channels : int
method close : unit
method duration : int
method duration_time : float
method read : Audio.buffer -> int -> int -> int
method sample_rate : int
method seek : int -> unit
end
class of_wav_file : string -> t
end
module Writer :
sig
class type t =
object
method close : unit
method write : Audio.buffer -> int -> int -> unit
end
class to_wav_file : int -> int -> string -> t
end
module RW :
sig
class type t =
object
method close : unit
method read : Audio.buffer -> int -> int -> unit
method write : Audio.buffer -> int -> int -> unit
end
class virtual bufferized :
int ->
min_duration:int ->
fill_duration:int ->
max_duration:int ->
drop_duration:int ->
object
method virtual io_read : Audio.buffer -> int -> int -> unit
method virtual io_write : Audio.buffer -> int -> int -> unit
method read : Audio.buffer -> int -> int -> unit
method write : Audio.buffer -> int -> int -> unit
end
end
end
end