New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@lidcore/bs-wav

Package Overview
Dependencies
Maintainers
3
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

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.

0.1.3
latest
npm
Version published
Maintainers
3
Created
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

BuckleScript

FAQs

Package last updated on 09 Jan 2019

Did you know?

Socket

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