Giter Site home page Giter Site logo

soundbank-slice's Introduction

soundbank-slice

Use with soundbank-inherit to slice an audio sample across the desired amount of audio-slots.

Use as a value provider in soundbank.

Install

$ npm install soundbank-slice

Example

var Soundbank = require('soundbank')
var audioContext = new AudioContext()

audioContext.providers = {
  inherit: require('soundbank-inherit'),
  slice: require('soundbank-slice')
}

audioContext.sources = {
  sample: require('soundbank-sample')
}

audioContext.sampleCache = {}
loadBuffer('/samples/hiss.wav', function(err, buffer){
  audioContext.sampleCache['hiss.wav'] = buffer
})

var soundbank = Soundbank(audioContext)
soundbank.connect(audioContext.destination)

// configure the original slot
soundbank.update({
  id: 'slice0',
  sources: [
    { node: 'sample',
      url: 'hiss.wav',
      offset: {
        node: 'slice',
        trim: [0, 1],
        steps: 4
      }
    }
  ],
  offset: 0 // will playback from 0 to 0.25
})

// inherit from original
soundbank.update({
  id: 'slice1',
  node: 'inherit', // use inherit provider
  from: 'slice0',
  offset: 1 // will playback from 0.25 to 0.5
})
soundbank.update({
  id: 'slice2',
  node: 'inherit',
  from: 'sound0',
  offset: 2 // will playback from 0.5 to 0.75
})

// now if any changes are made to the original slot, they will also be applied to any slots that inherit from it

soundbank-slice's People

Contributors

mmckegg avatar

Stargazers

Michael Anthony avatar

Watchers

Michael Anthony avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.