Skip to content

Latest commit

 

History

History

dsp-io-wav

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

dsp-io-wav

npm version npm downloads Twitter Follow

This project is part of the @thi.ng/umbrella monorepo.

About

WAV file format generation. This is a support package for @thi.ng/dsp.

Status

STABLE - used in production

Search or submit any issues for this package

Installation

yarn add @thi.ng/dsp-io-wav

ES module import:

<script type="module" src="https://cdn.skypack.dev/@thi.ng/dsp-io-wav"></script>

Skypack documentation

For Node.js REPL:

# with flag only for < v16
node --experimental-repl-await

> const dspIoWav = await import("@thi.ng/dsp-io-wav");

Package sizes (gzipped, pre-treeshake): ESM: 539 bytes

Dependencies

API

Generated API docs

TODO

import { osc, sin } from "@thi.ng/dsp";
import { wavByteArray } from "@thi.ng/dsp-io-wav";

const FS = 48000;

// write 1 second 24bit mono WAV file of 440Hz sine
fs.writeFileSync(
  "sine-440.wav",
  wavByteArray(
    { sampleRate: FS, channels: 1, length: FS, bits: 24 },
    osc(sin, 440 / FS)
  )
);

Authors

Karsten Schmidt

If this project contributes to an academic publication, please cite it as:

@misc{thing-dsp-io-wav,
  title = "@thi.ng/dsp-io-wav",
  author = "Karsten Schmidt",
  note = "https://thi.ng/dsp-io-wav",
  year = 2020
}

License

© 2020 - 2021 Karsten Schmidt // Apache Software License 2.0