Security News
RubyGems.org Adds New Maintainer Role
RubyGems.org has added a new "maintainer" role that allows for publishing new versions of gems. This new permission type is aimed at improving security for gem owners and the service overall.
audio-buffer-list
Advanced tools
Extension of BufferList for AudioBuffers. Handy and performant to deal with (possibly long) sequence of audio buffers − accumulate, read, stream, modify, delete etc.
const AudioBufferList = require('audio-buffer-list')
const AudioBuffer = require('audio-buffer')
let abl = new AudioBufferList(new AudioBuffer(1, [0, .1, .2, .3]), new AudioBuffer(1, 100))
abl.append(new AudioBuffer(1, 100))
abl.length // 204
abl.slice() // <AudioBuffer 0, .1, .2, .3, 0...>
new AudioBufferList(source, options?)
Creates new audio buffer list instance, new
is not strictly required.
source
can be AudioBuffer, AudioBuffer array, AudioBufferList or AudioBufferList array.
options
may provide numberOfChannels
, context
for web audio API context and sampleRate
.
list.buffers
Sequence of audio buffers with actual data.
list.length
Total length of list in samples, i.e. sum of inner buffer lengths.
list.duration
Total duration of the audio list, i.e. sum of buffers durations.
list.numberOfChannels
Detected from the buffer with max number of channels in the list. Can be set by options.
list.sampleRate
Just for convenience with AudioBuffer interface.
list.offset(sample)
Return [bufIdx, offset]
pair for any sample number. bufIdx
is the number of buffer in the list, offset
is sample offset inside of that buffer.
list.append(buffer)
Insert new AudioBuffer, AudioBufferList or array of them to the end.
list.insert(offset=0, buffer)
Put new AudioBuffer, AudioBufferList or array of them at the offset.
list.remove(offset=0, count)
Remove number of samples from the list starting at the offset
. count
can possibly be negative, then items are removed on the left side from the offset. offset
can also be negative, meaning to remove from the end. Retuns removed sublist instance.
list.delete(offset=0, count)
Same as list.remove
, but returns current list with deleted part being lost. That allows for different type of chainability.
list.consume(count)
Delete data from the beginning. Returns current list.
list.slice(start=0, end=-0)
Return sublist of the initial list. The data is not copied but returned as subarrays. list.slice()
just creates a duplicate that way.
list.clone(start=0, end=-0)
Return copy of the list, consisting of cloned buffers.
list.map((buffer, index, offset) => buffer|bool?, from=0, to=-0)
Create new list by mapping every buffer. Optionally pass offsets from
and to
to map only buffers covering the subset, keeping the rest unchanged. If no buffer returned from the mapper function then the old buffer will be preserved. If null
returned then the buffer will be discarded. offset
tracks buffer
offset in new list, index
reflects buffer count.
list = list.map((buf, idx, offset) => {
for (let c = 0; c < channels; c++) {
let data = buf.getChannelData(channel)
//start buffer from the subset may start earlier than the subset
//end buffer from the subset may end later than the subset
for (let i = Math.max(from - offset, 0),
l = Math.min(to - offset, buf.length);
i < l; i++) {
data[i] = process(data[i])
}
}
}, from, to)
list.each((buffer, index, offset) => {}, from=0, to=-0, {reversed}?)
Iterate over buffers from the indicated range. Buffers can be modified in-place during the iterating. Return false
to break the loop. Pass {reversed: true}
as the last argument to iterate in reverse order.
list.reverse(start=0, end=-0)
Reverse indicated part of the list. Modifies list in place, returns self.
list.repeat(count)
Repeats contents of the list specified number of times. Modifies list in-place, returns self.
list.getChannelData(channel, from=0, to=-0)
Return FloatArray with merged data for the channel.
list.copy(dest?, start=0, end=-0)
Put data into destination AudioBuffer or create one.
list.copyFromChannel(arr, channel, startInChannel=0)
Put data from the channel to destination FloatArray. Optional startInChannel
defines offset in the channel to start from.
list.copyToChannel(arr, channel, startInChannel=0)
Put data from the source FloatArray into channel, optionally starting at startInChannel
offset.
list.split(a, b, c, ...)
Split list at the indicated indexes. That increases number of inner buffers and that's it.
list.join(start=0, end=-0)
Joins buffers from the indicated range.
list.destroy()
Clean up list.
FAQs
Data structure for sequence of AudioBuffers
The npm package audio-buffer-list receives a total of 63 weekly downloads. As such, audio-buffer-list popularity was classified as not popular.
We found that audio-buffer-list 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
RubyGems.org has added a new "maintainer" role that allows for publishing new versions of gems. This new permission type is aimed at improving security for gem owners and the service overall.
Security News
Node.js will be enforcing stricter semver-major PR policies a month before major releases to enhance stability and ensure reliable release candidates.
Security News
Research
Socket's threat research team has detected five malicious npm packages targeting Roblox developers, deploying malware to steal credentials and personal data.