有人写了一个网络音频库,其中,可以检测麦克风输入的频率。在https://github.com/rserota/wad#pitch-detection
var voice = new Wad({source : 'mic' });
var tuner = new Wad.Poly();
tuner.add(voice);
voice.play();
tuner.updatePitch() // The tuner is now calculating the pitch and note name of its input 60 times per second. These values are stored in tuner.pitch and tuner.noteName.
var logPitch = function(){
console.log(tuner.pitch, tuner.noteName)
requestAnimationFrame(logPitch)
};
logPitch();
// If you sing into your microphone, your pitch will be logged to the console in real time.
tuner.stopUpdatingPitch(); // Stop calculating the pitch if you don't need to know it anymore.
那么我已经有一个工作得很好,但这似乎更干净的api。由于浏览器许可,我面临麻烦。我对麦克风访问权限说是,但它在控制台中说我不接受它。你知道这是否会在iOS/Android上工作吗? – DigitalEvolution
请尝试。直到现在我还没有尝试过。 –
哈桑阿里我经过许可解决了这个问题。是的,将不得不尝试在android/ios上 – DigitalEvolution