changeset 163:8c882ee9d097

Print timing
author Chris Cannam <cannam@all-day-breakfast.com>
date Wed, 22 Mar 2017 09:05:38 +0000
parents fab88270bccc
children fafba3b9ba6b 376f56200aa1
files src/app/spectrogram/Spectrogram.ts
diffstat 1 files changed, 2 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/app/spectrogram/Spectrogram.ts	Wed Mar 22 08:18:46 2017 +0000
+++ b/src/app/spectrogram/Spectrogram.ts	Wed Mar 22 09:05:38 2017 +0000
@@ -92,6 +92,7 @@
       if (channel >= 0 || nch == 1) {
 	return buffer.getChannelData(channel);
       } else {
+        const before = performance.now();
 	console.log("mixing down " + nch + " channels for spectrogram...");
 	const mixed = Float32Array.from(buffer.getChannelData(0));
 	const n = mixed.length;
@@ -101,7 +102,7 @@
 	}
 	const scale = 1.0 / nch;
 	for (let i = 0; i < n; ++i) mixed[i] *= scale;
-	console.log("done");
+	console.log("done in " + (performance.now() - before) + "ms");
 	return mixed;
       }
     });