From 0210a6b6ea5554cb37f36eb89f03fad8a625ccd6 Mon Sep 17 00:00:00 2001 From: suroh Date: Sat, 7 Dec 2019 22:53:10 +0100 Subject: [PATCH] updated frequency range of menu items --- assets/js/interaction.js | 13 +++++++------ assets/js/synth.js | 2 +- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/assets/js/interaction.js b/assets/js/interaction.js index 3d29fc1..3cbaefb 100644 --- a/assets/js/interaction.js +++ b/assets/js/interaction.js @@ -44,10 +44,7 @@ for (let n of primaryNav) { // create synthVoices per navItem menuVoices[n.dataset.link] = new Synth(audioEngine) menuVoices[n.dataset.link].gain.connect(masterGain) - - // unsuspend sound on mouseenter - n.addEventListener('mouseenter', audioEnable) - + // primary navigation click events n.addEventListener('click', (e) => { for (let _n of primaryNav) { @@ -64,7 +61,7 @@ for (let n of primaryNav) { if (!subNav.classList.contains('active')) { subNav.classList.add('active') } - + for (let s of subNav.children) { if (s.id == n.dataset.link) { s.classList.add('active') @@ -73,9 +70,13 @@ for (let n of primaryNav) { } } }) - + // mouseover on primary nav for big botom text n.addEventListener('mouseenter', () => { + + // unsuspend sound on mouseenter + audioEnable() + if (n.dataset.link == '~') { menuItem.textContent = '\u003C\u007E' } else { diff --git a/assets/js/synth.js b/assets/js/synth.js index 2e9436e..f5dc390 100644 --- a/assets/js/synth.js +++ b/assets/js/synth.js @@ -40,7 +40,7 @@ export class Synth { // OSC -> ADSR -> GAIN noteOn(freq) { // note frequency - this.freq = freq ? freq : (Math.random() * 350) + 50 + this.freq = freq ? freq : (Math.random() * 350) + 150 this.primVoice.frequency.setValueAtTime(this.freq, this.t) this.modVoice.frequency.setValueAtTime(this.freq - 20, this.t) // clear preScheduled events