# audio-through

> Process/generate audio data based on function

Latest version **4.0.1** (published 2018-01-26) · MIT license · 0 weekly downloads

> **Deprecated.** This package is deprecated.

## Install

```sh
npm install audio-through
pnpm add audio-through
yarn add audio-through
bun add audio-through
```

## Health

**Score 10/100 (F)** — status: deprecated.

Negative: deprecated.

## Facts

| | |
|---|---|
| Version | 4.0.1 |
| Published | 2018-01-26 |
| First published | 2016-01-25 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 5 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 6 |
| Author | Dmitry Yvanov |
| Maintainers | dfcreative |
| Keywords | audio, audiojs, pcm, generator, through, web-audio, web-components |

## Links

- npm: https://www.npmjs.com/package/audio-through
- Repository: https://github.com/audiojs/audio-through
- Issues: https://github.com/audiojs/audio-through/issues
- npm.io page: https://npm.io/package/audio-through

## Dependencies (5)

- [defined](https://npm.io/package/defined.md) ^1.0.0
- [pcm-convert](https://npm.io/package/pcm-convert.md) ^1.6.4
- [audio-format](https://npm.io/package/audio-format.md) ^2.3.0
- [is-audio-buffer](https://npm.io/package/is-audio-buffer.md) ^1.0.11
- [audio-buffer-from](https://npm.io/package/audio-buffer-from.md) ^1.0.3

## Alternatives

- [byte-size](https://npm.io/package/byte-size.md) — 2.1M weekly downloads
- [speed-limiter](https://npm.io/package/speed-limiter.md) — 16.0K weekly downloads
- [@powersync/node](https://npm.io/package/@powersync/node.md) — 10.9K weekly downloads
- [@ledgerhq/coin-cardano](https://npm.io/package/@ledgerhq/coin-cardano.md) — 1.0K weekly downloads
- [@jayesol/jayeson.lib.streamfinder](https://npm.io/package/@jayesol/jayeson.lib.streamfinder.md) — 1.0K weekly downloads

## Recent versions

- 4.0.1 (latest) — 2018-01-26
- 4.0.0 — 2018-01-26
- 2.2.3 — 2017-04-30
- 2.2.2 — 2017-04-12
- 2.2.1 — 2017-04-12
- 2.2.0 — 2017-04-12
- 2.1.9 — 2016-08-30
- 2.1.8 — 2016-08-29
- 2.1.7 — 2016-08-29
- 2.1.6 — 2016-08-28
- 2.1.5 — 2016-08-28
- 2.1.4 — 2016-08-28
- 2.1.3 — 2016-08-26
- 2.1.2 — 2016-08-26
- 2.1.1 — 2016-08-26
- … 21 more at https://npm.io/package/audio-through/versions

## README

# audio-through [![Build Status](https://travis-ci.org/audiojs/audio-through.svg?branch=master)](https://travis-ci.org/audiojs/audio-through) [![unstable](http://badges.github.io/stability-badges/dist/unstable.svg)](http://github.com/badges/stability-badges)

Audio processor or generator constructor.

[![npm install audio-through](https://nodei.co/npm/audio-through.png?mini=true)](https://npmjs.org/package/audio-through/)

```js
let createThrough = require('audio-through')
let write = require('audio-speaker')()

// panned sine generator
let through = createThrough(
  (channelData, state, ...args) => {
  let [left, right, ...rest] = channelData
  let {time, count, format} = state

  // modify channels data here
}, 'stereo audiobuffer')

// hook up createThrough → speaker loop
(function tick () {
	write(through(), tick);
})()
```

### `createThrough(fn, format='array')`

Takes channel processing function and format, returns a function generating audio data of the indicated format.

Output data format can be a string `'planar stereo array'`, `'5.1 audiobuffer 44100'` etc., or an object with format properties. See [audio-format](https://github.com/audiojs/audio-format) for full disclosure.

### `through(target|length=1024)`

Fill passed `target` or create a new one of the `length`, based on `fn` from the constructor. Target type is defined by `format`.

## Related

See [audio-through-stream](https://github.com/audiojs/audio-through-stream) for previous (stream) version of audio-through.

## License

(c) 2017 Dmitry Yvanov @ audiojs. MIT License

---
_Source: https://npm.io/package/audio-through · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
