1.1.6 • Published 6 years ago

svjs-audio v1.1.6

Weekly downloads
2
License
MIT
Repository
-
Last release
6 years ago

svjs-audio

Simple ES6 Module around the Web Audio API. For playing audio samples in a web page.

Demo Page

Documentation

Sample

constructor(src, props?)

The parameter props is optional, the only property for now is gain.

props = {
    gain: 1 // sets the gain (volume) of the sample, default is "1"
}

setGain(value)

Set the gain of the sample after creation.

play(when?, offset?, duration?)

Play the Sample. Parameters are optional.

AudioSprite

constructor(src, props)

props = {
    gain: 1, // optional, sets the gain (volume) of the sprite, default is "1"
    slices: { // define the slices in the sprite-file
        "sliceName1": {offset: 0, duration: 0.5},
        "sliceName2": {offset: 0.5, duration: 0.5}
        // [...]
    }
}

play(sliceName)

Play the slice named sliceName.

1.1.6

6 years ago

1.1.4

6 years ago

1.1.2

6 years ago

1.1.1

6 years ago

1.0.4

6 years ago

1.0.3

6 years ago

1.0.2

6 years ago