npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

audio-oscillator

v3.1.1

Published

Oscillate periodic wave to array

Downloads

34

Readme

audio-oscillator Build Status unstable Greenkeeper badge

Generate periodic oscillation data.

Usage

$ npm install audio-oscillator

const oscillate = require('audio-oscillator/sine')
const output = require('web-audio-write')()

// render sine sound stream
;(async function frame() {
  await output(oscillate(new AudioBuffer({
    channels: 2, sampleRate: 44100, length: 1024
  }), 440))
  frame()
})()

API

let array = oscillate.<waveform>(length=1024|dst, frequency=440|options?)

Generate periodic-function waveform samples into a dst float array / array of arrays / AudioBuffer. If length is provided, a new mono array is created. The phase of consequently generated chunks is aligned, if the same array is passed multiple times.

let oscillate = require('audio-oscillator')

let samples = new Float64Array(1024)

oscillate.sine(samples, 440)

// output array has additional properties of the data
// samples.phase, samples.frequency, samples.detune, samples.sampleRate

// next data phase is aligned with the previous data
oscillate.sine(samples)

options

Property | Default | Meaning ---|---|--- frequency, f | 440 | Frequency of oscillations, in Hz. detune | 0 | Detune of oscillations -100...+100, in cents. phase, t | 0 | Normalized initial phase of waveform, 0..1. sampleRate, rate | 44100 | Sample rate of output data.

waveform

Available waveforms with their additional options:

Type | Waveshape | Parameters ---|---|--- 'sin' | sine | 'cos' | cosine | 'saw' | sawtooth | inverse=false 'tri' | triangle | ratio=0.5 'rect' | square | ratio=0.5 'series' | fourier | real=[0, 1], imag=[0, 0], normalize=true 'clausen' | clausen | limit=10 'step' | step | samples=10

Related

License

© 2017 Dmitry Yv. MIT License