Socket
Socket
Sign inDemoInstall

@lidcore/bs-wav

Package Overview
Dependencies
3
Maintainers
3
Versions
4
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @lidcore/bs-wav

Wav parser and writter written for Bucklescript/node.js using Callback monad.


Version published
Maintainers
3
Created

Readme

Source

@lidcore/bs-wav

Wav parser and writter written for Bucklescript/node.js using Callback monad.

This provides a simple API to read and WAV files. It also examplifies how to use Bucklescript, @lidcore/bs-node and bs-async-monad to write sane asynchronous code.

Current API:

open BsAsyncMonad
open LidcoreBsNode

type format_code =
  | PCM         [@bs.as 0x0001]
  | IEEE_FLOAT  [@bs.as 0x0003]
  | ALAW        [@bs.as 0x0006]
  | MULAW       [@bs.as 0x0007]
  | EXTENSIBLE  [@bs.as 0xFFFE]
[@@bs.deriving jsConverter]

type wav_header = {
  channels         : int; (* 1 = mono ; 2 = stereo *)
  format_code      : int; (* See above *)
  sample_rate      : int; (* in Hz *)
  bytes_per_second : int;
  bytes_per_sample : int; (* 1=8 bit Mono, 2=8 bit Stereo *)
                          (* or 16 bit Mono, 4=16 bit Stereo *)
  bits_per_sample  : int;
} [@@bs.deriving abstract]

type t = {
  header      : wav_header;
  data_offset : int;
  duration    : float
} [@@bs.deriving abstract]

exception Not_a_wav_file of string
exception Not_supported

val read : string -> t Callback.t

(* fails with [Not_supported] for any format_code that isn't PCM. *)
val write : header:wav_header -> data:Buffer.t -> string -> unit Callback.t

Keywords

FAQs

Last updated on 09 Jan 2019

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc