javascript - Get sound frequency with web Audio API -
i real time frequency of sound not work. here code:
navigator.getusermedia({audio:true,video:false}, function (stream) { document.queryselector("#music").src = window.url.createobjecturl(stream) document.queryselector("#music").play() var contexteaudio = new (window.audiocontext || window.webkitaudiocontext)(); var analyseur = contexteaudio.createanalyser(); source = contexteaudio.createmediastreamsource(stream); source.connect(analyseur); var tab = new float32array(); (var i=0;i<=100;i++) { var datas = analyseur.getfloatfrequencydata(tab); document.queryselector("#datas").innerhtml = tab[i]; } }, function(error) { console.log(error) })
you can test here: https://jsfiddle.net/2tzduxak/1/
why can't float value of real time frequency microphone based ? value undefined....
Comments
Post a Comment