![Oracle Drags Its Feet in the JavaScript Trademark Dispute](https://cdn.sanity.io/images/cgdhsj6q/production/919c3b22c24f93884c548d60cbb338e819ff2435-1024x1024.webp?w=400&fit=max&auto=format)
Security News
Oracle Drags Its Feet in the JavaScript Trademark Dispute
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
audio-slot
Advanced tools
Web Audio API triggerable audio slot described with JSON consisting of sources, processors, and modulators.
Web Audio API triggerable audio slot described with JSON consisting of sources, processors, and modulators.
Pass in an AudioContext extended with sources
, processors
, and modulators
and get back a single AudioNode. Because the entire setup of AudioNodes is done with a JSON object, it makes it simple and easy to persist and synchronize audio setups across a network. Used to manage each slot in soundbank.
$ npm install audio-slot
var AudioSlot = require('audio-slot')
audioContext
: instance of AudioContext extended with sources
, processors
, and modulators
lookups.
descriptor
: an object describing the desired configuration of AudioNodes. See example below.
Returns a slot
AudioNode.
A new descriptor object to update the internal nodes to. Will find and update all changed params, add new nodes and remove any unused nodes.
Trigger all source and modulator start methods.
Recommend triggering stop()
on sources at given time. This event may be ignored by some sources which specify their own off time such as oneshot samples.
Cut off playback of slot sources and modulators immediately.
Connect the slot output to another AudioNode (optionally specifying inputNumber
for nodes with multiple inputs)
Disconnect the slot from all previously connected destination AudioNodes.
var AudioSlot = require('audio-slot')
var audioContext = new webkitAudioContext()
audioContext.sources = {
sample: require('soundbank-sample'),
oscillator: require('soundbank-oscillator')
}
audioContext.processors = {
gain: audioContext.createGain.bind(audioContext), // can use built in nodes
filter: audioContext.createBiquadFilter.bind(audioContext),
delay: require('soundbank-delay')
}
audioContext.modulators = {
lfo: require('lfo'),
adsr: require('adsr')
}
audioContext.sampleCache = {}
loadAudioBuffer('/sounds/hiss.wav', function(err, buffer){
audioContext.sampleCache['hiss.wav'] = buffer
})
var slot = AudioSlot(audioContext, {
sources: [
{ node: 'sample', // coresponds to key in audioContext.sources
url: 'hiss.wav',
startOffset: 0.2,
endOffset: 1,
transpose: -3,
mode: 'loop',
amp: { // add a modulator from audioContext.modulators
node: 'adsr',
value: 1,
attack: 0.01,
decay: 0.3,
sustain: 0.6,
release: 0.4
}
}
],
processors: [
{ node: 'delay',
delayTime: 100,
wetLevel: 0.6
}
]
})
slot.connect(audioContext.destination)
// schedule a 2s playback of looped sample
slot.triggerOn(audioContext.currentTime)
slot.triggerOff(audioContext.currentTime + 2)
You can also use audio-slot instances as routing busses as by default they accept inputs from other nodes.
var bus = AudioSlot(audioContext, {
// specify how to handle trigger events
inputMode: 'on' // other options: bypass, holdOn, holdOff, bypassOn, bypassOff
processors: [
{ node: 'filter',
type: 'lowpass',
frequency: { // modulate the frequency AudioParam with an lfo
node: 'lfo',
rate: 2,
amp: 100,
value: 200
}
}
]
})
// route in another audio node
slot.connect(bus)
bus.connect(audioContext.destination)
FAQs
Web Audio API FRP wrapper for creating, routing, and triggering AudioNodes.
We found that audio-slot demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.
Security News
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.