Update index.html
Browse files- index.html +0 -15
index.html
CHANGED
@@ -32,8 +32,6 @@ let centerFrequency = 1000; // Hz
|
|
32 |
let elfBuffer = [];
|
33 |
let elfCanvas;
|
34 |
let elfCtx;
|
35 |
-
let movingAverageBuffer = [];
|
36 |
-
const movingAverageSize = 50; // Размер окна для скользящего среднего
|
37 |
|
38 |
function startAudioAnalysis() {
|
39 |
audioContext = new (window.AudioContext || window.webkitAudioContext)();
|
@@ -147,7 +145,6 @@ function processAudio(audioProcessingEvent) {
|
|
147 |
let demodulated;
|
148 |
if (isELFMode) {
|
149 |
demodulated = lowPassFilter(instantFreq);
|
150 |
-
demodulated = movingAverage(demodulated);
|
151 |
} else {
|
152 |
demodulated = instantFreq * (centerFrequency / 1000);
|
153 |
}
|
@@ -171,17 +168,6 @@ function lowPassFilter(input) {
|
|
171 |
return this.filtered;
|
172 |
}
|
173 |
|
174 |
-
function movingAverage(input) {
|
175 |
-
movingAverageBuffer.push(input);
|
176 |
-
if (movingAverageBuffer.length > movingAverageSize) {
|
177 |
-
movingAverageBuffer.shift();
|
178 |
-
}
|
179 |
-
const sum = movingAverageBuffer.reduce((a, b) => a + b, 0);
|
180 |
-
return sum / movingA
|
181 |
-
|
182 |
-
return sum / movingAverageBuffer.length;
|
183 |
-
}
|
184 |
-
|
185 |
function toggleAudio() {
|
186 |
if (isAudioEnabled) {
|
187 |
gainNode.gain.setValueAtTime(0, audioContext.currentTime);
|
@@ -211,7 +197,6 @@ function toggleELF() {
|
|
211 |
updateFrequency();
|
212 |
}
|
213 |
elfBuffer = [];
|
214 |
-
movingAverageBuffer = [];
|
215 |
}
|
216 |
|
217 |
function updateFrequency() {
|
|
|
32 |
let elfBuffer = [];
|
33 |
let elfCanvas;
|
34 |
let elfCtx;
|
|
|
|
|
35 |
|
36 |
function startAudioAnalysis() {
|
37 |
audioContext = new (window.AudioContext || window.webkitAudioContext)();
|
|
|
145 |
let demodulated;
|
146 |
if (isELFMode) {
|
147 |
demodulated = lowPassFilter(instantFreq);
|
|
|
148 |
} else {
|
149 |
demodulated = instantFreq * (centerFrequency / 1000);
|
150 |
}
|
|
|
168 |
return this.filtered;
|
169 |
}
|
170 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
171 |
function toggleAudio() {
|
172 |
if (isAudioEnabled) {
|
173 |
gainNode.gain.setValueAtTime(0, audioContext.currentTime);
|
|
|
197 |
updateFrequency();
|
198 |
}
|
199 |
elfBuffer = [];
|
|
|
200 |
}
|
201 |
|
202 |
function updateFrequency() {
|