updated frequency range of menu items

This commit is contained in:
suroh 2019-12-07 22:53:10 +01:00
parent 7c4b1844e0
commit 0210a6b6ea
2 changed files with 8 additions and 7 deletions

View File

@ -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 {

View File

@ -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