addEventListener('visibilitychange', this.onVisibility);
                document.addEventListener('click', this.onClick);

                this.ui.instructions.animateIn();
            }

            static getAverageFrequency(data, start = 0, end = data.length) {
                // Calculate the root median square (RMS)
                return rms(data.slice(start, end).map(v => v / 256));
            }

            // Event handlers

            static onVisibility = () => {
                if (document.h