Realtime but not continuous analysis ?
See original GitHub issueI try to use the nice package for a realtime BPM analysis with line / mic input using navigator.getUserMedia
BPM detection works fine, but I don’t understand why the value is not updated when input BPM changes.
Maybe I made a mistake in my code (or comprehension), but I think the analyzer does not update BPM continiously.
Starting from functionnal example edit app.js :
'use strict';
const RealTimeBPMAnalyzer = require('realtime-bpm-analyzer');
const App = {
init() {
var AudioContext = window.AudioContext || window.webkitAudioContext;
navigator.getUserMedia = ( navigator.getUserMedia ||
navigator.webkitGetUserMedia ||
navigator.mozGetUserMedia ||
navigator.msGetUserMedia);
var context = new AudioContext();
// Enable mic / line input watching
navigator.getUserMedia({audio: true}, onStream.bind(this), function() {});
function onStream(stream) {
// Set the source with the HTML Audio Node
var input = context.createMediaStreamSource(stream);
// Set the scriptProcessorNode to get PCM data in real time
var scriptProcessorNode = context.createScriptProcessor(4096, 1, 1);
// Connect everythings together (do not connect input to context.destination to avoid sound looping)
scriptProcessorNode.connect(context.destination);
input.connect(scriptProcessorNode);
var onAudioProcess = new RealTimeBPMAnalyzer({
scriptNode: {
bufferSize: 4096,
numberOfInputChannels: 1,
numberOfOutputChannels: 1
},
pushTime: 2000,
pushCallback: function(err, bpm) {
if(bpm && bpm.length)
console.log('bpm', bpm[0].tempo); // <= When stabilized, always displays the same BPM
}
});
// Attach realTime function to audioprocess event.inputBuffer (AudioBuffer)
scriptProcessorNode.onaudioprocess = function (e) {
onAudioProcess.analyze(e);
};
}
}
}
module.exports = App;
Any idea ?
Issue Analytics
- State:
- Created 5 years ago
- Comments:8 (6 by maintainers)
Top Results From Across the Web
The Benefits of Real-Time Continuous Analysis
Real-time continuous analysis is being utilised in laboratories all over the world to improve testing capabilities of chemical compounds.
Read more >Real Analysis | Showing a function is (dis)continuous. - YouTube
We give an example of showing a function is continuous everywhere and present a classic example of a function that is nowhere continuous....
Read more >Independently analytic and continuous, but not jointly ...
I feel like it might be that analytic in the first variable and independently continuous in the second does not imply jointly continuous....
Read more >Real-Time Data Analytics: On Demand vs. Continuous
It consists of dynamic analysis and reporting, based on data ... Continuous Real-Time Analytics is more proactive and alerts users with ...
Read more >Discrete vs Continuous Data – What's the Difference? - G2
Discrete data is data that is countable, whereas continuous data is quantifiable rather than countable. Read more on the data types and ......
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@Bulinlinbu I develop a proto-solution for you, I keep you informed 😉
@Bulinlinbu here the PR https://github.com/dlepaux/realtime-bpm-analyzer/pull/16