This package has been deprecated

Author message:

That's such a waste of lifetime to publish and then deprecate npm packages

pull-audio-generator

0.1.0 • Public • Published

pull-audio-generator

Generate audio as a pull-stream source

Creates AudioBuffers using a function that returns samples between -1..1. Also takes options to configure the stream and generated audio.

pull(
  generator(Math.random, {
    duration: Infinity,
    bitDepth: 8,
    // ...
  }),
  drain(buf => {
    // got chunk
  })
)

Install

npm install --save pull-audio-generator
yarn add pull-audio-generator

Usage

generator(fn, options?)

A pull-stream source that produces AudioBuffers from fn and options. All options are inherited from audio-generator's options.

The fn takes fn(time) and returns -1..1 for all channels or [-1..1, -1..1, ...] for each channel.

pull(
  generate(time => {
    return [
      // Channel 1:
      Math.sin(Math.PI * 2 * time * 300),
      // Channel 2:
      Math.random()
    ]
  }),
  drain(buf => {
    // got chunk
  })
)

Also see

Package Sidebar

Install

npm i pull-audio-generator

Weekly Downloads

1

Version

0.1.0

License

none

Last publish

Collaborators

  • dfcreative
  • jamen