aa

audio-activity

Detect audio activity of a MediaStream

Showing:

Popularity

Downloads/wk

1

GitHub Stars

3

Maintenance

Last Commit

6yrs ago

Contributors

0

Package

Dependencies

0

Size (min+gzip)

0.5KB

License

MIT

Type Definitions

Tree-Shakeable

No?

Categories

Readme

audio-activity

Detect audio activity of a MediaStream. Only works in modern browsers that support the Web Audio API.

npm install audio-activity

See the live demo.

Usage

var audioActivity = require('audio-activity');

navigator.getUserMedia({ audio: true, video: false },
    function(stream) {
        var audio = audioActivity(stream, function(level) {
            // 'level' indicates the audio activity in percentage
            console.log(level);
        });

        setTimeout(function() {
            // Call the destroy method to cleanup resources
            audio.destroy();
        }, 5000);
    },
    function(e) {
        console.error(e);
    });

The callback function is optional, by omitting it it's still possible to read the activity level using the audio.get() method.

requestAnimationFrame(function draw() {
    var level = audio.get();
    console.log(level);

    requestAnimationFrame(draw);
});

Rate & Review

Great Documentation0
Easy to Use0
Performant0
Highly Customizable0
Bleeding Edge0
Responsive Maintainers0
Poor Documentation0
Hard to Use0
Slow0
Buggy0
Abandoned0
Unwelcoming Community0
100
No reviews found
Be the first to rate

Alternatives

No alternatives found

Tutorials

No tutorials found
Add a tutorial