Module Audio.BufferSource

Audio buffers.

Sourcetype opts

The type for AudioBufferOptions.

Sourceval 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.

Sourcetype t

The type for AudioBuffer objects.

Sourceval create : opts -> t

create opts creates an audio buffer with given options.

Sourceval sample_rate : t -> float

sample_rate b is the sample rate of b.

Sourceval length : t -> int

length b is the length of b.

Sourceval duration_s : t -> float

duration_s b is the duration of b.

Sourceval channel_count : t -> int

channel_count b is the number of channels of b.

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

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

Sourceval 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.

Sourceval 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.