440Hz
880Hz
const scaleHeight = (
num,
inMax = Math.max(document.documentElement.clientHeight, window.innerHeight || 0) //viewport height
) => {
const scaleMap = num * 24 / inMax;
const hertz = ROOT_NOTE * Math.pow(1.059463094359, scaleMap);
return hertz;
}
function setNote(freq) {
// we want oscillator to be initialised when we change it
if (isPlaying) {
o.frequency.setValueAtTime(freq, context.currentTime);
}
}
tenzhiyang.com/2020-09-30-music-in-browser-basics/
tenzhiyang.com/2020-10-13-ways-to-play-sound/
tenzhiyang.com/2019-11-15-synth-til-it-hertz/
slides.com/tzyinc
codepen.io/tzyinc
twitter.com/tzyinc