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

soundbank-chunk

v2.4.0

Published

A group of triggerable sound descriptors to be positioned on a loop-grid and played with soundbank.

Downloads

12

Readme

soundbank-chunk

A group of triggerable sound descriptors to be positioned on a loop-grid and played with soundbank.

Implements observ for easy data-binding to your views.

Install via npm

$ npm install loop-grid

API

var Chunk = require('soundbank-chunk')

var chunk = Chunk(opts)

opts

  • soundbank: (required) Specify the instance of soundbank you wish to wrap. This chunk will be immediately added to the soundbank, with the IDs by default namespaced with the chunk id.
  • getGlobalId: Override the internal id resolver with function(chunkId, soundId).

Returns an observable/bindable chunk.


// set up a soundbank
var audioContext = new AudioContext() // web audio api
var Soundbank = require('soundbank')
audioContext.sources = {
  sample: require('soundbank-sample')
}
audioContext.processors = {
  overdrive: require('soundbank-overdrive')
}
audioContext.loadSample = function(src, cb){
  // callback with AudioBuffer resolved from src
}
var soundbank = Soundbank(audioContext)

// create instance wrapping soundbank above
var chunk = Chunk(soundbank, {
  id: 'drums',
  slots: [ // slots to get added to soundbank (namespaced by chunk.id or getUniqueId())
    {id: 'kick', sources: [{node: 'sample', url: 'kick.wav'}], output: 'post'},
    {id: 'snare', sources: [{node: 'sample', url: 'snare.wav'}], output: 'post'},
    {id: 'hihat', sources: [{node: 'sample', url: 'hihat.wav'}], output: 'post'},
    {id: 'openhat', sources: [{node: 'sample', url: 'openhat.wav'}], output: 'post'},
    {id: 'post', processors: [{node: 'overdrive'}]}
  ],
  shape: [2, 2], // 2 across, 2 down
  sounds: ['kick', 'snare', 'hihat', 'openhat'], // what to put on grid
  outputs: ['post'], // expose outputs to other chunks
})

// put this chunk on a launchpad
var launchpad = require('loop-launchpad')(
  midi: MidiStream('Launchpad Mini'),
  player: player, 
  recorder: recorder
)

launchpad.add(chunk, 0, 0) // place starting at top-left corner

chunk.set(descriptor)

Update all properties to reflect the new descriptor.

chunk()

Returns the current descriptor value as set.

chunk(function callback(descriptor){ ... })

The callback is called with the new descriptor value on every change.

chunk.grid Observ(ArrayGrid)

Get the resolved trigger IDs mapped to an ArrayGrid using shape and stride values.

Returns an ArrayGrid wrapped by an Observ instance that notifies on change.

Observable Properties

chunk.title (Observ)

A display title for this chunk.

chunk.slots (ObservArray)

The soundbank slot descriptors used by this chunk. Update sounds by modifying this array.

chunk.triggers (ObservArray)

The slot ids to include on the grid. They will be shaped by chunk.shape and chunk.stride.

chunk.shape (Observ)

chunk.stride (Observ)

chunk.routes (ObservVarhash)

Route the output from slots in this chunk to IDs in other chunks.

chunk.inputs (Observ)

List of slot ids to accept input routing from chunks.

chunk.outputs (Observ)

List of slot ids to suggest output routing to other chunks.