oscilloscope
Advanced tools
Comparing version 0.2.1 to 1.0.0
{ | ||
"name": "oscilloscope", | ||
"version": "0.2.1", | ||
"description": "", | ||
"main": "lib/index.js", | ||
"dependencies": { | ||
"debug": "^2.1.1" | ||
}, | ||
"version": "1.0.0", | ||
"description": "Waveform audio visualizer for the HTML5 canvas", | ||
"main": "lib/oscilloscope.js", | ||
"module": "src/main.js", | ||
"dependencies": {}, | ||
"devDependencies": { | ||
"coffee-script": "^1.9.1", | ||
"uglifyify": "^3.0.1" | ||
"rollup": "^0.45.2", | ||
"rollup-plugin-uglify": "^2.0.1", | ||
"rollup-plugin-buble": "^0.15.0" | ||
}, | ||
"scripts": { | ||
"test": "echo \"Error: no test specified\" && exit 1", | ||
"build-ex": "browserify -g [uglifyify --no-sourcemap] example/main.js -o example/bundle.js", | ||
"watch-ex": "watchify example/main.js -o example/bundle.js --debug --verbose", | ||
"build-min": "browserify -s oscilloscope -g [uglifyify --no-sourcemap] . -o oscilloscope.min.js", | ||
"build": "coffee -o lib -c src", | ||
"prepublish": "npm run build && npm run build-min" | ||
"test": "standard src/*.js && standard --global Oscilloscope examples/*.js", | ||
"build": "rollup -c", | ||
"prepublish": "npm run build" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/mathiasvr/audio-oscilloscope.git" | ||
"url": "git+https://github.com/mathiasvr/audio-oscilloscope.git" | ||
}, | ||
@@ -34,3 +31,14 @@ "keywords": [ | ||
"author": "Mathias Rasmussen", | ||
"license": "MIT" | ||
"license": "MIT", | ||
"bugs": { | ||
"url": "https://github.com/mathiasvr/audio-oscilloscope/issues" | ||
}, | ||
"homepage": "https://github.com/mathiasvr/audio-oscilloscope#readme", | ||
"directories": { | ||
"example": "examples", | ||
"lib": "lib" | ||
}, | ||
"files": [ | ||
"lib" | ||
] | ||
} |
@@ -1,42 +0,46 @@ | ||
# audio-oscilloscope | ||
Waveform audio visualizer using html5 canvas. | ||
# oscilloscope | ||
[![npm](https://img.shields.io/npm/v/oscilloscope.svg)](https://www.npmjs.com/package/oscilloscope) | ||
![downloads](https://img.shields.io/npm/dt/oscilloscope.svg) | ||
![dependencies](http://img.shields.io/:dependencies-none-green.svg) | ||
[![license](http://img.shields.io/:license-MIT-blue.svg)](http://mvr.mit-license.org) | ||
Require the module with browserify, or simply include oscilloscope.min.js | ||
Waveform audio visualizer for the HTML5 canvas. | ||
## Methods | ||
## install | ||
Add the `oscilloscope.min.js` script to your HTML, or import the module and bundle it for the browser with your favorite module bundler. | ||
```bash | ||
$ npm install oscilloscope | ||
``` | ||
* addSignal(source:AudioNode, color) | ||
* start() | ||
* stop() | ||
## example | ||
```javascript | ||
var Oscilloscope = require('oscilloscope') | ||
## Example | ||
var audioContext = new window.AudioContext() | ||
```javascript | ||
oscilloscope = require('..') | ||
// create source from html5 audio element | ||
var source = audioContext.createMediaElementSource(audioElement) | ||
var context = new window.AudioContext() | ||
// attach oscilloscope | ||
var scope = new Oscilloscope(source) | ||
// setup canvas | ||
var canvas = document.querySelector('.visualizer') | ||
canvas.width = window.innerWidth | ||
canvas.height = window.innerHeight | ||
// start default animation loop | ||
scope.animate(canvas.getContext("2d")) | ||
``` | ||
var options = { | ||
stroke: 3, // size of the wave | ||
glow: 0.1, // glowing effect | ||
buffer: 1024 // buffer size ranging from 32 to 2048 | ||
} | ||
> See the _examples_ folder for more details, and how to customize the animation. | ||
// attach oscilloscope | ||
var scope = new Oscilloscope(canvas, options) | ||
## usage | ||
### `scope = new Oscilloscope(source [, { fftSize: 2048 }])` | ||
Supply an [AudioNode](https://developer.mozilla.org/en-US/docs/Web/API/AudioNode) as `source`. | ||
// get user microphone | ||
var constraints = { video: false, audio: true }; | ||
navigator.getUserMedia(constraints, function(stream) { | ||
var source = context.createMediaStreamSource(stream) | ||
scope.addSignal(source, '#00ffff') | ||
}, function (error) { | ||
console.error("getUserMedia error:", error); | ||
}); | ||
Optionally set the `fftSize` property of the internal [AnalyzerNode](https://developer.mozilla.org/en-US/docs/Web/API/AnalyserNode/fftSize). For more control supply an AnalyzerNode as `source`. | ||
``` | ||
#### `scope.draw(context [, x, y, width, height])` | ||
Draw oscilloscope to a canvas `context`, and optionally set position and dimensions. | ||
#### `scope.animate(context [, x, y, width, height])` | ||
Start a basic animation loop that redraws the oscilloscope using the `.draw()` method. | ||
#### `scope.stop()` | ||
Stop the animation loop started by the `.start()` method. |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify code.
Found 1 instance in 1 package
No bug tracker
MaintenancePackage does not have a linked bug tracker in package.json.
Found 1 instance in 1 package
No tests
QualityPackage does not have any tests. This is a strong signal of a poorly maintained or low quality package.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
No website
QualityPackage does not have a website.
Found 1 instance in 1 package
0
0
0
47
0
5831
3
4
57
1
- Removeddebug@^2.1.1
- Removeddebug@2.6.9(transitive)
- Removedms@2.0.0(transitive)