Sie können diese pitch detection Audiobibliothek verwenden.
Beispiel:
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.
Sie meinen in einem ''
@Oriol Ja oder mit Javascript. Die Antwort ist, ob es einen Weg gibt, das zu tun. – nanilab
Die höchste Frequenz, die eine Standard-Audiodatei (44,1 kHz) enthalten kann, ist ungefähr 20 kHz. Wenn Sie jedoch die Frequenzdaten abrufen möchten, verwenden Sie [AnalysatorNode] (https://developer.mozilla.org/en-US/). docs/Web/API/AnalyserNode) – Tomer