Module Audio.Buffer

Audio buffers.

type opts

The type for AudioBufferOptions.

val opts : channel_count:int -> length:int -> sample_rate_hz:float -> unit -> opts

opts ~channel_count ~length ~sample_rate_ht () are audio context options with the given properties.

type t

The type for AudioBuffer objects.

val create : opts -> t

create opts creates an audio buffer with given options.

val sample_rate : t -> float

sample_rate b is the sample rate of b.

val length : t -> int

length b is the length of b.

val duration_s : t -> float

duration_s b is the duration of b.

val channel_count : t -> int

channel_count b is the number of channels of b.

val get_channel_data : t -> channel:int -> Brr.Tarray.float32

get_channel_data b ~channel is the channel data of channel in b.

val copy_from_channel : ?⁠dst_start:int -> t -> channel:int -> dst:Brr.Tarray.float32 -> unit

copy_from_channel b ~channel ~dst copies data of channel channel of b into dst.

val copy_to_channel : ?⁠dst_start:int -> t -> src:Brr.Tarray.float32 -> channel:int -> unit

copy_to_channel b ~src ~channel copies data of src to channel channel of b.