Module Swresample

Bindings to libswresample. The interface is the one of spec/swresample.md §4.

val version : Avutil.version

The version of the libswresample loaded at run time, read once when the module is loaded.

type 'a kind

How a value of type 'a holds audio samples: its layout (interleaved or planar bytes, float arrays or bigarrays, or a frame) and either a sample format or the fact that the format is given when a converter is created. Only the data modules at the end of this interface provide values of this type.

module type AudioData = sig ... end

A data type a converter reads or writes. The modules of this type are the ones at the end of this interface, from Bytes to DblPlanarFrame; a program passes two of them to Make.

type dither_type = [
  1. | `Dither_none
  2. | `Dither_rectangular
  3. | `Dither_triangular
  4. | `Dither_triangular_highpass
  5. | `Dither_ns_lipshitz
  6. | `Dither_ns_f_weighted
  7. | `Dither_ns_modified_e_weighted
  8. | `Dither_ns_improved_e_weighted
  9. | `Dither_ns_shibata
  10. | `Dither_ns_low_shibata
  11. | `Dither_ns_high_shibata
]

The dithering method of the resampler.

type engine = [
  1. | `Engine_swr
  2. | `Engine_soxr
]

The resampling engine.

type filter_type = [
  1. | `Filter_type_cubic
  2. | `Filter_type_blackman_nuttall
  3. | `Filter_type_kaiser
]

The type of the resampling filter.

type options = [
  1. | dither_type
  2. | engine
  3. | filter_type
]

A setting of the resampler, given in the ?options list of the creation functions.

type ('i, 'o) ctx

A converter from data of type 'i to data of type 'o: it resamples, remixes channels and converts the sample format. It owns its native resampler, released when the value is collected, and keeps nothing of the values given to it or returned by it. Between calls it holds the samples the resampler buffers.

module Make (I : AudioData) (O : AudioData) : sig ... end

Converters that read values of type I.t and return values of type O.t.

type u8ba = (int, Stdlib.Bigarray.int8_unsigned_elt, Stdlib.Bigarray.c_layout) Stdlib.Bigarray.Array1.t

Unsigned 8-bit samples.

type s16ba = (int, Stdlib.Bigarray.int16_signed_elt, Stdlib.Bigarray.c_layout) Stdlib.Bigarray.Array1.t

Signed 16-bit samples.

type s32ba = (int32, Stdlib.Bigarray.int32_elt, Stdlib.Bigarray.c_layout) Stdlib.Bigarray.Array1.t

Signed 32-bit samples.

type f32ba = (float, Stdlib.Bigarray.float32_elt, Stdlib.Bigarray.c_layout) Stdlib.Bigarray.Array1.t

32-bit float samples.

type f64ba = (float, Stdlib.Bigarray.float64_elt, Stdlib.Bigarray.c_layout) Stdlib.Bigarray.Array1.t

64-bit float samples.

module Bytes : AudioData with type t = bytes

Raw samples in bytes, channels interleaved in the order of the channel layout, each sample in the machine's native representation of the sample format. The format is given at creation and is a packed one. With stereo signed 16-bit samples, three samples per channel take 12 bytes: L0 R0 L1 R1 L2 R2.

module FloatArray : AudioData with type t = float array

Samples as OCaml floats, channels interleaved: l0 r0 l1 r1 .... The sample format is `Dbl.

module PlanarFloatArray : AudioData with type t = float array array

One float array of samples per channel, in the order of the channel layout. The sample format is `Dblp.

Audio frames of the sample format given at creation, packed or planar.

module U8Bytes : AudioData with type t = bytes

As Bytes, with the sample format `U8.

module S16Bytes : AudioData with type t = bytes

As Bytes, with the sample format `S16.

module S32Bytes : AudioData with type t = bytes

As Bytes, with the sample format `S32.

module FltBytes : AudioData with type t = bytes

As Bytes, with the sample format `Flt.

module DblBytes : AudioData with type t = bytes

As Bytes, with the sample format `Dbl.

module U8PlanarBytes : AudioData with type t = bytes array

One bytes of raw samples per channel, in the order of the channel layout, each sample in the machine's native representation. The sample format is `U8p.

module S16PlanarBytes : AudioData with type t = bytes array

As U8PlanarBytes, with the sample format `S16p.

module S32PlanarBytes : AudioData with type t = bytes array

As U8PlanarBytes, with the sample format `S32p.

module FltPlanarBytes : AudioData with type t = bytes array

As U8PlanarBytes, with the sample format `Fltp.

module DblPlanarBytes : AudioData with type t = bytes array

As U8PlanarBytes, with the sample format `Dblp.

module U8BigArray : AudioData with type t = u8ba

One bigarray, one element per sample, channels interleaved. The sample format is `U8. An input bigarray is read in place; a bigarray returned is a new one.

module S16BigArray : AudioData with type t = s16ba

As U8BigArray, with the sample format `S16.

module S32BigArray : AudioData with type t = s32ba

As U8BigArray, with the sample format `S32.

module FltBigArray : AudioData with type t = f32ba

As U8BigArray, with the sample format `Flt.

module DblBigArray : AudioData with type t = f64ba

As U8BigArray, with the sample format `Dbl.

module U8PlanarBigArray : AudioData with type t = u8ba array

One bigarray per channel, in the order of the channel layout, one element per sample. The sample format is `U8p. Input bigarrays are read in place; the bigarrays returned are new ones.

module S16PlanarBigArray : AudioData with type t = s16ba array

As U8PlanarBigArray, with the sample format `S16p.

module S32PlanarBigArray : AudioData with type t = s32ba array

As U8PlanarBigArray, with the sample format `S32p.

module FltPlanarBigArray : AudioData with type t = f32ba array

As U8PlanarBigArray, with the sample format `Fltp.

module DblPlanarBigArray : AudioData with type t = f64ba array

As U8PlanarBigArray, with the sample format `Dblp.

Audio frames of the sample format `U8.

Audio frames of the sample format `S16.

Audio frames of the sample format `S32.

Audio frames of the sample format `Flt.

Audio frames of the sample format `Dbl.

Audio frames of the sample format `U8p.

Audio frames of the sample format `S16p.

Audio frames of the sample format `S32p.

Audio frames of the sample format `Fltp.

Audio frames of the sample format `Dblp.