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

soundmodels

v2.7.1

Published

Sonoport Sound Models

Downloads

10

Readme

Sonoport Sound Models

Web Audio based Sound Models for creating dynamic interactive sounds.

npm version

Sound Models

Sound Models are parameterized algorithms which generate dynamic sounds in real time.

Sound Models currently available:

Texture Based Models

Texture based models use some kind of audio source (mp3, wav audio files). The support for the various types of audio files is based on the browser being used. wav and mp3 are the most widely supported file formats. Here is a good guide for knowing which codecs are supported by which browser.

DecodeThis is a good tool to check if a file of specific codec, bitrate, sample rate is support by a specific browser.

Looper

Loops the audio source continuously. Also supports looping of multiple source synchronously.

Trigger

Triggers a single playback of the audio source. Supports multiple voices and multiple simulteanous playbacks.

MultiTrigger

Triggers a repeated playback of the audio source.

Activity

Change the playback speed on an audio source based on the rate of change of a parameter.

Scrubber

Allows for 'scrubbing' of the audio source by changing which part of the audio source is being played.

Extender

Extends an audio source inifinitely without making it feel repeated.

Algorithmic Models

Coming soon...

Effects

Effects are connected to the output of these Sound Models to change some audio qualities of the Sound. Effects, just like Sound Models, also expose Parameters which can be used to control the effects in real time.

Effects currently available:

Fader

A simple Fader effect which allows the change of the volume (loudness) of the incoming audio.

Panner

A simple stereo Panner effect which allows moving of the perceived source of the audio towards the left or right side of the listener.

Filter

A simple low-order filters that can be used as a building blocks of basic tone controls (bass, mid, treble), graphic equalizers, and more advanced filters.

Compressor

Dynamics compression lowers the volume of the loudest parts of the signal and raises the volume of the softest parts. It can be used for produce, a louder, richer, and fuller sound.

Distorter

Distortion effect which tries to emulate a guitar amp distortion.

Usage

The sound models are available in two types of packages, CommonJS and AMD. The sound models are packed as UMD modules and hence usable directly as global variable as well.

Source files of the soundmodels are also available in the npm & bower packages to support libraries which are using soundmodels as a dependency. Using the source files will significantly reduced file footprint and is highly encouraged to use them rather than the compiled bundles. Use the compiled bundles if you are just requiring usage of one model in a browser environment via the <script> tag.

CommonJS (browserify)

  1. The sound models are available in an npm module which you can install using

    npm install --save-dev soundmodels

  2. The individual models can then be included in your code using nodejs style require statements.

    var Trigger = require('soundmodels/models/Trigger');
    
    var trigger = new Trigger('loop.wav');
    trigger.play();
  3. The individual models are available using the require('soundmodels/models/<model name>) scheme, while the sound effects are available using the require('soundmodels/effects/<effect name>). This helps to minimize the amount of code bundled.

  4. The CommonJS based dependencies can then be bundled using something like browserify

    browserify index.js > bundle.js

AMD (requirejs)

The are available using RequireJS for async depdencency management.

  1. To use the Sound Models, you need to have RequireJS loaded, which can be done from a CDN with this script tag

    <script type="text/javascript" src="//cdnjs.cloudflare.com/ajax/libs/require.js/2.1.11/require.min.js"></script>

  2. Also include the actual model file which you would like to use (for eg. Trigger.js).

    <script type="text/javascript" src="js/Trigger.js"></script>

  3. You can then use the loaded Sound Model using RequireJS. (For now you have to use models/Looper or models/Trigger as the names of the requirements)

    require(["models/Looper"], function (Looper) {
    	var loop = new Looper("loop.wav",function(){
    		console.log("Loaded!");
    		loop.play();
        });
       	console.log("Loading Audio File...");
    });
  4. Detailed information about rest of the API can be found in the API docs for individual Sound Models.

Build Process

The build process uses gulpjs

  • gulp build

    A concatenated file per model is placed in the build directory.

  • gulp test

    Generates a build and serves the test files in the test/manual directory.

  • gulp unittest

    Generates a build and serves the unittest files in the test/unittest directory.

  • gulp publishdocs

    API documentation is compiled and placed in the docs/api directory.

Release

The built Sound Models for the latest release are avaliable in the dist/models directory. Otherwise they can be installed using npm or bower.

Each Sound Model is packaged into a seperate UMD bundled JavaScript file (with all it's depencies bundled along). The individual files can be downloaded and added to your project, or could be linked straight from github (using the raw github URL) for testing. Refer to section on Usage for instructions on using the Models.

Here are the URLs for the currently supported Models.

| Model | URL | | ------------- |:-------------:| | Looper | https://github.com/Sonoport/soundmodels/blob/master/dist/models/Looper.js | | Trigger | https://github.com/Sonoport/soundmodels/blob/master/dist/models/Trigger.js | | MultiTrigger | https://github.com/Sonoport/soundmodels/blob/master/dist/models/MultiTrigger.js | | Scrubber | https://github.com/Sonoport/soundmodels/blob/master/dist/models/Scrubber.js | | Activity | https://github.com/Sonoport/soundmodels/blob/master/dist/models/Activity.js | | Extender | https://github.com/Sonoport/soundmodels/blob/master/dist/models/Extender.js |

Testing

Two types of tests are current supported

Manual testing.

Manual simple loads and runs some basic parameter changes on Sound Models. This can be used for basic sanity checking of Sound Models.

Manual testing can be launched using the command gulp test.

Unit testing.

A jasmine based unit test suite helps test the basic usecase of the core Sound Model library as well as the individual Sound Models.

The unit test can be launched using gulp unittest

JSM Player

JSM Player is a tool for testing the interaction and effects of the various parameters.

Source

The source for the JSM Player is now in it's seperate repo.

Project Structure

  • dist : 'compiled' artefacts for distribution
    • models : compiled Sound Models for distribution
    • core : seperated SPAudioBuffer for creating buffers
    • effect : compiled Effects to add to Sound Models
  • docs :
    • api : autogenerated API docs
    • dev : developer guide and cheat sheet
    • src : documentation source
  • core : core/shared sound functionality
  • models : individual sound models
  • effects : individual effects
  • test : source for tests
    • manual : source for manual tests
    • unit : source for unit tests

Bugs and Contact

Please raise issues if you find any bugs or want to request for new features for the Sound Models.

License

Sonoport Sound Models are licensed under the Apache License, Version 2.0. See the LICENSE file for more info.