Security News
Bun 1.2 Released with 90% Node.js Compatibility and Built-in S3 Object Support
Bun 1.2 enhances its JavaScript runtime with 90% Node.js compatibility, built-in S3 and Postgres support, HTML Imports, and faster, cloud-first performance.
gl-audio-analyser
Advanced tools
Pull audio waveform/frequency data into WebGL for realtime audio visualisation!
Pull audio waveform/frequency data into WebGL for realtime audio visualisation!
This is a wrapper around the more generic/flexible web-audio-analyser that makes it easier to just drop into a new WebGL project and get up and running quickly.
You can pull gl-audio-analyser
into your project using browserify.
See demo/index.js
for a full usage example.
analyser = require('gl-audio-analyser')(gl, audio, [ctx])
Creates a new audio analyser given the following arguments:
gl
is the WebGL context you want to use.audio
is an audio node to analyse, be that an <audio>
tag,
MediaStream
or AudioSourceNode
.ctx
is an (optional) AudioContext
instance to use.
Note however there may only be one instance of this per page,
and if not supplied one will be created for you.Once created, you should then bind the waveform and/or frequency textures once per frame:
analyser.bindWaveform([index])
Uploads the audio's waveform data to a specific texture index
, which defaults to 0, returning the bound GL texture index.
analyser.bindFrequencies([index])
Uploads the audio's frequency data to a specific texture index
, which defaults to 0, returning the bound GL texture index.
You can then read the audio data from a texture. For your convenience, this module can also be used with glslify, though the GLSL module source is relatively short.
See demo/index.frag
for an example.
analyse(sampler2D texture, float audioIndex)
uniform sampler2D audioTexture;
#pragma glslify: analyse = require(gl-audio-analyser)
void main() {
float amplitude = analyse(audioTexture);
gl_FragColor = vec4(vec3(amplitude), 1.0);
}
See stackgl/contributing for details.
MIT. See LICENSE.md for details.
FAQs
Pull audio waveform/frequency data into WebGL for realtime audio visualisation!
We found that gl-audio-analyser demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 9 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.
Security News
Bun 1.2 enhances its JavaScript runtime with 90% Node.js compatibility, built-in S3 and Postgres support, HTML Imports, and faster, cloud-first performance.
Security News
Biden's executive order pushes for AI-driven cybersecurity, software supply chain transparency, and stronger protections for federal and open source systems.
Security News
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.