gl-spectrogram
Draw spectrogram with webgl or 2d-canvas
Last updated 3 years ago by dfcreative .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install gl-spectrogram 
SYNC missed versions from official npm registry.

gl-spectrogram unstable

Render spectrogram in webgl or 2d.

Spectrogram

Usage

npm install gl-spectrogram

var createSpectrogram = require('gl-spectrogram');

//lightweight 2d-canvas version
//var createSpectrogram = require('gl-spectrogram/2d');

var spectrogram = createSpectrogram({
	//placement settings
	container: document.body,
	canvas: canvas,
	context: 'webgl',

	//audio settings
	maxDecibels: -30,
	minDecibels: -100,
	maxFrequency: 20000,
	minFrequency: 20,
	sampleRate: 44100,
	weighting: 'itu',

	//grid settings
	grid: true,
	axes: false,
	logarithmic: true,

	//rendering settings
	smoothing: 0.5,
	fill: 'inferno',
	background: null,

	//useful only for webgl renderer, defines the size of data texture
	size: [1024, 1024]
});

//push frequencies data, view is shifted for 1 slice
spectrogram.push(data);

//for even timeflow push data in setTimeout, stream data event, scriptProcessorCallback etc.
setTimeout(() => {
	spectrogram.push(getData(data));
}, 100);

//set data colormap or background
spectrogram.setFill(colormap|color|pixels);
spectrogram.setBackground(color|array);

//update colors, grid view
spectrogram.update(opts);

//called when freqs being pushed
spectrogram.on('push', magnitudes => {});
spectrogram.on('update', magnitudes => {});

//latest frequencies data in db
spectrogram.magnitudes;
spectrogram.peak;

Related

Inspiration

Current Tags

  • 1.1.8                                ...           latest (3 years ago)

13 Versions

  • 1.1.8                                ...           3 years ago
  • 1.1.7                                ...           3 years ago
  • 1.1.6                                ...           3 years ago
  • 1.1.5                                ...           3 years ago
  • 1.1.4                                ...           3 years ago
  • 1.1.3                                ...           3 years ago
  • 1.1.2                                ...           3 years ago
  • 1.1.1                                ...           3 years ago
  • 1.1.0                                ...           3 years ago
  • 1.0.3                                ...           3 years ago
  • 1.0.2                                ...           3 years ago
  • 1.0.1                                ...           3 years ago
  • 1.0.0                                ...           3 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 0
Dependencies (11)
Dev Dependencies (8)
Dependents (1)

Copyright 2014 - 2017 © taobao.org |