Research
Security News
Kill Switch Hidden in npm Packages Typosquatting Chalk and Chokidar
Socket researchers found several malicious npm packages typosquatting Chalk and Chokidar, targeting Node.js developers with kill switches and data theft.
audio-buffer-from
Advanced tools
Create AudioBuffer from any source.
var createBuffer = require('audio-buffer-from')
//mono-buffer 1024 samples
var abuf = createBuffer(1024)
//stereo-buffer 1024 samples
var abuf2 = createBuffer(1024, 2)
//buffer from data with bound audio context
var abuf3 = createBuffer(floatArray, {context: audioContext})
//empty 1-sample mono buffer with default context
var abuf4 = createBuffer()
//0-length no-context buffer
var abuf5 = createBuffer(0)
//from pcm data
var abuf6 = createBuffer(new Uint8Array([0, 0, 255, 255]), 'interleaved 96000')
//from data-uri
var abuf7 = createBuffer('data:application/octet-stream;base64,AP8A/w==', 'uint8')
//from base64 string
var abuf7 = createBuffer('AAAAAAAAAAAAAIA/AACAPw==', 'float32 stereo planar')
//from node Buffer
var abuf8 = createBuffer(Buffer.from([0, 255, 0, 127]), 'interleaved')
Create audio buffer from any source
data or a number indicating length
, pass options
to ensure output buffer parameters. A channels
number or format
string can be used to shorthand options argument.
Type | Interpretation |
---|---|
null | Blank 1-sample length buffer. |
Number | Length of resulting buffer. |
Array of Arrays | Every subarray is considered a channel data. |
AudioBuffer | Clone other AudioBuffer. |
Object | Create based on length , channels /numberOfChannels and sampleRate properties. |
Array of Numbers | Raw data, interpreted by options.format , defaults to float64 . |
Float32Array | Raw float32 data, amplitude range is -1..+1 . |
Float64Array | Raw float64 data, amplitude range is -1..+1 . |
Int8Array | Raw int8 data, amplitude range is -128..+127 . |
Uint8Array | Raw uint8 data, amplitude range is 0..255 . |
TypedArray | Any other typed array, described by options.format argument (see pcm-convert). |
ArrayBuffer | Raw data, interpreted by options.format . |
Buffer | Raw data, interpreted by options.format . |
base64 string | Base64-encoded data. |
dataURI string | DataURI string. |
ndarray | Create from ndarray instance. The shape property is considered as [length, channels] . |
ndsamples | Create from ndsamples instance, similar to ndarray. |
Property | Default | Meaning |
---|---|---|
length | 1 | Buffer length. If 0 , buffer is unbound from context. |
context | audio-context | Audio context to bind. null -context creates context-free audio buffer. |
channels , numberOfChannels | 1 | Buffer number of channels. |
sampleRate | 44100 | Buffer sample rate. |
format | null | Source pcm format string or object, see audio-format. If null , it will be detected from the source . |
© 2017 Dima Yv. MIT License
FAQs
Create AudioBuffer from any source
The npm package audio-buffer-from receives a total of 2,003 weekly downloads. As such, audio-buffer-from popularity was classified as popular.
We found that audio-buffer-from demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 open source maintainers 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.
Research
Security News
Socket researchers found several malicious npm packages typosquatting Chalk and Chokidar, targeting Node.js developers with kill switches and data theft.
Security News
pnpm 10 blocks lifecycle scripts by default to improve security, addressing supply chain attack risks but sparking debate over compatibility and workflow changes.
Product
Socket now supports uv.lock files to ensure consistent, secure dependency resolution for Python projects and enhance supply chain security.