Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

hark

Package Overview
Dependencies
Maintainers
1
Versions
17
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

hark - npm Package Compare versions

Comparing version 0.1.0 to 0.1.1

example/mlk.png

75

example/demo.bundle.js

@@ -59,28 +59,3 @@ ;(function(e,t,n){function i(n,s){if(!t[n]){if(!e[n]){var o=typeof require=="function"&&require;if(!s&&o)return o(n,!0);if(r)return r(n,!0);throw new Error("Cannot find module '"+n+"'")}var u=t[n]={exports:{}};e[n][0].call(u.exports,function(t){var r=e[n][1][t];return i(r?r:t)},u,u.exports)}return t[n].exports}var r=typeof require=="function"&&require;for(var s=0;s<n.length;s++)i(n[s]);return i})({1:[function(require,module,exports){

},{"../hark.js":2,"attachmediastream":3,"bows":4,"getusermedia":5}],3:[function(require,module,exports){
module.exports = function (element, stream, play) {
var autoPlay = (play === false) ? false : true;
if (autoPlay) element.autoplay = true;
// handle mozilla case
if (window.mozGetUserMedia) {
element.mozSrcObject = stream;
if (autoPlay) element.play();
} else {
if (typeof element.srcObject !== 'undefined') {
element.srcObject = stream;
} else if (typeof element.mozSrcObject !== 'undefined') {
element.mozSrcObject = stream;
} else if (typeof element.src !== 'undefined') {
element.src = URL.createObjectURL(stream);
} else {
return false;
}
}
return true;
};
},{}],5:[function(require,module,exports){
},{"../hark.js":2,"bows":3,"getusermedia":4,"attachmediastream":5}],4:[function(require,module,exports){
// getUserMedia helper by @HenrikJoreteg

@@ -114,2 +89,27 @@ var func = (navigator.getUserMedia ||

},{}],5:[function(require,module,exports){
module.exports = function (element, stream, play) {
var autoPlay = (play === false) ? false : true;
if (autoPlay) element.autoplay = true;
// handle mozilla case
if (window.mozGetUserMedia) {
element.mozSrcObject = stream;
if (autoPlay) element.play();
} else {
if (typeof element.srcObject !== 'undefined') {
element.srcObject = stream;
} else if (typeof element.mozSrcObject !== 'undefined') {
element.mozSrcObject = stream;
} else if (typeof element.src !== 'undefined') {
element.src = URL.createObjectURL(stream);
} else {
return false;
}
}
return true;
};
},{}],2:[function(require,module,exports){

@@ -134,3 +134,6 @@ var WildEmitter = require('wildemitter');

var harker = new WildEmitter();
// make it not break in non-supported browsers
if (!window.webkitAudioContext) return harker;
//Config

@@ -151,3 +154,3 @@ var options = options || {},

fftBins = new Float32Array(analyser.fftSize);
if (stream.jquery) stream = stream[0];

@@ -209,3 +212,3 @@ if (stream instanceof HTMLAudioElement) {

/*
WildEmitter.js is a slim little event emitter by @henrikjoreteg largely based
WildEmitter.js is a slim little event emitter by @henrikjoreteg largely based
on @visionmedia's Emitter from UI Kit.

@@ -218,10 +221,10 @@

emitter.on('*', function (eventName, other, event, payloads) {
});
emitter.on('somenamespace*', function (eventName, payloads) {
});
Please note that callbacks triggered by wildcard registered events also get
Please note that callbacks triggered by wildcard registered events also get
the event name as the first argument.

@@ -238,3 +241,3 @@ */

var hasGroup = (arguments.length === 3),
group = hasGroup ? arguments[1] : undefined,
group = hasGroup ? arguments[1] : undefined,
func = hasGroup ? arguments[2] : arguments[1];

@@ -251,3 +254,3 @@ func._groupName = group;

hasGroup = (arguments.length === 3),
group = hasGroup ? arguments[1] : undefined,
group = hasGroup ? arguments[1] : undefined,
func = hasGroup ? arguments[2] : arguments[1];

@@ -285,3 +288,3 @@ function on() {

i;
if (!callbacks) return this;

@@ -349,3 +352,3 @@

},{}],4:[function(require,module,exports){
},{}],3:[function(require,module,exports){
(function(window) {

@@ -352,0 +355,0 @@ var logger = require('andlog'),

@@ -21,3 +21,6 @@ (function(e){if("function"==typeof bootstrap)bootstrap("hark",e);else if("object"==typeof exports)module.exports=e();else if("function"==typeof define&&define.amd)define(e);else if("undefined"!=typeof ses){if(!ses.ok())return;ses.makeHark=e}else"undefined"!=typeof window?window.hark=e():global.hark=e()})(function(){var define,ses,bootstrap,module,exports;

var harker = new WildEmitter();
// make it not break in non-supported browsers
if (!window.webkitAudioContext) return harker;
//Config

@@ -38,3 +41,3 @@ var options = options || {},

fftBins = new Float32Array(analyser.fftSize);
if (stream.jquery) stream = stream[0];

@@ -96,3 +99,3 @@ if (stream instanceof HTMLAudioElement) {

/*
WildEmitter.js is a slim little event emitter by @henrikjoreteg largely based
WildEmitter.js is a slim little event emitter by @henrikjoreteg largely based
on @visionmedia's Emitter from UI Kit.

@@ -105,10 +108,10 @@

emitter.on('*', function (eventName, other, event, payloads) {
});
emitter.on('somenamespace*', function (eventName, payloads) {
});
Please note that callbacks triggered by wildcard registered events also get
Please note that callbacks triggered by wildcard registered events also get
the event name as the first argument.

@@ -125,3 +128,3 @@ */

var hasGroup = (arguments.length === 3),
group = hasGroup ? arguments[1] : undefined,
group = hasGroup ? arguments[1] : undefined,
func = hasGroup ? arguments[2] : arguments[1];

@@ -138,3 +141,3 @@ func._groupName = group;

hasGroup = (arguments.length === 3),
group = hasGroup ? arguments[1] : undefined,
group = hasGroup ? arguments[1] : undefined,
func = hasGroup ? arguments[2] : arguments[1];

@@ -172,3 +175,3 @@ function on() {

i;
if (!callbacks) return this;

@@ -175,0 +178,0 @@

@@ -19,3 +19,6 @@ var WildEmitter = require('wildemitter');

var harker = new WildEmitter();
// make it not break in non-supported browsers
if (!window.webkitAudioContext) return harker;
//Config

@@ -36,3 +39,3 @@ var options = options || {},

fftBins = new Float32Array(analyser.fftSize);
if (stream.jquery) stream = stream[0];

@@ -39,0 +42,0 @@ if (stream instanceof HTMLAudioElement) {

{
"name": "hark",
"version": "0.1.0",
"version": "0.1.1",
"description": "Converts an audio stream to speech events in the browser",

@@ -5,0 +5,0 @@ "main": "hark.js",

# Hark
### Warning: This is a work in progress
Hark is a tiny browser/commonJS module that listens to an audio stream, and emits events indicating whether the user is speaking or not.
With browserify:
`npm install hark`
Without browserify download and use:
[hark.bundle.js](https://raw.github.com/latentflip/hark/master/hark.bundle.js)
## Example:

@@ -72,3 +79,3 @@

Clone and open example/index.html or [view it online](http://latentflip.com/hark/demo)
Clone and open example/index.html or [view it online](http://latentflip.com/hark/example)

@@ -75,0 +82,0 @@

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc