tweaked pitch detection to smoothen low audio signals

pull/89/head
jmoenig 2019-03-10 15:04:45 +01:00
rodzic c566b91f84
commit a6439559e5
2 zmienionych plików z 3 dodań i 2 usunięć

Wyświetl plik

@ -51,6 +51,7 @@
* Objects, Blocks, Threads: added microphone note and pitch detection * Objects, Blocks, Threads: added microphone note and pitch detection
* Tweaked note detection to only change when the audio signal is strong enough * Tweaked note detection to only change when the audio signal is strong enough
* updated German translation for pitch-detection * updated German translation for pitch-detection
* tweaked pitch detection to smoothen low audio signals
### 2019-03-07 ### 2019-03-07
* AudioComp lib: added block to set the microphone's buffer and fft sizes * AudioComp lib: added block to set the microphone's buffer and fft sizes

Wyświetl plik

@ -9065,7 +9065,7 @@ Microphone.prototype.detectPitch = function (buf, sampleRate) {
} }
rms = Math.sqrt(rms/SIZE); rms = Math.sqrt(rms/SIZE);
if (rms < 0.01) if (rms < 0.01)
return -1; return this.pitch; // -1;
lastCorrelation = 1; lastCorrelation = 1;
for (offset = this.MIN_SAMPLES; offset < MAX_SAMPLES; offset += 1) { for (offset = this.MIN_SAMPLES; offset < MAX_SAMPLES; offset += 1) {
@ -9095,7 +9095,7 @@ Microphone.prototype.detectPitch = function (buf, sampleRate) {
if (best_correlation > 0.01) { if (best_correlation > 0.01) {
return sampleRate / best_offset; return sampleRate / best_offset;
} }
return -1; return this.pitch; // -1;
}; };
// CellMorph ////////////////////////////////////////////////////////// // CellMorph //////////////////////////////////////////////////////////