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

@ -45,9 +45,6 @@ for (let n of primaryNav) {
menuVoices[n.dataset.link] = new Synth(audioEngine) menuVoices[n.dataset.link] = new Synth(audioEngine)
menuVoices[n.dataset.link].gain.connect(masterGain) menuVoices[n.dataset.link].gain.connect(masterGain)
// unsuspend sound on mouseenter
n.addEventListener('mouseenter', audioEnable)
// primary navigation click events // primary navigation click events
n.addEventListener('click', (e) => { n.addEventListener('click', (e) => {
for (let _n of primaryNav) { for (let _n of primaryNav) {
@ -76,6 +73,10 @@ for (let n of primaryNav) {
// mouseover on primary nav for big botom text // mouseover on primary nav for big botom text
n.addEventListener('mouseenter', () => { n.addEventListener('mouseenter', () => {
// unsuspend sound on mouseenter
audioEnable()
if (n.dataset.link == '~') { if (n.dataset.link == '~') {
menuItem.textContent = '\u003C\u007E' menuItem.textContent = '\u003C\u007E'
} else { } else {

View File

@ -40,7 +40,7 @@ export class Synth {
// OSC -> ADSR -> GAIN // OSC -> ADSR -> GAIN
noteOn(freq) { noteOn(freq) {
// note frequency // 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.primVoice.frequency.setValueAtTime(this.freq, this.t)
this.modVoice.frequency.setValueAtTime(this.freq - 20, this.t) this.modVoice.frequency.setValueAtTime(this.freq - 20, this.t)
// clear preScheduled events // clear preScheduled events