/usr/lib/ocaml/speex/speex.mli is in libspeex-ocaml-dev 0.2.0-1build4.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 | (*
* Copyright 2003-2006 Savonet team
*
* This file is part of Ocaml-speex.
*
* Ocaml-speex is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* Ocaml-speex is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Ocaml-speex; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*)
(**
* Functions for manipulating speex audio data using libspeex.
*
* @author Romain Beauxis
*)
exception Invalid_frame_size
type mode = Narrowband | Wideband | Ultra_wideband
(* Generated by control_define *)
type control =
(** Reset the encoder/decoder memories to zero *)
SPEEX_RESET_STATE |
(** Set/get enhancement on/off (decoder only) *)
SPEEX_SET_ENH |
SPEEX_GET_ENH |
(** Obtain frame size used by encoder/decoder *)
SPEEX_GET_FRAME_SIZE |
(** Set/get quality value *)
SPEEX_SET_QUALITY |
(** Set/get sub-mode to use *)
SPEEX_SET_MODE |
SPEEX_GET_MODE |
(** Set/get low-band sub-mode to use (wideband only)*)
SPEEX_SET_LOW_MODE |
SPEEX_GET_LOW_MODE |
(** Set/get high-band sub-mode to use (wideband only)*)
SPEEX_SET_HIGH_MODE |
SPEEX_GET_HIGH_MODE |
(** Set/get VBR on (1) or off (0) *)
SPEEX_SET_VBR |
SPEEX_GET_VBR |
(** Set/get quality value for VBR encoding (0-10) *)
SPEEX_SET_VBR_QUALITY |
SPEEX_GET_VBR_QUALITY |
(** Set/get complexity of the encoder (0-10) *)
SPEEX_SET_COMPLEXITY |
SPEEX_GET_COMPLEXITY |
(** Set/get bitrate *)
SPEEX_SET_BITRATE |
SPEEX_GET_BITRATE |
(** Set/get sampling rate *)
SPEEX_SET_SAMPLING_RATE |
SPEEX_GET_SAMPLING_RATE |
(** Set/get VAD status (1 for on, 0 for off) *)
SPEEX_SET_VAD |
SPEEX_GET_VAD |
(** Set/get Average Bit-Rate (ABR) to n bits per seconds *)
SPEEX_SET_ABR |
SPEEX_GET_ABR |
(** Set/get DTX status (1 for on, 0 for off) *)
SPEEX_SET_DTX |
SPEEX_GET_DTX |
(** Set/get submode encoding in each frame (1 for yes, 0 for no, setting to no breaks the standard) *)
SPEEX_SET_SUBMODE_ENCODING |
SPEEX_GET_SUBMODE_ENCODING |
(** Set/get tuning for packet-loss concealment (expected loss rate) *)
SPEEX_SET_PLC_TUNING |
SPEEX_GET_PLC_TUNING |
(** Set/get the max bit-rate allowed in VBR mode *)
SPEEX_SET_VBR_MAX_BITRATE |
SPEEX_GET_VBR_MAX_BITRATE |
(** Turn on/off input/output high-pass filtering *)
SPEEX_SET_HIGHPASS |
SPEEX_GET_HIGHPASS |
(** Get "activity level" of the last decoded frame, i.e.
* how much damage we cause if we remove the frame *)
SPEEX_GET_ACTIVITY
module Header :
sig
(** Type for speex header. *)
type t =
{ id: string;
version: string;
version_id: int;
header_size: int;
rate: int;
mode: mode;
mode_bitstream_version: int;
nb_channels: int;
bitrate: int;
frame_size: int;
vbr: bool;
frames_per_packet: int;
extra_headers: int
}
(* Defined in speex_header.h *)
val header_string_length : int
val header_version_length : int
(** Initiate a new speex header. *)
val init :
?frames_per_packet:int ->
?mode:mode ->
?vbr:bool -> nb_channels:int -> rate:int -> unit -> t
(** [encode_header_packetout header metadata]: output ogg packets containing the header.
* First packet contains speex audio codec settings, second the metadata. *)
val encode_header_packetout : t -> (string*string) list -> Ogg.Stream.packet*Ogg.Stream.packet
(** Output ogg packets containing the header and put them into the given stream. *)
val encode_header : t -> (string*string) list -> Ogg.Stream.t -> unit
(** Decode the speex header contained in the given packet.
*
* Raises [Invalid_argument] if the packet does not contain speex audio codec data. *)
val header_of_packet : Ogg.Stream.packet -> t
(** Decode the metadata contained in the given packet.
*
* Raises [Invalid_argument] if the packet does not contain speex metadata. *)
val comments_of_packet : Ogg.Stream.packet -> string*((string*string) list)
end
module Encoder :
sig
(** Opaque type for the speex encoder. *)
type t
(** Initiate a new encoder. *)
val init : mode -> int -> t
(** Get a parameter. *)
val get : t -> control -> int
(** Set a parameter. *)
val set : t -> control -> int -> unit
(** [encode_page encoder stream f]: calls [f] to get audio data and encode it until a page is ready.
*
* Known issue: float expected values seem not to be in [-1..1] but in
* [-32768..32767] which does not seem to be correct. *)
val encode_page : t -> Ogg.Stream.t -> (unit -> float array) -> Ogg.Page.t
(** Same as [encode_page] except that it encodes stereo data into mono. *)
val encode_page_stereo : t -> Ogg.Stream.t -> (unit -> float array array) -> Ogg.Page.t
(** Same as [encode_page] but using integers. *)
val encode_page_int : t -> Ogg.Stream.t -> (unit -> int array) -> Ogg.Page.t
(** Same as [encode_page_stereo] but using integers. *)
val encode_page_int_stereo : t -> Ogg.Stream.t -> (unit -> int array array) -> Ogg.Page.t
(** Set the end of stream for this stream. *)
val eos : t -> Ogg.Stream.t -> unit
end
module Decoder :
sig
(** Opaque type for the speex decoder. *)
type t
(** Initiate a new decoder. *)
val init : mode -> t
(** Get a setting. *)
val get : t -> control -> int
(** Set a setting. *)
val set : t -> control -> int -> unit
(** Decode data. *)
val decode : t -> Ogg.Stream.t -> float array list
(** Decode stereo data. *)
val decode_stereo : t -> Ogg.Stream.t -> float array array list
(** Decode data, passing them to the given feed. *)
val decode_feed : t -> Ogg.Stream.t -> (float array -> unit) -> unit
(** Decode stereo data, passing them to the given feed. *)
val decode_feed_stereo : t -> Ogg.Stream.t -> (float array array -> unit) -> unit
(** Same as [decode] but with integers. *)
val decode_int : t -> Ogg.Stream.t -> int array list
(** Same as [decode_stereo] but with integers. *)
val decode_int_stereo : t -> Ogg.Stream.t -> int array array list
(** Same as [decode_feed] but with integers. *)
val decode_int_feed : t -> Ogg.Stream.t -> (int array -> unit) -> unit
(** Same as [decode_feed_stereo] but with integers. *)
val decode_int_feed_stereo : t -> Ogg.Stream.t -> (int array array -> unit) -> unit
end
module Wrapper :
sig
(** High level wrappers for speex. *)
module Decoder :
sig
(** High level wrapper to easily decode speex files. *)
exception Not_speex
(** Opaque type for the decoder. *)
type t
(** Open the passed [Ogg.Sync] as a new speex stream. *)
val open_sync : Ogg.Sync.t -> t
(** Open the passed file name as a new speex stream. *)
val open_file : string -> t*Unix.file_descr
(** Open the passed feed as a new speex stream. *)
val open_feed : (int -> string*int) -> t
(** Get the serial of the stream currently being decoded.
* This value may change if the stream contains sequentialized ogg streams. *)
val serial : t -> nativeint
(** Get current comments. *)
val comments : t -> (string*string) list
(** Get current header. *)
val header : t -> Header.t
(** Decode audio data. *)
val decode : t -> float array list
(** Decode stereo audio data. *)
val decode_stereo : t -> float array array list
(** Decode audio data, passing it to a feed. *)
val decode_feed : t -> (float array -> unit) -> unit
(** Same as [decode_feed] but with stereo data. *)
val decode_feed_stereo : t -> (float array array -> unit) -> unit
(** Same as [decode] but with integers. *)
val decode_int : t -> int array list
(** Same as [decode_stereo] but with integers. *)
val decode_int_stereo : t -> int array array list
(** Same as [decode_feed] but with integers. *)
val decode_int_feed : t -> (int array -> unit) -> unit
(** Same as [decode_int_feed_stereo] but with integers. *)
val decode_int_feed_stereo : t -> (int array array -> unit) -> unit
end
end
module Skeleton :
sig
(** Generate a vorbis fisbone packet with
* these parameters, to use in an ogg skeleton.
* Default value for [start_granule] is [Int64.zero],
* Default value for [headers] is ["Content-type","audio/speex"]
*
* See: http://xiph.org/ogg/doc/skeleton.html. *)
val fisbone :
?start_granule:Int64.t ->
?headers:(string * string) list ->
serialno:nativeint -> header:Header.t -> unit -> Ogg.Stream.packet
end
|