Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

audio-through

audiojs1.1kMITdeprecated4.0.1

Legacy. No audio in old node streams.

Process/generate audio data based on function

audio, audiojs, pcm, generator, through, web-audio, web-components

readme

audio-through Build Status unstable

Audio processor or generator constructor.

npm install audio-through

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 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.

See audio-through-stream for previous (stream) version of audio-through.

License

(c) 2017 Dmitry Yvanov @ audiojs. MIT License