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

soundbed

v0.1.8

Published

An ambient audio generator.

Downloads

6

Readme

Build status

soundbed

An ambient audio generator.

Use SoundBed to generate audio for animation, simulations or general ambient effects in a web browser. The module uses the Web Audo API and by default will generate a low, rumbling hum that naturally varies in frequency. Use the options below for different configurations. Your browser must support the Web Audio API.

##Install

To include soundbed as a component in your project, use the node module.

npm install soundbed --save

You can also use the standalone version and reference the js file from your document.

<html>
  <head>
    <script src="scripts/soundbed.min.js" type="text/javascript" charset="utf-8"></script>
  </head>
  ...

##Usage

The module exports a SoundBed class. In a nodejs project, you create a player via:

var SoundBed = require('../src/soundbed');
var player = new SoundBed.Player();

In the browser, the SoundBed namespace is exposed.

<html>
  <head>
    <script src="scripts/soundbed.min.js" type="text/javascript" charset="utf-8"></script>
  </head>
  <body>
    <script>
      var player = new SoundBed.Player();
      player.init({
        oscAFreq: 60,
        oscBFreq: 120,
        oscARate: 0.01,
        oscBRate: -0.01,
        freqMin: 60,
        freqMax: 120,
        volumeMin: 0.1,
        volumeMax: 1
      });
    </script>
  </body>
</html>

##Configure

By default, a SoundBed player creates two Web Audio Oscillator nodes and cycles their frequencies in opposite directions inside an RequestAnimationFrame loop. In each frame the player maps Perlin noise to a minimum/maximum range to determine the frequency. It also cycles the overall volume using the Perlin values.

You can pass the following options when initializing a Player.

  • perlin (default = true)

    When set to true, the oscillators' frequencies cycle via Perlin noise.

  • reverb

    Reverb level. Valid values are 0 - 5 and map to the following:

    0 = none

    1 = inverse

    2 = small

    3 = medium

    4 = large

    5 = huge

  • delayTime (default = 0)

    Delay time.

  • oscAFreq (default = 150)

    Oscillator A's initial frequency.

  • oscBFreq (default = 200)

    Oscillator B's initial frequency.

  • oscARate (default = 0.001)

    Oscillator A's cycle rate through its frequency min/max.

  • oscBRate (default = -0.001)

    Oscillator B's cycle rate through its frequency min/max.

  • freqMin (default = 150)

    Both oscillators' minimum frequency.

  • freqMax (default = 200)

    Both oscillators' maximum frequency.

  • volume (default = 0.25)

    The player's initial volume. Valid values between 0 and 1.

  • volumeMin (default = 0.1)

    The player's minimum volume. Valid values between 0 and 1.

  • volumeMax (default = 0.25)

    The player's maximum volume. Valid values between 0 and 1.

  • beforeStep (default = function() {})

    A function called at the beginning of each animation frame.

Please review the docs or check out the examples.

##Building this project

This project uses Grunt. To build the project first install the node modules.

npm install

Next, run grunt.

grunt

To run the tests, run 'npm test'.

npm test

To check test coverage run 'grunt coverage'.

grunt coverage

A pre-commit hook is defined in /pre-commit that runs jshint. To use the hook, run the following:

ln -s ../../pre-commit .git/hooks/pre-commit

A post-commit hook is defined in /post-commit that runs the Plato complexity analysis tools. To use the hook, run the following:

ln -s ../../post-commit .git/hooks/post-commit

View the code complexity report.