\begin{Verbatim}[commandchars=\\\{\}] \PY{c+cp}{\PYZlt{}!DOCTYPE html\PYZgt{}} \PY{p}{\PYZlt{}}\PY{n+nt}{html} \PY{n+na}{lang}\PY{o}{=}\PY{l+s}{\PYZdq{}de\PYZdq{}}\PY{p}{\PYZgt{}} \PY{p}{\PYZlt{}}\PY{n+nt}{head}\PY{p}{\PYZgt{}} \PY{p}{\PYZlt{}}\PY{n+nt}{meta} \PY{n+na}{charset}\PY{o}{=}\PY{l+s}{\PYZdq{}UTF\PYZhy{}8\PYZdq{}}\PY{p}{\PYZgt{}} \PY{p}{\PYZlt{}}\PY{n+nt}{meta} \PY{n+na}{name}\PY{o}{=}\PY{l+s}{\PYZdq{}viewport\PYZdq{}} \PY{n+na}{content}\PY{o}{=}\PY{l+s}{\PYZdq{}width=device\PYZhy{}width, initial\PYZhy{}scale=1.0\PYZdq{}}\PY{p}{\PYZgt{}} \PY{p}{\PYZlt{}}\PY{n+nt}{title}\PY{p}{\PYZgt{}}KORG Kaoscillator \PYZhy{} Digital Hardcore (Low\PYZhy{}Latency)\PY{p}{\PYZlt{}}\PY{p}{/}\PY{n+nt}{title}\PY{p}{\PYZgt{}} \PY{p}{\PYZlt{}}\PY{n+nt}{style}\PY{p}{\PYZgt{}} \PY{+w}{ }\PY{p}{:}\PY{n+nd}{root}\PY{+w}{ }\PY{p}{\PYZob{}} \PY{+w}{ }\PY{n+nv}{\PYZhy{}\PYZhy{}bg\PYZhy{}color}\PY{p}{:}\PY{+w}{ }\PY{l+m+mh}{\PYZsh{}0d0d0d}\PY{p}{;} \PY{+w}{ }\PY{n+nv}{\PYZhy{}\PYZhy{}panel\PYZhy{}bg}\PY{p}{:}\PY{+w}{ }\PY{l+m+mh}{\PYZsh{}18181f}\PY{p}{;} \PY{+w}{ }\PY{n+nv}{\PYZhy{}\PYZhy{}accent\PYZhy{}yellow}\PY{p}{:}\PY{+w}{ }\PY{l+m+mh}{\PYZsh{}ffcc00}\PY{p}{;} \PY{+w}{ }\PY{n+nv}{\PYZhy{}\PYZhy{}accent\PYZhy{}red}\PY{p}{:}\PY{+w}{ }\PY{l+m+mh}{\PYZsh{}ff3333}\PY{p}{;} \PY{+w}{ }\PY{p}{\PYZcb{}} \PY{+w}{ }\PY{n+nt}{body}\PY{+w}{ }\PY{p}{\PYZob{}} \PY{+w}{ }\PY{k}{background\PYZhy{}color}\PY{p}{:}\PY{+w}{ }\PY{n+nf}{var}\PY{p}{(}\PY{n+nv}{\PYZhy{}\PYZhy{}bg\PYZhy{}color}\PY{p}{)}\PY{p}{;} \PY{+w}{ }\PY{k}{color}\PY{p}{:}\PY{+w}{ }\PY{l+m+mh}{\PYZsh{}fff}\PY{p}{;} \PY{+w}{ }\PY{k}{font\PYZhy{}family}\PY{p}{:}\PY{+w}{ }\PY{l+s+s1}{\PYZsq{}Courier New\PYZsq{}}\PY{p}{,}\PY{+w}{ }\PY{n}{Courier}\PY{p}{,}\PY{+w}{ }\PY{k+kc}{monospace}\PY{p}{;} \PY{+w}{ }\PY{k}{display}\PY{p}{:}\PY{+w}{ }\PY{k+kc}{flex}\PY{p}{;} \PY{+w}{ }\PY{k}{justify\PYZhy{}content}\PY{p}{:}\PY{+w}{ }\PY{k+kc}{center}\PY{p}{;} \PY{+w}{ }\PY{k}{align\PYZhy{}items}\PY{p}{:}\PY{+w}{ }\PY{k+kc}{center}\PY{p}{;} \PY{+w}{ }\PY{k}{min\PYZhy{}height}\PY{p}{:}\PY{+w}{ }\PY{l+m+mi}{100}\PY{k+kt}{vh}\PY{p}{;} \PY{+w}{ }\PY{k}{margin}\PY{p}{:}\PY{+w}{ }\PY{l+m+mi}{0}\PY{p}{;} \PY{+w}{ }\PY{k}{user\PYZhy{}select}\PY{p}{:}\PY{+w}{ }\PY{k+kc}{none}\PY{p}{;} \PY{+w}{ }\PY{p}{\PYZcb{}} \PY{+w}{ }\PY{p}{.}\PY{n+nc}{kaoss\PYZhy{}container}\PY{+w}{ }\PY{p}{\PYZob{}} \PY{+w}{ }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}{flex}\PY{p}{;} \PY{+w}{ }\PY{k}{flex\PYZhy{}direction}\PY{p}{:}\PY{+w}{ }\PY{k+kc}{column}\PY{p}{;} \PY{+w}{ }\PY{k}{gap}\PY{p}{:}\PY{+w}{ }\PY{l+m+mi}{12}\PY{k+kt}{px}\PY{p}{;} \PY{+w}{ }\PY{p}{\PYZcb{}} \PY{+w}{ }\PY{p}{.}\PY{n+nc}{header}\PY{+w}{ }\PY{p}{\PYZob{}} \PY{+w}{ }\PY{k}{display}\PY{p}{:}\PY{+w}{ }\PY{k+kc}{flex}\PY{p}{;} \PY{+w}{ }\PY{k}{justify\PYZhy{}content}\PY{p}{:}\PY{+w}{ }\PY{k+kc}{space\PYZhy{}between}\PY{p}{;} \PY{+w}{ }\PY{k}{align\PYZhy{}items}\PY{p}{:}\PY{+w}{ }\PY{k+kc}{center}\PY{p}{;} \PY{+w}{ }\PY{k}{border\PYZhy{}bottom}\PY{p}{:}\PY{+w}{ }\PY{l+m+mi}{2}\PY{k+kt}{px}\PY{+w}{ }\PY{k+kc}{solid}\PY{+w}{ }\PY{l+m+mh}{\PYZsh{}333}\PY{p}{;} \PY{+w}{ }\PY{k}{padding\PYZhy{}bottom}\PY{p}{:}\PY{+w}{ }\PY{l+m+mi}{6}\PY{k+kt}{px}\PY{p}{;} \PY{+w}{ }\PY{p}{\PYZcb{}} \PY{+w}{ }\PY{p}{.}\PY{n+nc}{title}\PY{+w}{ }\PY{p}{\PYZob{}} \PY{+w}{ }\PY{k}{font\PYZhy{}weight}\PY{p}{:}\PY{+w}{ }\PY{k+kc}{bold}\PY{p}{;} \PY{+w}{ }\PY{k}{font\PYZhy{}size}\PY{p}{:}\PY{+w}{ }\PY{l+m+mf}{1.1}\PY{k+kt}{rem}\PY{p}{;} \PY{+w}{ }\PY{k}{color}\PY{p}{:}\PY{+w}{ }\PY{n+nf}{var}\PY{p}{(}\PY{n+nv}{\PYZhy{}\PYZhy{}accent\PYZhy{}yellow}\PY{p}{)}\PY{p}{;} \PY{+w}{ }\PY{k}{letter\PYZhy{}spacing}\PY{p}{:}\PY{+w}{ }\PY{l+m+mi}{2}\PY{k+kt}{px}\PY{p}{;} \PY{+w}{ }\PY{p}{\PYZcb{}} \PY{+w}{ }\PY{p}{.}\PY{n+nc}{subtitle}\PY{+w}{ }\PY{p}{\PYZob{}} \PY{+w}{ }\PY{k}{font\PYZhy{}size}\PY{p}{:}\PY{+w}{ }\PY{l+m+mf}{0.65}\PY{k+kt}{rem}\PY{p}{;} \PY{+w}{ }\PY{k}{color}\PY{p}{:}\PY{+w}{ }\PY{n+nf}{var}\PY{p}{(}\PY{n+nv}{\PYZhy{}\PYZhy{}accent\PYZhy{}red}\PY{p}{)}\PY{p}{;} \PY{+w}{ }\PY{k}{font\PYZhy{}weight}\PY{p}{:}\PY{+w}{ }\PY{k+kc}{bold}\PY{p}{;} \PY{+w}{ }\PY{p}{\PYZcb{}} \PY{+w}{ }\PY{p}{.}\PY{n+nc}{display}\PY{+w}{ }\PY{p}{\PYZob{}} \PY{+w}{ }\PY{k}{background}\PY{p}{:}\PY{+w}{ }\PY{l+m+mh}{\PYZsh{}000}\PY{p}{;} \PY{+w}{ }\PY{k}{border}\PY{p}{:}\PY{+w}{ }\PY{l+m+mi}{2}\PY{k+kt}{px}\PY{+w}{ }\PY{k+kc}{solid}\PY{+w}{ }\PY{l+m+mh}{\PYZsh{}444}\PY{p}{;} \PY{+w}{ }\PY{k}{border\PYZhy{}radius}\PY{p}{:}\PY{+w}{ }\PY{l+m+mi}{6}\PY{k+kt}{px}\PY{p}{;} \PY{+w}{ }\PY{k}{padding}\PY{p}{:}\PY{+w}{ }\PY{l+m+mi}{8}\PY{k+kt}{px}\PY{+w}{ }\PY{l+m+mi}{12}\PY{k+kt}{px}\PY{p}{;} \PY{+w}{ }\PY{k}{display}\PY{p}{:}\PY{+w}{ }\PY{k+kc}{flex}\PY{p}{;} \PY{+w}{ }\PY{k}{flex\PYZhy{}direction}\PY{p}{:}\PY{+w}{ }\PY{k+kc}{column}\PY{p}{;} \PY{+w}{ }\PY{k}{gap}\PY{p}{:}\PY{+w}{ }\PY{l+m+mi}{4}\PY{k+kt}{px}\PY{p}{;} \PY{+w}{ }\PY{k}{font\PYZhy{}family}\PY{p}{:}\PY{+w}{ }\PY{k+kc}{monospace}\PY{p}{;} \PY{+w}{ }\PY{k}{color}\PY{p}{:}\PY{+w}{ }\PY{n+nf}{var}\PY{p}{(}\PY{n+nv}{\PYZhy{}\PYZhy{}accent\PYZhy{}yellow}\PY{p}{)}\PY{p}{;} \PY{+w}{ }\PY{k}{text\PYZhy{}shadow}\PY{p}{:}\PY{+w}{ }\PY{l+m+mi}{0}\PY{+w}{ }\PY{l+m+mi}{0}\PY{+w}{ }\PY{l+m+mi}{5}\PY{k+kt}{px}\PY{+w}{ }\PY{n+nf}{var}\PY{p}{(}\PY{n+nv}{\PYZhy{}\PYZhy{}accent\PYZhy{}yellow}\PY{p}{)}\PY{p}{;} \PY{+w}{ }\PY{k}{font\PYZhy{}size}\PY{p}{:}\PY{+w}{ }\PY{l+m+mf}{0.85}\PY{k+kt}{rem}\PY{p}{;} \PY{+w}{ }\PY{p}{\PYZcb{}} \PY{+w}{ }\PY{p}{.}\PY{n+nc}{display\PYZhy{}row}\PY{+w}{ }\PY{p}{\PYZob{}} \PY{+w}{ }\PY{k}{display}\PY{p}{:}\PY{+w}{ }\PY{k+kc}{flex}\PY{p}{;} \PY{+w}{ }\PY{k}{justify\PYZhy{}content}\PY{p}{:}\PY{+w}{ }\PY{k+kc}{space\PYZhy{}between}\PY{p}{;} \PY{+w}{ }\PY{p}{\PYZcb{}} \PY{+w}{ }\PY{p}{.}\PY{n+nc}{pad\PYZhy{}container}\PY{+w}{ }\PY{p}{\PYZob{}} \PY{+w}{ }\PY{k}{position}\PY{p}{:}\PY{+w}{ }\PY{k+kc}{relative}\PY{p}{;} \PY{+w}{ }\PY{k}{width}\PY{p}{:}\PY{+w}{ }\PY{l+m+mi}{100}\PY{k+kt}{\PYZpc{}}\PY{p}{;} \PY{+w}{ }\PY{k}{height}\PY{p}{:}\PY{+w}{ }\PY{l+m+mi}{260}\PY{k+kt}{px}\PY{p}{;} \PY{+w}{ }\PY{k}{background}\PY{p}{:}\PY{+w}{ }\PY{l+m+mh}{\PYZsh{}050505}\PY{p}{;} \PY{+w}{ }\PY{k}{border}\PY{p}{:}\PY{+w}{ }\PY{l+m+mi}{3}\PY{k+kt}{px}\PY{+w}{ }\PY{k+kc}{solid}\PY{+w}{ }\PY{l+m+mh}{\PYZsh{}444}\PY{p}{;} \PY{+w}{ }\PY{k}{border\PYZhy{}radius}\PY{p}{:}\PY{+w}{ }\PY{l+m+mi}{12}\PY{k+kt}{px}\PY{p}{;} \PY{+w}{ }\PY{k}{overflow}\PY{p}{:}\PY{+w}{ }\PY{k+kc}{hidden}\PY{p}{;} \PY{+w}{ }\PY{k}{cursor}\PY{p}{:}\PY{+w}{ }\PY{k+kc}{crosshair}\PY{p}{;} \PY{+w}{ }\PY{n}{touch\PYZhy{}action}\PY{p}{:}\PY{+w}{ }\PY{k+kc}{none}\PY{p}{;} \PY{+w}{ }\PY{p}{\PYZcb{}} \PY{+w}{ }\PY{n+nt}{canvas}\PY{+w}{ }\PY{p}{\PYZob{}} \PY{+w}{ }\PY{k}{width}\PY{p}{:}\PY{+w}{ }\PY{l+m+mi}{100}\PY{k+kt}{\PYZpc{}}\PY{p}{;} \PY{+w}{ }\PY{k}{height}\PY{p}{:}\PY{+w}{ }\PY{l+m+mi}{100}\PY{k+kt}{\PYZpc{}}\PY{p}{;} \PY{+w}{ }\PY{p}{\PYZcb{}} \PY{+w}{ }\PY{p}{.}\PY{n+nc}{controls}\PY{+w}{ }\PY{p}{\PYZob{}} \PY{+w}{ }\PY{k}{display}\PY{p}{:}\PY{+w}{ }\PY{k}{grid}\PY{p}{;} \PY{+w}{ }\PY{k}{grid\PYZhy{}template\PYZhy{}columns}\PY{p}{:}\PY{+w}{ }\PY{l+m+mi}{1}\PY{n}{fr}\PY{+w}{ }\PY{l+m+mi}{1}\PY{n}{fr}\PY{p}{;} \PY{+w}{ }\PY{k}{gap}\PY{p}{:}\PY{+w}{ }\PY{l+m+mi}{8}\PY{k+kt}{px}\PY{p}{;} \PY{+w}{ }\PY{p}{\PYZcb{}} \PY{+w}{ }\PY{p}{.}\PY{n+nc}{control\PYZhy{}group}\PY{+w}{ }\PY{p}{\PYZob{}} \PY{+w}{ }\PY{k}{display}\PY{p}{:}\PY{+w}{ }\PY{k+kc}{flex}\PY{p}{;} \PY{+w}{ }\PY{k}{flex\PYZhy{}direction}\PY{p}{:}\PY{+w}{ }\PY{k+kc}{column}\PY{p}{;} \PY{+w}{ }\PY{k}{gap}\PY{p}{:}\PY{+w}{ }\PY{l+m+mi}{3}\PY{k+kt}{px}\PY{p}{;} \PY{+w}{ }\PY{p}{\PYZcb{}} \PY{+w}{ }\PY{n+nt}{label}\PY{+w}{ }\PY{p}{\PYZob{}} \PY{+w}{ }\PY{k}{font\PYZhy{}size}\PY{p}{:}\PY{+w}{ }\PY{l+m+mf}{0.65}\PY{k+kt}{rem}\PY{p}{;} \PY{+w}{ }\PY{k}{color}\PY{p}{:}\PY{+w}{ }\PY{l+m+mh}{\PYZsh{}aaa}\PY{p}{;} \PY{+w}{ }\PY{k}{text\PYZhy{}transform}\PY{p}{:}\PY{+w}{ }\PY{k+kc}{uppercase}\PY{p}{;} \PY{+w}{ }\PY{k}{font\PYZhy{}weight}\PY{p}{:}\PY{+w}{ }\PY{k+kc}{bold}\PY{p}{;} \PY{+w}{ }\PY{p}{\PYZcb{}} \PY{+w}{ }\PY{n+nt}{select}\PY{o}{,}\PY{+w}{ }\PY{n+nt}{button}\PY{o}{,}\PY{+w}{ }\PY{n+nt}{input}\PY{+w}{ }\PY{p}{\PYZob{}} \PY{+w}{ }\PY{k}{background}\PY{p}{:}\PY{+w}{ }\PY{l+m+mh}{\PYZsh{}252530}\PY{p}{;} \PY{+w}{ }\PY{k}{color}\PY{p}{:}\PY{+w}{ }\PY{l+m+mh}{\PYZsh{}fff}\PY{p}{;} \PY{+w}{ }\PY{k}{border}\PY{p}{:}\PY{+w}{ }\PY{l+m+mi}{1}\PY{k+kt}{px}\PY{+w}{ }\PY{k+kc}{solid}\PY{+w}{ }\PY{l+m+mh}{\PYZsh{}444}\PY{p}{;} \PY{+w}{ }\PY{k}{padding}\PY{p}{:}\PY{+w}{ }\PY{l+m+mi}{6}\PY{k+kt}{px}\PY{p}{;} \PY{+w}{ }\PY{k}{border\PYZhy{}radius}\PY{p}{:}\PY{+w}{ }\PY{l+m+mi}{4}\PY{k+kt}{px}\PY{p}{;} \PY{+w}{ }\PY{k}{font\PYZhy{}family}\PY{p}{:}\PY{+w}{ }\PY{k+kc}{inherit}\PY{p}{;} \PY{+w}{ }\PY{k}{font\PYZhy{}size}\PY{p}{:}\PY{+w}{ }\PY{l+m+mf}{0.78}\PY{k+kt}{rem}\PY{p}{;} \PY{+w}{ }\PY{k}{font\PYZhy{}weight}\PY{p}{:}\PY{+w}{ }\PY{k+kc}{bold}\PY{p}{;} \PY{+w}{ }\PY{k}{cursor}\PY{p}{:}\PY{+w}{ }\PY{k+kc}{pointer}\PY{p}{;} \PY{+w}{ }\PY{p}{\PYZcb{}} \PY{+w}{ }\PY{n+nt}{select}\PY{p}{:}\PY{n+nd}{focus}\PY{o}{,}\PY{+w}{ }\PY{n+nt}{button}\PY{p}{:}\PY{n+nd}{focus}\PY{o}{,}\PY{+w}{ }\PY{n+nt}{input}\PY{p}{:}\PY{n+nd}{focus}\PY{+w}{ }\PY{p}{\PYZob{}} \PY{+w}{ }\PY{k}{outline}\PY{p}{:}\PY{+w}{ }\PY{k+kc}{none}\PY{p}{;} \PY{+w}{ }\PY{k}{border\PYZhy{}color}\PY{p}{:}\PY{+w}{ }\PY{n+nf}{var}\PY{p}{(}\PY{n+nv}{\PYZhy{}\PYZhy{}accent\PYZhy{}yellow}\PY{p}{)}\PY{p}{;} \PY{+w}{ }\PY{p}{\PYZcb{}} \PY{+w}{ }\PY{n+nt}{button}\PY{p}{.}\PY{n+nc}{active}\PY{+w}{ }\PY{p}{\PYZob{}} \PY{+w}{ }\PY{k}{background}\PY{p}{:}\PY{+w}{ }\PY{n+nf}{var}\PY{p}{(}\PY{n+nv}{\PYZhy{}\PYZhy{}accent\PYZhy{}red}\PY{p}{)}\PY{p}{;} \PY{+w}{ }\PY{k}{color}\PY{p}{:}\PY{+w}{ }\PY{l+m+mh}{\PYZsh{}fff}\PY{p}{;} \PY{+w}{ }\PY{k}{box\PYZhy{}shadow}\PY{p}{:}\PY{+w}{ }\PY{l+m+mi}{0}\PY{+w}{ }\PY{l+m+mi}{0}\PY{+w}{ }\PY{l+m+mi}{10}\PY{k+kt}{px}\PY{+w}{ }\PY{n+nf}{var}\PY{p}{(}\PY{n+nv}{\PYZhy{}\PYZhy{}accent\PYZhy{}red}\PY{p}{)}\PY{p}{;} \PY{+w}{ }\PY{p}{\PYZcb{}} \PY{+w}{ }\PY{p}{\PYZlt{}}\PY{p}{/}\PY{n+nt}{style}\PY{p}{\PYZgt{}} \PY{p}{\PYZlt{}}\PY{p}{/}\PY{n+nt}{head}\PY{p}{\PYZgt{}} \PY{p}{\PYZlt{}}\PY{n+nt}{body}\PY{p}{\PYZgt{}} \PY{p}{\PYZlt{}}\PY{n+nt}{div} \PY{n+na}{class}\PY{o}{=}\PY{l+s}{\PYZdq{}kaoss\PYZhy{}container\PYZdq{}}\PY{p}{\PYZgt{}} \PY{p}{\PYZlt{}}\PY{n+nt}{div} \PY{n+na}{class}\PY{o}{=}\PY{l+s}{\PYZdq{}header\PYZdq{}}\PY{p}{\PYZgt{}} \PY{p}{\PYZlt{}}\PY{n+nt}{div} \PY{n+na}{class}\PY{o}{=}\PY{l+s}{\PYZdq{}title\PYZdq{}}\PY{p}{\PYZgt{}}KAOSS\PYZhy{}DHC\PY{p}{\PYZlt{}}\PY{p}{/}\PY{n+nt}{div}\PY{p}{\PYZgt{}} \PY{p}{\PYZlt{}}\PY{n+nt}{div} \PY{n+na}{class}\PY{o}{=}\PY{l+s}{\PYZdq{}subtitle\PYZdq{}}\PY{p}{\PYZgt{}}ZERO\PYZhy{}LATENCY EDITION\PY{p}{\PYZlt{}}\PY{p}{/}\PY{n+nt}{div}\PY{p}{\PYZgt{}} \PY{p}{\PYZlt{}}\PY{p}{/}\PY{n+nt}{div}\PY{p}{\PYZgt{}} \PY{p}{\PYZlt{}}\PY{n+nt}{div} \PY{n+na}{class}\PY{o}{=}\PY{l+s}{\PYZdq{}display\PYZdq{}}\PY{p}{\PYZgt{}} \PY{p}{\PYZlt{}}\PY{n+nt}{div} \PY{n+na}{class}\PY{o}{=}\PY{l+s}{\PYZdq{}display\PYZhy{}row\PYZdq{}}\PY{p}{\PYZgt{}} \PY{p}{\PYZlt{}}\PY{n+nt}{span} \PY{n+na}{id}\PY{o}{=}\PY{l+s}{\PYZdq{}disp\PYZhy{}preset\PYZdq{}}\PY{p}{\PYZgt{}}SYNTH: DHC SAW\PY{p}{\PYZlt{}}\PY{p}{/}\PY{n+nt}{span}\PY{p}{\PYZgt{}} \PY{p}{\PYZlt{}}\PY{n+nt}{span} \PY{n+na}{id}\PY{o}{=}\PY{l+s}{\PYZdq{}disp\PYZhy{}bpm\PYZdq{}}\PY{p}{\PYZgt{}}180 BPM\PY{p}{\PYZlt{}}\PY{p}{/}\PY{n+nt}{span}\PY{p}{\PYZgt{}} \PY{p}{\PYZlt{}}\PY{p}{/}\PY{n+nt}{div}\PY{p}{\PYZgt{}} \PY{p}{\PYZlt{}}\PY{n+nt}{div} \PY{n+na}{class}\PY{o}{=}\PY{l+s}{\PYZdq{}display\PYZhy{}row\PYZdq{}}\PY{p}{\PYZgt{}} \PY{p}{\PYZlt{}}\PY{n+nt}{span} \PY{n+na}{id}\PY{o}{=}\PY{l+s}{\PYZdq{}disp\PYZhy{}scale\PYZdq{}}\PY{p}{\PYZgt{}}SKALA: PHRYGIAN DOM\PY{p}{\PYZlt{}}\PY{p}{/}\PY{n+nt}{span}\PY{p}{\PYZgt{}} \PY{p}{\PYZlt{}}\PY{n+nt}{span} \PY{n+na}{id}\PY{o}{=}\PY{l+s}{\PYZdq{}disp\PYZhy{}pattern\PYZdq{}}\PY{p}{\PYZgt{}}BEAT: DHC BREAK\PY{p}{\PYZlt{}}\PY{p}{/}\PY{n+nt}{span}\PY{p}{\PYZgt{}} \PY{p}{\PYZlt{}}\PY{p}{/}\PY{n+nt}{div}\PY{p}{\PYZgt{}} \PY{p}{\PYZlt{}}\PY{p}{/}\PY{n+nt}{div}\PY{p}{\PYZgt{}} \PY{p}{\PYZlt{}}\PY{n+nt}{div} \PY{n+na}{class}\PY{o}{=}\PY{l+s}{\PYZdq{}pad\PYZhy{}container\PYZdq{}} \PY{n+na}{id}\PY{o}{=}\PY{l+s}{\PYZdq{}pad\PYZdq{}}\PY{p}{\PYZgt{}} \PY{p}{\PYZlt{}}\PY{n+nt}{canvas} \PY{n+na}{id}\PY{o}{=}\PY{l+s}{\PYZdq{}visualizer\PYZdq{}}\PY{p}{\PYZgt{}}\PY{p}{\PYZlt{}}\PY{p}{/}\PY{n+nt}{canvas}\PY{p}{\PYZgt{}} \PY{p}{\PYZlt{}}\PY{p}{/}\PY{n+nt}{div}\PY{p}{\PYZgt{}} \PY{p}{\PYZlt{}}\PY{n+nt}{div} \PY{n+na}{class}\PY{o}{=}\PY{l+s}{\PYZdq{}controls\PYZdq{}}\PY{p}{\PYZgt{}} \PY{p}{\PYZlt{}}\PY{n+nt}{div} \PY{n+na}{class}\PY{o}{=}\PY{l+s}{\PYZdq{}control\PYZhy{}group\PYZdq{}}\PY{p}{\PYZgt{}} \PY{p}{\PYZlt{}}\PY{n+nt}{label} \PY{n+na}{for}\PY{o}{=}\PY{l+s}{\PYZdq{}preset\PYZdq{}}\PY{p}{\PYZgt{}}Preset\PY{p}{\PYZlt{}}\PY{p}{/}\PY{n+nt}{label}\PY{p}{\PYZgt{}} \PY{p}{\PYZlt{}}\PY{n+nt}{select} \PY{n+na}{id}\PY{o}{=}\PY{l+s}{\PYZdq{}preset\PYZdq{}}\PY{p}{\PYZgt{}} \PY{p}{\PYZlt{}}\PY{n+nt}{option} \PY{n+na}{value}\PY{o}{=}\PY{l+s}{\PYZdq{}saw\PYZdq{}}\PY{p}{\PYZgt{}}Aggro Saw Lead\PY{p}{\PYZlt{}}\PY{p}{/}\PY{n+nt}{option}\PY{p}{\PYZgt{}} \PY{p}{\PYZlt{}}\PY{n+nt}{option} \PY{n+na}{value}\PY{o}{=}\PY{l+s}{\PYZdq{}acid\PYZdq{}}\PY{p}{\PYZgt{}}Screaming 303\PY{p}{\PYZlt{}}\PY{p}{/}\PY{n+nt}{option}\PY{p}{\PYZgt{}} \PY{p}{\PYZlt{}}\PY{n+nt}{option} \PY{n+na}{value}\PY{o}{=}\PY{l+s}{\PYZdq{}sub\PYZdq{}}\PY{p}{\PYZgt{}}Distorted Sub\PY{p}{\PYZlt{}}\PY{p}{/}\PY{n+nt}{option}\PY{p}{\PYZgt{}} \PY{p}{\PYZlt{}}\PY{n+nt}{option} \PY{n+na}{value}\PY{o}{=}\PY{l+s}{\PYZdq{}noise\PYZdq{}}\PY{p}{\PYZgt{}}Cyber Chaos\PY{p}{\PYZlt{}}\PY{p}{/}\PY{n+nt}{option}\PY{p}{\PYZgt{}} \PY{p}{\PYZlt{}}\PY{p}{/}\PY{n+nt}{select}\PY{p}{\PYZgt{}} \PY{p}{\PYZlt{}}\PY{p}{/}\PY{n+nt}{div}\PY{p}{\PYZgt{}} \PY{p}{\PYZlt{}}\PY{n+nt}{div} \PY{n+na}{class}\PY{o}{=}\PY{l+s}{\PYZdq{}control\PYZhy{}group\PYZdq{}}\PY{p}{\PYZgt{}} \PY{p}{\PYZlt{}}\PY{n+nt}{label} \PY{n+na}{for}\PY{o}{=}\PY{l+s}{\PYZdq{}scale\PYZdq{}}\PY{p}{\PYZgt{}}Skala (Exotisch)\PY{p}{\PYZlt{}}\PY{p}{/}\PY{n+nt}{label}\PY{p}{\PYZgt{}} \PY{p}{\PYZlt{}}\PY{n+nt}{select} \PY{n+na}{id}\PY{o}{=}\PY{l+s}{\PYZdq{}scale\PYZdq{}}\PY{p}{\PYZgt{}} \PY{p}{\PYZlt{}}\PY{n+nt}{option} \PY{n+na}{value}\PY{o}{=}\PY{l+s}{\PYZdq{}phrygianDom\PYZdq{}}\PY{p}{\PYZgt{}}Phrygisch\PYZhy{}Dominant\PY{p}{\PYZlt{}}\PY{p}{/}\PY{n+nt}{option}\PY{p}{\PYZgt{}} \PY{p}{\PYZlt{}}\PY{n+nt}{option} \PY{n+na}{value}\PY{o}{=}\PY{l+s}{\PYZdq{}hirajoshi\PYZdq{}}\PY{p}{\PYZgt{}}Hirajoshi (Japan)\PY{p}{\PYZlt{}}\PY{p}{/}\PY{n+nt}{option}\PY{p}{\PYZgt{}} \PY{p}{\PYZlt{}}\PY{n+nt}{option} \PY{n+na}{value}\PY{o}{=}\PY{l+s}{\PYZdq{}hungarianMin\PYZdq{}}\PY{p}{\PYZgt{}}Ungarisch Moll\PY{p}{\PYZlt{}}\PY{p}{/}\PY{n+nt}{option}\PY{p}{\PYZgt{}} \PY{p}{\PYZlt{}}\PY{n+nt}{option} \PY{n+na}{value}\PY{o}{=}\PY{l+s}{\PYZdq{}arabic\PYZdq{}}\PY{p}{\PYZgt{}}Arabisch (Bayati)\PY{p}{\PYZlt{}}\PY{p}{/}\PY{n+nt}{option}\PY{p}{\PYZgt{}} \PY{p}{\PYZlt{}}\PY{n+nt}{option} \PY{n+na}{value}\PY{o}{=}\PY{l+s}{\PYZdq{}pelog\PYZdq{}}\PY{p}{\PYZgt{}}Pelog (Bali)\PY{p}{\PYZlt{}}\PY{p}{/}\PY{n+nt}{option}\PY{p}{\PYZgt{}} \PY{p}{\PYZlt{}}\PY{n+nt}{option} \PY{n+na}{value}\PY{o}{=}\PY{l+s}{\PYZdq{}minor\PYZdq{}}\PY{p}{\PYZgt{}}Min\PYZhy{}Pentatonisch\PY{p}{\PYZlt{}}\PY{p}{/}\PY{n+nt}{option}\PY{p}{\PYZgt{}} \PY{p}{\PYZlt{}}\PY{n+nt}{option} \PY{n+na}{value}\PY{o}{=}\PY{l+s}{\PYZdq{}blues\PYZdq{}}\PY{p}{\PYZgt{}}Blues\PY{p}{\PYZlt{}}\PY{p}{/}\PY{n+nt}{option}\PY{p}{\PYZgt{}} \PY{p}{\PYZlt{}}\PY{n+nt}{option} \PY{n+na}{value}\PY{o}{=}\PY{l+s}{\PYZdq{}chromatic\PYZdq{}}\PY{p}{\PYZgt{}}Chromatisch\PY{p}{\PYZlt{}}\PY{p}{/}\PY{n+nt}{option}\PY{p}{\PYZgt{}} \PY{p}{\PYZlt{}}\PY{n+nt}{option} \PY{n+na}{value}\PY{o}{=}\PY{l+s}{\PYZdq{}raw\PYZdq{}}\PY{p}{\PYZgt{}}Unquantisiert\PY{p}{\PYZlt{}}\PY{p}{/}\PY{n+nt}{option}\PY{p}{\PYZgt{}} \PY{p}{\PYZlt{}}\PY{p}{/}\PY{n+nt}{select}\PY{p}{\PYZgt{}} \PY{p}{\PYZlt{}}\PY{p}{/}\PY{n+nt}{div}\PY{p}{\PYZgt{}} \PY{p}{\PYZlt{}}\PY{n+nt}{div} \PY{n+na}{class}\PY{o}{=}\PY{l+s}{\PYZdq{}control\PYZhy{}group\PYZdq{}}\PY{p}{\PYZgt{}} \PY{p}{\PYZlt{}}\PY{n+nt}{label} \PY{n+na}{for}\PY{o}{=}\PY{l+s}{\PYZdq{}beat\PYZhy{}pattern\PYZdq{}}\PY{p}{\PYZgt{}}Drum Pattern\PY{p}{\PYZlt{}}\PY{p}{/}\PY{n+nt}{label}\PY{p}{\PYZgt{}} \PY{p}{\PYZlt{}}\PY{n+nt}{select} \PY{n+na}{id}\PY{o}{=}\PY{l+s}{\PYZdq{}beat\PYZhy{}pattern\PYZdq{}}\PY{p}{\PYZgt{}} \PY{p}{\PYZlt{}}\PY{n+nt}{option} \PY{n+na}{value}\PY{o}{=}\PY{l+s}{\PYZdq{}dhc\PYZdq{}}\PY{p}{\PYZgt{}}DHC Breakbeat\PY{p}{\PYZlt{}}\PY{p}{/}\PY{n+nt}{option}\PY{p}{\PYZgt{}} \PY{p}{\PYZlt{}}\PY{n+nt}{option} \PY{n+na}{value}\PY{o}{=}\PY{l+s}{\PYZdq{}amen\PYZdq{}}\PY{p}{\PYZgt{}}Amen Cyber Cut\PY{p}{\PYZlt{}}\PY{p}{/}\PY{n+nt}{option}\PY{p}{\PYZgt{}} \PY{p}{\PYZlt{}}\PY{n+nt}{option} \PY{n+na}{value}\PY{o}{=}\PY{l+s}{\PYZdq{}gabber\PYZdq{}}\PY{p}{\PYZgt{}}Gabber 4\PYZhy{}to\PYZhy{}Floor\PY{p}{\PYZlt{}}\PY{p}{/}\PY{n+nt}{option}\PY{p}{\PYZgt{}} \PY{p}{\PYZlt{}}\PY{n+nt}{option} \PY{n+na}{value}\PY{o}{=}\PY{l+s}{\PYZdq{}industrial\PYZdq{}}\PY{p}{\PYZgt{}}Industrial Sync\PY{p}{\PYZlt{}}\PY{p}{/}\PY{n+nt}{option}\PY{p}{\PYZgt{}} \PY{p}{\PYZlt{}}\PY{n+nt}{option} \PY{n+na}{value}\PY{o}{=}\PY{l+s}{\PYZdq{}speedcore\PYZdq{}}\PY{p}{\PYZgt{}}Speedcore Terror\PY{p}{\PYZlt{}}\PY{p}{/}\PY{n+nt}{option}\PY{p}{\PYZgt{}} \PY{p}{\PYZlt{}}\PY{p}{/}\PY{n+nt}{select}\PY{p}{\PYZgt{}} \PY{p}{\PYZlt{}}\PY{p}{/}\PY{n+nt}{div}\PY{p}{\PYZgt{}} \PY{p}{\PYZlt{}}\PY{n+nt}{div} \PY{n+na}{class}\PY{o}{=}\PY{l+s}{\PYZdq{}control\PYZhy{}group\PYZdq{}}\PY{p}{\PYZgt{}} \PY{p}{\PYZlt{}}\PY{n+nt}{label} \PY{n+na}{for}\PY{o}{=}\PY{l+s}{\PYZdq{}bpm\PYZdq{}}\PY{p}{\PYZgt{}}Tempo / Beat\PY{p}{\PYZlt{}}\PY{p}{/}\PY{n+nt}{label}\PY{p}{\PYZgt{}} \PY{p}{\PYZlt{}}\PY{n+nt}{div} \PY{n+na}{style}\PY{o}{=}\PY{l+s}{\PYZdq{}display: flex; gap: 4px;\PYZdq{}}\PY{p}{\PYZgt{}} \PY{p}{\PYZlt{}}\PY{n+nt}{input} \PY{n+na}{type}\PY{o}{=}\PY{l+s}{\PYZdq{}number\PYZdq{}} \PY{n+na}{id}\PY{o}{=}\PY{l+s}{\PYZdq{}bpm\PYZdq{}} \PY{n+na}{value}\PY{o}{=}\PY{l+s}{\PYZdq{}180\PYZdq{}} \PY{n+na}{min}\PY{o}{=}\PY{l+s}{\PYZdq{}120\PYZdq{}} \PY{n+na}{max}\PY{o}{=}\PY{l+s}{\PYZdq{}240\PYZdq{}} \PY{n+na}{style}\PY{o}{=}\PY{l+s}{\PYZdq{}width: 45\PYZpc{};\PYZdq{}}\PY{p}{\PYZgt{}} \PY{p}{\PYZlt{}}\PY{n+nt}{button} \PY{n+na}{id}\PY{o}{=}\PY{l+s}{\PYZdq{}beat\PYZhy{}btn\PYZdq{}} \PY{n+na}{style}\PY{o}{=}\PY{l+s}{\PYZdq{}width: 55\PYZpc{};\PYZdq{}}\PY{p}{\PYZgt{}}BEAT RUN\PY{p}{\PYZlt{}}\PY{p}{/}\PY{n+nt}{button}\PY{p}{\PYZgt{}} \PY{p}{\PYZlt{}}\PY{p}{/}\PY{n+nt}{div}\PY{p}{\PYZgt{}} \PY{p}{\PYZlt{}}\PY{p}{/}\PY{n+nt}{div}\PY{p}{\PYZgt{}} \PY{p}{\PYZlt{}}\PY{p}{/}\PY{n+nt}{div}\PY{p}{\PYZgt{}} \PY{p}{\PYZlt{}}\PY{p}{/}\PY{n+nt}{div}\PY{p}{\PYZgt{}} \PY{p}{\PYZlt{}}\PY{n+nt}{script}\PY{p}{\PYZgt{}} \PY{+w}{ }\PY{k+kd}{let}\PY{+w}{ }\PY{n+nx}{audioCtx}\PY{+w}{ }\PY{o}{=}\PY{+w}{ }\PY{k+kc}{null}\PY{p}{;} \PY{+w}{ }\PY{k+kd}{let}\PY{+w}{ }\PY{n+nx}{masterGain}\PY{p}{,}\PY{+w}{ }\PY{n+nx}{driveNode}\PY{p}{,}\PY{+w}{ }\PY{n+nx}{filterNode}\PY{p}{,}\PY{+w}{ }\PY{n+nx}{mainOsc}\PY{p}{,}\PY{+w}{ }\PY{n+nx}{subOsc}\PY{p}{;} \PY{+w}{ }\PY{k+kd}{let}\PY{+w}{ }\PY{n+nx}{noiseBuffer}\PY{+w}{ }\PY{o}{=}\PY{+w}{ }\PY{k+kc}{null}\PY{p}{;} \PY{+w}{ }\PY{k+kd}{let}\PY{+w}{ }\PY{n+nx}{isTouching}\PY{+w}{ }\PY{o}{=}\PY{+w}{ }\PY{k+kc}{false}\PY{p}{;} \PY{+w}{ }\PY{k+kd}{let}\PY{+w}{ }\PY{n+nx}{beatPlaying}\PY{+w}{ }\PY{o}{=}\PY{+w}{ }\PY{k+kc}{false}\PY{p}{;} \PY{+w}{ }\PY{c+c1}{// Scheduler Variables (Low Latency Web Audio Clock)} \PY{+w}{ }\PY{k+kd}{let}\PY{+w}{ }\PY{n+nx}{lookahead}\PY{+w}{ }\PY{o}{=}\PY{+w}{ }\PY{l+m+mf}{25.0}\PY{p}{;}\PY{+w}{ }\PY{c+c1}{// ms} \PY{+w}{ }\PY{k+kd}{let}\PY{+w}{ }\PY{n+nx}{scheduleAheadTime}\PY{+w}{ }\PY{o}{=}\PY{+w}{ }\PY{l+m+mf}{0.1}\PY{p}{;}\PY{+w}{ }\PY{c+c1}{// seconds} \PY{+w}{ }\PY{k+kd}{let}\PY{+w}{ }\PY{n+nx}{nextNoteTime}\PY{+w}{ }\PY{o}{=}\PY{+w}{ }\PY{l+m+mf}{0.0}\PY{p}{;} \PY{+w}{ }\PY{k+kd}{let}\PY{+w}{ }\PY{n+nx}{current16thNote}\PY{+w}{ }\PY{o}{=}\PY{+w}{ }\PY{l+m+mf}{0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s1}{\PYZsq{}interactive\PYZsq{}}\PY{+w}{ }\PY{p}{\PYZcb{}}\PY{p}{)}\PY{p}{;} \PY{+w}{ }\PY{n+nx}{masterGain}\PY{+w}{ }\PY{o}{=}\PY{+w}{ }\PY{n+nx}{audioCtx}\PY{p}{.}\PY{n+nx}{createGain}\PY{p}{(}\PY{p}{)}\PY{p}{;} \PY{+w}{ }\PY{n+nx}{masterGain}\PY{p}{.}\PY{n+nx}{gain}\PY{p}{.}\PY{n+nx}{value}\PY{+w}{ }\PY{o}{=}\PY{+w}{ }\PY{l+m+mf}{0.3}\PY{p}{;} \PY{+w}{ }\PY{c+c1}{// Hardcore Overdrive Distortion Node} \PY{+w}{ }\PY{n+nx}{driveNode}\PY{+w}{ }\PY{o}{=}\PY{+w}{ }\PY{n+nx}{audioCtx}\PY{p}{.}\PY{n+nx}{createWaveShaper}\PY{p}{(}\PY{p}{)}\PY{p}{;} \PY{+w}{ }\PY{n+nx}{driveNode}\PY{p}{.}\PY{n+nx}{curve}\PY{+w}{ }\PY{o}{=}\PY{+w}{ }\PY{n+nx}{makeDistortionCurve}\PY{p}{(}\PY{l+m+mf}{95}\PY{p}{)}\PY{p}{;} \PY{+w}{ }\PY{n+nx}{driveNode}\PY{p}{.}\PY{n+nx}{oversample}\PY{+w}{ }\PY{o}{=}\PY{+w}{ }\PY{l+s+s1}{\PYZsq{}4x\PYZsq{}}\PY{p}{;} \PY{+w}{ }\PY{c+c1}{// Filter Node} \PY{+w}{ }\PY{n+nx}{filterNode}\PY{+w}{ }\PY{o}{=}\PY{+w}{ }\PY{n+nx}{audioCtx}\PY{p}{.}\PY{n+nx}{createBiquadFilter}\PY{p}{(}\PY{p}{)}\PY{p}{;} \PY{+w}{ }\PY{n+nx}{filterNode}\PY{p}{.}\PY{n+nx}{type}\PY{+w}{ }\PY{o}{=}\PY{+w}{ }\PY{l+s+s1}{\PYZsq{}lowpass\PYZsq{}}\PY{p}{;} \PY{+w}{ }\PY{n+nx}{filterNode}\PY{p}{.}\PY{n+nx}{frequency}\PY{p}{.}\PY{n+nx}{value}\PY{+w}{ }\PY{o}{=}\PY{+w}{ }\PY{l+m+mf}{2000}\PY{p}{;} \PY{+w}{ }\PY{n+nx}{filterNode}\PY{p}{.}\PY{n+nx}{Q}\PY{p}{.}\PY{n+nx}{value}\PY{+w}{ }\PY{o}{=}\PY{+w}{ }\PY{l+m+mf}{6}\PY{p}{;} \PY{+w}{ }\PY{n+nx}{filterNode}\PY{p}{.}\PY{n+nx}{connect}\PY{p}{(}\PY{n+nx}{driveNode}\PY{p}{)}\PY{p}{;} \PY{+w}{ }\PY{n+nx}{driveNode}\PY{p}{.}\PY{n+nx}{connect}\PY{p}{(}\PY{n+nx}{masterGain}\PY{p}{)}\PY{p}{;} \PY{+w}{ }\PY{n+nx}{masterGain}\PY{p}{.}\PY{n+nx}{connect}\PY{p}{(}\PY{n+nx}{audioCtx}\PY{p}{.}\PY{n+nx}{destination}\PY{p}{)}\PY{p}{;} \PY{+w}{ }\PY{c+c1}{// Pre\PYZhy{}generate noise buffer to avoid audio thread stalls} \PY{+w}{ }\PY{n+nx}{createNoiseBuffer}\PY{p}{(}\PY{p}{)}\PY{p}{;} \PY{+w}{ }\PY{p}{\PYZcb{}} \PY{+w}{ }\PY{k+kd}{function}\PY{+w}{ }\PY{n+nx}{createNoiseBuffer}\PY{p}{(}\PY{p}{)}\PY{+w}{ }\PY{p}{\PYZob{}} \PY{+w}{ }\PY{k+kd}{const}\PY{+w}{ }\PY{n+nx}{bufferSize}\PY{+w}{ }\PY{o}{=}\PY{+w}{ }\PY{n+nx}{audioCtx}\PY{p}{.}\PY{n+nx}{sampleRate}\PY{+w}{ }\PY{o}{*}\PY{+w}{ }\PY{l+m+mf}{1.0}\PY{p}{;} \PY{+w}{ }\PY{n+nx}{noiseBuffer}\PY{+w}{ }\PY{o}{=}\PY{+w}{ }\PY{n+nx}{audioCtx}\PY{p}{.}\PY{n+nx}{createBuffer}\PY{p}{(}\PY{l+m+mf}{1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{+w}{ }\PY{l+s+s1}{\PYZsq{}suspended\PYZsq{}}\PY{p}{)}\PY{+w}{ }\PY{n+nx}{audioCtx}\PY{p}{.}\PY{n+nx}{resume}\PY{p}{(}\PY{p}{)}\PY{p}{;} \PY{+w}{ }\PY{k}{if}\PY{+w}{ }\PY{p}{(}\PY{n+nx}{mainOsc}\PY{p}{)}\PY{+w}{ }\PY{k}{return}\PY{p}{;} \PY{+w}{ }\PY{k+kd}{const}\PY{+w}{ }\PY{n+nx}{preset}\PY{+w}{ }\PY{o}{=}\PY{+w}{ }\PY{n+nb}{document}\PY{p}{.}\PY{n+nx}{getElementById}\PY{p}{(}\PY{l+s+s1}{\PYZsq{}preset\PYZsq{}}\PY{p}{)}\PY{p}{.}\PY{n+nx}{value}\PY{p}{;} \PY{+w}{ }\PY{n+nx}{mainOsc}\PY{+w}{ }\PY{o}{=}\PY{+w}{ }\PY{n+nx}{audioCtx}\PY{p}{.}\PY{n+nx}{createOscillator}\PY{p}{(}\PY{p}{)}\PY{p}{;} \PY{+w}{ }\PY{n+nx}{subOsc}\PY{+w}{ }\PY{o}{=}\PY{+w}{ }\PY{n+nx}{audioCtx}\PY{p}{.}\PY{n+nx}{createOscillator}\PY{p}{(}\PY{p}{)}\PY{p}{;} \PY{+w}{ }\PY{k}{if}\PY{+w}{ }\PY{p}{(}\PY{n+nx}{preset}\PY{+w}{ }\PY{o}{===}\PY{+w}{ }\PY{l+s+s1}{\PYZsq{}saw\PYZsq{}}\PY{p}{)}\PY{+w}{ }\PY{p}{\PYZob{}} \PY{+w}{ }\PY{n+nx}{mainOsc}\PY{p}{.}\PY{n+nx}{type}\PY{+w}{ }\PY{o}{=}\PY{+w}{ }\PY{l+s+s1}{\PYZsq{}sawtooth\PYZsq{}}\PY{p}{;}\PY{+w}{ }\PY{n+nx}{subOsc}\PY{p}{.}\PY{n+nx}{type}\PY{+w}{ }\PY{o}{=}\PY{+w}{ }\PY{l+s+s1}{\PYZsq{}square\PYZsq{}}\PY{p}{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}{(}\PY{n+nx}{note}\PY{p}{)}\PY{p}{;} \PY{+w}{ }\PY{p}{\PYZcb{}} \PY{+w}{ }\PY{k+kd}{const}\PY{+w}{ }\PY{n+nx}{minVal}\PY{+w}{ }\PY{o}{=}\PY{+w}{ }\PY{l+m+mf}{100}\PY{p}{,}\PY{+w}{ }\PY{n+nx}{maxVal}\PY{+w}{ }\PY{o}{=}\PY{+w}{ }\PY{l+m+mf}{10000}\PY{p}{;} \PY{+w}{ }\PY{k+kd}{const}\PY{+w}{ }\PY{n+nx}{cutoff}\PY{+w}{ }\PY{o}{=}\PY{+w}{ }\PY{n+nx}{minVal}\PY{+w}{ }\PY{o}{*}\PY{+w}{ }\PY{n+nb}{Math}\PY{p}{.}\PY{n+nx}{pow}\PY{p}{(}\PY{n+nx}{maxVal}\PY{+w}{ }\PY{o}{/}\PY{+w}{ }\PY{n+nx}{minVal}\PY{p}{,}\PY{+w}{ }\PY{n+nx}{y}\PY{p}{)}\PY{p}{;} \PY{+w}{ }\PY{c+c1}{// Immediate value scheduling for zero latency} \PY{+w}{ }\PY{k+kd}{const}\PY{+w}{ }\PY{n+nx}{now}\PY{+w}{ }\PY{o}{=}\PY{+w}{ }\PY{n+nx}{audioCtx}\PY{p}{.}\PY{n+nx}{currentTime}\PY{p}{;} \PY{+w}{ }\PY{n+nx}{mainOsc}\PY{p}{.}\PY{n+nx}{frequency}\PY{p}{.}\PY{n+nx}{setValueAtTime}\PY{p}{(}\PY{n+nx}{freq}\PY{p}{,}\PY{+w}{ }\PY{n+nx}{now}\PY{p}{)}\PY{p}{;} \PY{+w}{ }\PY{n+nx}{subOsc}\PY{p}{.}\PY{n+nx}{frequency}\PY{p}{.}\PY{n+nx}{setValueAtTime}\PY{p}{(}\PY{n+nx}{freq}\PY{+w}{ }\PY{o}{/}\PY{+w}{ }\PY{l+m+mf}{2}\PY{p}{,}\PY{+w}{ }\PY{n+nx}{now}\PY{p}{)}\PY{p}{;} \PY{+w}{ }\PY{n+nx}{filterNode}\PY{p}{.}\PY{n+nx}{frequency}\PY{p}{.}\PY{n+nx}{setValueAtTime}\PY{p}{(}\PY{n+nx}{cutoff}\PY{p}{,}\PY{+w}{ }\PY{n+nx}{now}\PY{p}{)}\PY{p}{;} \PY{+w}{ }\PY{k}{if}\PY{+w}{ }\PY{p}{(}\PY{n+nb}{document}\PY{p}{.}\PY{n+nx}{getElementById}\PY{p}{(}\PY{l+s+s1}{\PYZsq{}preset\PYZsq{}}\PY{p}{)}\PY{p}{.}\PY{n+nx}{value}\PY{+w}{ }\PY{o}{===}\PY{+w}{ }\PY{l+s+s1}{\PYZsq{}acid\PYZsq{}}\PY{p}{)}\PY{+w}{ }\PY{p}{\PYZob{}} \PY{+w}{ }\PY{n+nx}{filterNode}\PY{p}{.}\PY{n+nx}{Q}\PY{p}{.}\PY{n+nx}{setValueAtTime}\PY{p}{(}\PY{l+m+mf}{4}\PY{+w}{ }\PY{o}{+}\PY{+w}{ }\PY{p}{(}\PY{n+nx}{y}\PY{+w}{ }\PY{o}{*}\PY{+w}{ }\PY{l+m+mf}{18}\PY{p}{)}\PY{p}{,}\PY{+w}{ }\PY{n+nx}{now}\PY{p}{)}\PY{p}{;} \PY{+w}{ }\PY{p}{\PYZcb{}}\PY{+w}{ }\PY{k}{else}\PY{+w}{ }\PY{p}{\PYZob{}} \PY{+w}{ }\PY{n+nx}{filterNode}\PY{p}{.}\PY{n+nx}{Q}\PY{p}{.}\PY{n+nx}{setValueAtTime}\PY{p}{(}\PY{l+m+mf}{4}\PY{p}{,}\PY{+w}{ }\PY{n+nx}{now}\PY{p}{)}\PY{p}{;} \PY{+w}{ }\PY{p}{\PYZcb{}} \PY{+w}{ }\PY{p}{\PYZcb{}} \PY{+w}{ }\PY{c+c1}{// High\PYZhy{}Precision Drum Synthesizer} \PY{+w}{ }\PY{k+kd}{function}\PY{+w}{ }\PY{n+nx}{triggerDrum}\PY{p}{(}\PY{n+nx}{type}\PY{p}{,}\PY{+w}{ }\PY{n+nx}{time}\PY{p}{)}\PY{+w}{ }\PY{p}{\PYZob{}} \PY{+w}{ }\PY{k}{if}\PY{+w}{ }\PY{p}{(}\PY{n+nx}{type}\PY{+w}{ }\PY{o}{===}\PY{+w}{ }\PY{l+s+s1}{\PYZsq{}kick\PYZsq{}}\PY{p}{)}\PY{+w}{ }\PY{p}{\PYZob{}} \PY{+w}{ }\PY{k+kd}{let}\PY{+w}{ }\PY{n+nx}{osc}\PY{+w}{ }\PY{o}{=}\PY{+w}{ }\PY{n+nx}{audioCtx}\PY{p}{.}\PY{n+nx}{createOscillator}\PY{p}{(}\PY{p}{)}\PY{p}{;} \PY{+w}{ }\PY{k+kd}{let}\PY{+w}{ }\PY{n+nx}{gain}\PY{+w}{ }\PY{o}{=}\PY{+w}{ }\PY{n+nx}{audioCtx}\PY{p}{.}\PY{n+nx}{createGain}\PY{p}{(}\PY{p}{)}\PY{p}{;} \PY{+w}{ }\PY{n+nx}{osc}\PY{p}{.}\PY{n+nx}{frequency}\PY{p}{.}\PY{n+nx}{setValueAtTime}\PY{p}{(}\PY{l+m+mf}{180}\PY{p}{,}\PY{+w}{ }\PY{n+nx}{time}\PY{p}{)}\PY{p}{;} \PY{+w}{ }\PY{n+nx}{osc}\PY{p}{.}\PY{n+nx}{frequency}\PY{p}{.}\PY{n+nx}{exponentialRampToValueAtTime}\PY{p}{(}\PY{l+m+mf}{30}\PY{p}{,}\PY{+w}{ }\PY{n+nx}{time}\PY{+w}{ }\PY{o}{+}\PY{+w}{ }\PY{l+m+mf}{0.1}\PY{p}{)}\PY{p}{;} \PY{+w}{ }\PY{n+nx}{gain}\PY{p}{.}\PY{n+nx}{gain}\PY{p}{.}\PY{n+nx}{setValueAtTime}\PY{p}{(}\PY{l+m+mf}{1.4}\PY{p}{,}\PY{+w}{ }\PY{n+nx}{time}\PY{p}{)}\PY{p}{;} \PY{+w}{ }\PY{n+nx}{gain}\PY{p}{.}\PY{n+nx}{gain}\PY{p}{.}\PY{n+nx}{exponentialRampToValueAtTime}\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filter}\PY{p}{.}\PY{n+nx}{type}\PY{+w}{ }\PY{o}{=}\PY{+w}{ }\PY{l+s+s1}{\PYZsq{}highpass\PYZsq{}}\PY{p}{;} \PY{+w}{ }\PY{n+nx}{filter}\PY{p}{.}\PY{n+nx}{frequency}\PY{p}{.}\PY{n+nx}{value}\PY{+w}{ }\PY{o}{=}\PY{+w}{ }\PY{l+m+mf}{800}\PY{p}{;} \PY{+w}{ }\PY{k+kd}{let}\PY{+w}{ }\PY{n+nx}{gain}\PY{+w}{ }\PY{o}{=}\PY{+w}{ }\PY{n+nx}{audioCtx}\PY{p}{.}\PY{n+nx}{createGain}\PY{p}{(}\PY{p}{)}\PY{p}{;} \PY{+w}{ }\PY{n+nx}{gain}\PY{p}{.}\PY{n+nx}{gain}\PY{p}{.}\PY{n+nx}{setValueAtTime}\PY{p}{(}\PY{l+m+mf}{0.9}\PY{p}{,}\PY{+w}{ }\PY{n+nx}{time}\PY{p}{)}\PY{p}{;} \PY{+w}{ }\PY{n+nx}{gain}\PY{p}{.}\PY{n+nx}{gain}\PY{p}{.}\PY{n+nx}{exponentialRampToValueAtTime}\PY{p}{(}\PY{l+m+mf}{0.01}\PY{p}{,}\PY{+w}{ }\PY{n+nx}{time}\PY{+w}{ }\PY{o}{+}\PY{+w}{ }\PY{l+m+mf}{0.09}\PY{p}{)}\PY{p}{;} \PY{+w}{ }\PY{n+nx}{noiseSrc}\PY{p}{.}\PY{n+nx}{connect}\PY{p}{(}\PY{n+nx}{filter}\PY{p}{)}\PY{p}{;} \PY{+w}{ }\PY{n+nx}{filter}\PY{p}{.}\PY{n+nx}{connect}\PY{p}{(}\PY{n+nx}{driveNode}\PY{p}{)}\PY{p}{;} \PY{+w}{ }\PY{n+nx}{noiseSrc}\PY{p}{.}\PY{n+nx}{start}\PY{p}{(}\PY{n+nx}{time}\PY{p}{)}\PY{p}{;}\PY{+w}{ }\PY{n+nx}{noiseSrc}\PY{p}{.}\PY{n+nx}{stop}\PY{p}{(}\PY{n+nx}{time}\PY{+w}{ }\PY{o}{+}\PY{+w}{ }\PY{l+m+mf}{0.09}\PY{p}{)}\PY{p}{;} \PY{+w}{ }\PY{p}{\PYZcb{}}\PY{+w}{ }\PY{k}{else}\PY{+w}{ }\PY{k}{if}\PY{+w}{ }\PY{p}{(}\PY{n+nx}{type}\PY{+w}{ }\PY{o}{===}\PY{+w}{ }\PY{l+s+s1}{\PYZsq{}hat\PYZsq{}}\PY{p}{)}\PY{+w}{ }\PY{p}{\PYZob{}} \PY{+w}{ }\PY{k+kd}{let}\PY{+w}{ }\PY{n+nx}{noiseSrc}\PY{+w}{ }\PY{o}{=}\PY{+w}{ }\PY{n+nx}{audioCtx}\PY{p}{.}\PY{n+nx}{createBufferSource}\PY{p}{(}\PY{p}{)}\PY{p}{;} \PY{+w}{ }\PY{n+nx}{noiseSrc}\PY{p}{.}\PY{n+nx}{buffer}\PY{+w}{ }\PY{o}{=}\PY{+w}{ }\PY{n+nx}{noiseBuffer}\PY{p}{;} \PY{+w}{ }\PY{k+kd}{let}\PY{+w}{ }\PY{n+nx}{filter}\PY{+w}{ }\PY{o}{=}\PY{+w}{ }\PY{n+nx}{audioCtx}\PY{p}{.}\PY{n+nx}{createBiquadFilter}\PY{p}{(}\PY{p}{)}\PY{p}{;} \PY{+w}{ }\PY{n+nx}{filter}\PY{p}{.}\PY{n+nx}{type}\PY{+w}{ }\PY{o}{=}\PY{+w}{ }\PY{l+s+s1}{\PYZsq{}highpass\PYZsq{}}\PY{p}{;} \PY{+w}{ }\PY{n+nx}{filter}\PY{p}{.}\PY{n+nx}{frequency}\PY{p}{.}\PY{n+nx}{value}\PY{+w}{ }\PY{o}{=}\PY{+w}{ }\PY{l+m+mf}{6000}\PY{p}{;} \PY{+w}{ }\PY{k+kd}{let}\PY{+w}{ }\PY{n+nx}{gain}\PY{+w}{ }\PY{o}{=}\PY{+w}{ }\PY{n+nx}{audioCtx}\PY{p}{.}\PY{n+nx}{createGain}\PY{p}{(}\PY{p}{)}\PY{p}{;} \PY{+w}{ }\PY{n+nx}{gain}\PY{p}{.}\PY{n+nx}{gain}\PY{p}{.}\PY{n+nx}{setValueAtTime}\PY{p}{(}\PY{l+m+mf}{0.4}\PY{p}{,}\PY{+w}{ }\PY{n+nx}{time}\PY{p}{)}\PY{p}{;} \PY{+w}{ }\PY{n+nx}{gain}\PY{p}{.}\PY{n+nx}{gain}\PY{p}{.}\PY{n+nx}{exponentialRampToValueAtTime}\PY{p}{(}\PY{l+m+mf}{0.001}\PY{p}{,}\PY{+w}{ }\PY{n+nx}{time}\PY{+w}{ }\PY{o}{+}\PY{+w}{ }\PY{l+m+mf}{0.04}\PY{p}{)}\PY{p}{;} \PY{+w}{ }\PY{n+nx}{noiseSrc}\PY{p}{.}\PY{n+nx}{connect}\PY{p}{(}\PY{n+nx}{filter}\PY{p}{)}\PY{p}{;} \PY{+w}{ }\PY{n+nx}{filter}\PY{p}{.}\PY{n+nx}{connect}\PY{p}{(}\PY{n+nx}{driveNode}\PY{p}{)}\PY{p}{;} \PY{+w}{ }\PY{n+nx}{noiseSrc}\PY{p}{.}\PY{n+nx}{start}\PY{p}{(}\PY{n+nx}{time}\PY{p}{)}\PY{p}{;}\PY{+w}{ }\PY{n+nx}{noiseSrc}\PY{p}{.}\PY{n+nx}{stop}\PY{p}{(}\PY{n+nx}{time}\PY{+w}{ }\PY{o}{+}\PY{+w}{ }\PY{l+m+mf}{0.04}\PY{p}{)}\PY{p}{;} \PY{+w}{ }\PY{p}{\PYZcb{}} \PY{+w}{ }\PY{p}{\PYZcb{}} \PY{+w}{ }\PY{c+c1}{// Web Audio Lookahead Scheduler} \PY{+w}{ }\PY{k+kd}{function}\PY{+w}{ }\PY{n+nx}{nextNote}\PY{p}{(}\PY{p}{)}\PY{+w}{ }\PY{p}{\PYZob{}} \PY{+w}{ }\PY{k+kd}{const}\PY{+w}{ }\PY{n+nx}{bpm}\PY{+w}{ }\PY{o}{=}\PY{+w}{ }\PY{n+nb}{parseInt}\PY{p}{(}\PY{n+nb}{document}\PY{p}{.}\PY{n+nx}{getElementById}\PY{p}{(}\PY{l+s+s1}{\PYZsq{}bpm\PYZsq{}}\PY{p}{)}\PY{p}{.}\PY{n+nx}{value}\PY{p}{)}\PY{p}{;} \PY{+w}{ }\PY{k+kd}{const}\PY{+w}{ }\PY{n+nx}{secondsPerBeat}\PY{+w}{ }\PY{o}{=}\PY{+w}{ }\PY{l+m+mf}{60.0}\PY{+w}{ }\PY{o}{/}\PY{+w}{ }\PY{n+nx}{bpm}\PY{p}{;} \PY{+w}{ }\PY{n+nx}{nextNoteTime}\PY{+w}{ }\PY{o}{+=}\PY{+w}{ }\PY{l+m+mf}{0.25}\PY{+w}{ }\PY{o}{*}\PY{+w}{ }\PY{n+nx}{secondsPerBeat}\PY{p}{;}\PY{+w}{ }\PY{c+c1}{// 16th note step} \PY{+w}{ }\PY{n+nx}{current16thNote}\PY{+w}{ }\PY{o}{=}\PY{+w}{ }\PY{p}{(}\PY{n+nx}{current16thNote}\PY{+w}{ }\PY{o}{+}\PY{+w}{ }\PY{l+m+mf}{1}\PY{p}{)}\PY{+w}{ }\PY{o}{\PYZpc{}}\PY{+w}{ }\PY{l+m+mf}{16}\PY{p}{;} \PY{+w}{ }\PY{p}{\PYZcb{}} \PY{+w}{ }\PY{k+kd}{function}\PY{+w}{ }\PY{n+nx}{scheduleNote}\PY{p}{(}\PY{n+nx}{step}\PY{p}{,}\PY{+w}{ }\PY{n+nx}{time}\PY{p}{)}\PY{+w}{ }\PY{p}{\PYZob{}} \PY{+w}{ }\PY{k+kd}{const}\PY{+w}{ }\PY{n+nx}{patKey}\PY{+w}{ }\PY{o}{=}\PY{+w}{ }\PY{n+nb}{document}\PY{p}{.}\PY{n+nx}{getElementById}\PY{p}{(}\PY{l+s+s1}{\PYZsq{}beat\PYZhy{}pattern\PYZsq{}}\PY{p}{)}\PY{p}{.}\PY{n+nx}{value}\PY{p}{;} \PY{+w}{ }\PY{k+kd}{const}\PY{+w}{ }\PY{n+nx}{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Y{+w}{ }\PY{o}{+}\PY{+w}{ }\PY{n+nx}{scheduleAheadTime}\PY{p}{)}\PY{+w}{ }\PY{p}{\PYZob{}} \PY{+w}{ }\PY{n+nx}{scheduleNote}\PY{p}{(}\PY{n+nx}{current16thNote}\PY{p}{,}\PY{+w}{ }\PY{n+nx}{nextNoteTime}\PY{p}{)}\PY{p}{;} \PY{+w}{ }\PY{n+nx}{nextNote}\PY{p}{(}\PY{p}{)}\PY{p}{;} \PY{+w}{ }\PY{p}{\PYZcb{}} \PY{+w}{ }\PY{k}{if}\PY{+w}{ }\PY{p}{(}\PY{n+nx}{beatPlaying}\PY{p}{)}\PY{+w}{ }\PY{p}{\PYZob{}} \PY{+w}{ }\PY{n+nx}{timerID}\PY{+w}{ }\PY{o}{=}\PY{+w}{ }\PY{n+nb}{window}\PY{p}{.}\PY{n+nx}{setTimeout}\PY{p}{(}\PY{n+nx}{scheduler}\PY{p}{,}\PY{+w}{ }\PY{n+nx}{lookahead}\PY{p}{)}\PY{p}{;} \PY{+w}{ }\PY{p}{\PYZcb{}} \PY{+w}{ }\PY{p}{\PYZcb{}} \PY{+w}{ }\PY{n+nb}{document}\PY{p}{.}\PY{n+nx}{getElementById}\PY{p}{(}\PY{l+s+s1}{\PYZsq{}beat\PYZhy{}btn\PYZsq{}}\PY{p}{)}\PY{p}{.}\PY{n+nx}{addEventListener}\PY{p}{(}\PY{l+s+s1}{\PYZsq{}click\PYZsq{}}\PY{p}{,}\PY{+w}{ }\PY{p}{(}\PY{n+nx}{e}\PY{p}{)}\PY{+w}{ }\PY{p}{=\PYZgt{}}\PY{+w}{ }\PY{p}{\PYZob{}} \PY{+w}{ }\PY{n+nx}{initAudio}\PY{p}{(}\PY{p}{)}\PY{p}{;} \PY{+w}{ }\PY{k}{if}\PY{+w}{ }\PY{p}{(}\PY{n+nx}{audioCtx}\PY{p}{.}\PY{n+nx}{state}\PY{+w}{ }\PY{o}{===}\PY{+w}{ }\PY{l+s+s1}{\PYZsq{}suspended\PYZsq{}}\PY{p}{)}\PY{+w}{ }\PY{n+nx}{audioCtx}\PY{p}{.}\PY{n+nx}{resume}\PY{p}{(}\PY{p}{)}\PY{p}{;} \PY{+w}{ }\PY{n+nx}{beatPlaying}\PY{+w}{ }\PY{o}{=}\PY{+w}{ }\PY{o}{!}\PY{n+nx}{beatPlaying}\PY{p}{;} \PY{+w}{ }\PY{n+nx}{e}\PY{p}{.}\PY{n+nx}{target}\PY{p}{.}\PY{n+nx}{classList}\PY{p}{.}\PY{n+nx}{toggle}\PY{p}{(}\PY{l+s+s1}{\PYZsq{}active\PYZsq{}}\PY{p}{,}\PY{+w}{ }\PY{n+nx}{beatPlaying}\PY{p}{)}\PY{p}{;} \PY{+w}{ }\PY{k}{if}\PY{+w}{ }\PY{p}{(}\PY{n+nx}{beatPlaying}\PY{p}{)}\PY{+w}{ }\PY{p}{\PYZob{}} \PY{+w}{ }\PY{n+nx}{current16thNote}\PY{+w}{ }\PY{o}{=}\PY{+w}{ }\PY{l+m+mf}{0}\PY{p}{;} \PY{+w}{ }\PY{n+nx}{nextNoteTime}\PY{+w}{ }\PY{o}{=}\PY{+w}{ }\PY{n+nx}{audioCtx}\PY{p}{.}\PY{n+nx}{currentTime}\PY{p}{;} \PY{+w}{ }\PY{n+nx}{scheduler}\PY{p}{(}\PY{p}{)}\PY{p}{;} \PY{+w}{ }\PY{p}{\PYZcb{}}\PY{+w}{ }\PY{k}{else}\PY{+w}{ }\PY{p}{\PYZob{}} \PY{+w}{ }\PY{n+nx}{clearTimeout}\PY{p}{(}\PY{n+nx}{timerID}\PY{p}{)}\PY{p}{;} \PY{+w}{ }\PY{p}{\PYZcb{}} \PY{+w}{ }\PY{p}{\PYZcb{}}\PY{p}{)}\PY{p}{;} \PY{+w}{ }\PY{c+c1}{// Touch / Mouse Interaction with RAF Decoupling for smooth performance} \PY{+w}{ }\PY{k+kd}{const}\PY{+w}{ }\PY{n+nx}{pad}\PY{+w}{ }\PY{o}{=}\PY{+w}{ }\PY{n+nb}{document}\PY{p}{.}\PY{n+nx}{getElementById}\PY{p}{(}\PY{l+s+s1}{\PYZsq{}pad\PYZsq{}}\PY{p}{)}\PY{p}{;} \PY{+w}{ }\PY{k+kd}{const}\PY{+w}{ }\PY{n+nx}{canvas}\PY{+w}{ }\PY{o}{=}\PY{+w}{ }\PY{n+nb}{document}\PY{p}{.}\PY{n+nx}{getElementById}\PY{p}{(}\PY{l+s+s1}{\PYZsq{}visualizer\PYZsq{}}\PY{p}{)}\PY{p}{;} \PY{+w}{ }\PY{k+kd}{const}\PY{+w}{ }\PY{n+nx}{ctx}\PY{+w}{ }\PY{o}{=}\PY{+w}{ }\PY{n+nx}{canvas}\PY{p}{.}\PY{n+nx}{getContext}\PY{p}{(}\PY{l+s+s1}{\PYZsq{}2d\PYZsq{}}\PY{p}{)}\PY{p}{;} \PY{+w}{ }\PY{k+kd}{let}\PY{+w}{ }\PY{n+nx}{touchX}\PY{+w}{ }\PY{o}{=}\PY{+w}{ }\PY{l+m+mf}{0}\PY{p}{,}\PY{+w}{ }\PY{n+nx}{touchY}\PY{+w}{ }\PY{o}{=}\PY{+w}{ }\PY{l+m+mf}{0}\PY{p}{;} \PY{+w}{ }\PY{k+kd}{function}\PY{+w}{ }\PY{n+nx}{resizeCanvas}\PY{p}{(}\PY{p}{)}\PY{+w}{ }\PY{p}{\PYZob{}} \PY{+w}{ }\PY{n+nx}{canvas}\PY{p}{.}\PY{n+nx}{width}\PY{+w}{ }\PY{o}{=}\PY{+w}{ }\PY{n+nx}{pad}\PY{p}{.}\PY{n+nx}{clientWidth}\PY{p}{;}\PY{+w}{ }\PY{n+nx}{canvas}\PY{p}{.}\PY{n+nx}{height}\PY{+w}{ }\PY{o}{=}\PY{+w}{ }\PY{n+nx}{pad}\PY{p}{.}\PY{n+nx}{clientHeight}\PY{p}{;} \PY{+w}{ }\PY{p}{\PYZcb{}} \PY{+w}{ }\PY{n+nb}{window}\PY{p}{.}\PY{n+nx}{addEventListener}\PY{p}{(}\PY{l+s+s1}{\PYZsq{}resize\PYZsq{}}\PY{p}{,}\PY{+w}{ }\PY{n+nx}{resizeCanvas}\PY{p}{)}\PY{p}{;} \PY{+w}{ }\PY{n+nx}{resizeCanvas}\PY{p}{(}\PY{p}{)}\PY{p}{;} \PY{+w}{ }\PY{k+kd}{function}\PY{+w}{ }\PY{n+nx}{handleInputStart}\PY{p}{(}\PY{n+nx}{e}\PY{p}{)}\PY{+w}{ }\PY{p}{\PYZob{}} \PY{+w}{ }\PY{n+nx}{isTouching}\PY{+w}{ }\PY{o}{=}\PY{+w}{ }\PY{k+kc}{true}\PY{p}{;} \PY{+w}{ }\PY{n+nx}{startSynth}\PY{p}{(}\PY{p}{)}\PY{p}{;} \PY{+w}{ }\PY{n+nx}{handleInputMove}\PY{p}{(}\PY{n+nx}{e}\PY{p}{)}\PY{p}{;} \PY{+w}{ }\PY{p}{\PYZcb{}} \PY{+w}{ }\PY{k+kd}{function}\PY{+w}{ }\PY{n+nx}{handleInputEnd}\PY{p}{(}\PY{p}{)}\PY{+w}{ }\PY{p}{\PYZob{}} \PY{+w}{ }\PY{n+nx}{isTouching}\PY{+w}{ }\PY{o}{=}\PY{+w}{ }\PY{k+kc}{false}\PY{p}{;} \PY{+w}{ }\PY{n+nx}{stopSynth}\PY{p}{(}\PY{p}{)}\PY{p}{;} \PY{+w}{ }\PY{p}{\PYZcb{}} \PY{+w}{ }\PY{k+kd}{function}\PY{+w}{ }\PY{n+nx}{handleInputMove}\PY{p}{(}\PY{n+nx}{e}\PY{p}{)}\PY{+w}{ }\PY{p}{\PYZob{}} \PY{+w}{ }\PY{k}{if}\PY{+w}{ }\PY{p}{(}\PY{o}{!}\PY{n+nx}{isTouching}\PY{p}{)}\PY{+w}{ }\PY{k}{return}\PY{p}{;} \PY{+w}{ }\PY{k+kd}{const}\PY{+w}{ }\PY{n+nx}{rect}\PY{+w}{ }\PY{o}{=}\PY{+w}{ }\PY{n+nx}{pad}\PY{p}{.}\PY{n+nx}{getBoundingClient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{;} \PY{+w}{ }\PY{n+nx}{touchY}\PY{+w}{ }\PY{o}{=}\PY{+w}{ }\PY{n+nb}{Math}\PY{p}{.}\PY{n+nx}{max}\PY{p}{(}\PY{l+m+mf}{0}\PY{p}{,}\PY{+w}{ }\PY{n+nb}{Math}\PY{p}{.}\PY{n+nx}{min}\PY{p}{(}\PY{l+m+mf}{1}\PY{p}{,}\PY{+w}{ }\PY{l+m+mf}{1}\PY{+w}{ }\PY{o}{\PYZhy{}}\PY{+w}{ }\PY{p}{(}\PY{n+nx}{clientY}\PY{+w}{ }\PY{o}{\PYZhy{}}\PY{+w}{ }\PY{n+nx}{rect}\PY{p}{.}\PY{n+nx}{top}\PY{p}{)}\PY{+w}{ }\PY{o}{/}\PY{+w}{ }\PY{n+nx}{rect}\PY{p}{.}\PY{n+nx}{height}\PY{p}{)}\PY{p}{)}\PY{p}{;} \PY{+w}{ }\PY{n+nx}{updateSynth}\PY{p}{(}\PY{n+nx}{touchX}\PY{p}{,}\PY{+w}{ }\PY{n+nx}{touchY}\PY{p}{)}\PY{p}{;} \PY{+w}{ }\PY{p}{\PYZcb{}} \PY{+w}{ }\PY{n+nx}{pad}\PY{p}{.}\PY{n+nx}{addEventListener}\PY{p}{(}\PY{l+s+s1}{\PYZsq{}mousedown\PYZsq{}}\PY{p}{,}\PY{+w}{ }\PY{n+nx}{handleInputStart}\PY{p}{)}\PY{p}{;} \PY{+w}{ }\PY{n+nb}{window}\PY{p}{.}\PY{n+nx}{addEventListener}\PY{p}{(}\PY{l+s+s1}{\PYZsq{}mouseup\PYZsq{}}\PY{p}{,}\PY{+w}{ }\PY{n+nx}{handleInputEnd}\PY{p}{)}\PY{p}{;} \PY{+w}{ }\PY{n+nx}{pad}\PY{p}{.}\PY{n+nx}{addEventListener}\PY{p}{(}\PY{l+s+s1}{\PYZsq{}mousemove\PYZsq{}}\PY{p}{,}\PY{+w}{ }\PY{n+nx}{handleInputMove}\PY{p}{)}\PY{p}{;} \PY{+w}{ }\PY{n+nx}{pad}\PY{p}{.}\PY{n+nx}{addEventListener}\PY{p}{(}\PY{l+s+s1}{\PYZsq{}touchstart\PYZsq{}}\PY{p}{,}\PY{+w}{ }\PY{n+nx}{handleInputStart}\PY{p}{,}\PY{+w}{ }\PY{p}{\PYZob{}}\PY{+w}{ }\PY{n+nx}{passive}\PY{o}{:}\PY{+w}{ }\PY{k+kc}{true}\PY{+w}{ }\PY{p}{\PYZcb{}}\PY{p}{)}\PY{p}{;} \PY{+w}{ }\PY{n+nb}{window}\PY{p}{.}\PY{n+nx}{addEventListener}\PY{p}{(}\PY{l+s+s1}{\PYZsq{}touchend\PYZsq{}}\PY{p}{,}\PY{+w}{ }\PY{n+nx}{handleInputEnd}\PY{p}{)}\PY{p}{;} \PY{+w}{ }\PY{n+nx}{pad}\PY{p}{.}\PY{n+nx}{addEventListener}\PY{p}{(}\PY{l+s+s1}{\PYZsq{}touchmove\PYZsq{}}\PY{p}{,}\PY{+w}{ }\PY{n+nx}{handleInputMove}\PY{p}{,}\PY{+w}{ }\PY{p}{\PYZob{}}\PY{+w}{ }\PY{n+nx}{passive}\PY{o}{:}\PY{+w}{ }\PY{k+kc}{true}\PY{+w}{ }\PY{p}{\PYZcb{}}\PY{p}{)}\PY{p}{;} \PY{+w}{ }\PY{c+c1}{// Canvas Visualization Loop} \PY{+w}{ }\PY{k+kd}{function}\PY{+w}{ }\PY{n+nx}{renderVisualizer}\PY{p}{(}\PY{p}{)}\PY{+w}{ }\PY{p}{\PYZob{}} \PY{+w}{ }\PY{n+nx}{requestAnimationFrame}\PY{p}{(}\PY{n+nx}{renderVisualizer}\PY{p}{)}\PY{p}{;} \PY{+w}{ }\PY{n+nx}{ctx}\PY{p}{.}\PY{n+nx}{fillStyle}\PY{+w}{ }\PY{o}{=}\PY{+w}{ }\PY{l+s+s1}{\PYZsq{}rgba(5, 5, 5, 0.25)\PYZsq{}}\PY{p}{;} \PY{+w}{ }\PY{n+nx}{ctx}\PY{p}{.}\PY{n+nx}{fillRect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}{*}\PY{+w}{ }\PY{l+m+mf}{2}\PY{p}{)}\PY{p}{;} \PY{+w}{ }\PY{n+nx}{ctx}\PY{p}{.}\PY{n+nx}{fill}\PY{p}{(}\PY{p}{)}\PY{p}{;} \PY{+w}{ }\PY{n+nx}{ctx}\PY{p}{.}\PY{n+nx}{shadowBlur}\PY{+w}{ }\PY{o}{=}\PY{+w}{ }\PY{l+m+mf}{0}\PY{p}{;} \PY{+w}{ }\PY{p}{\PYZcb{}} \PY{+w}{ }\PY{p}{\PYZcb{}} \PY{+w}{ }\PY{n+nx}{renderVisualizer}\PY{p}{(}\PY{p}{)}\PY{p}{;} \PY{+w}{ }\PY{c+c1}{// UI Display Listeners} \PY{+w}{ }\PY{n+nb}{document}\PY{p}{.}\PY{n+nx}{getElementById}\PY{p}{(}\PY{l+s+s1}{\PYZsq{}scale\PYZsq{}}\PY{p}{)}\PY{p}{.}\PY{n+nx}{addEventListener}\PY{p}{(}\PY{l+s+s1}{\PYZsq{}change\PYZsq{}}\PY{p}{,}\PY{+w}{ }\PY{p}{(}\PY{n+nx}{e}\PY{p}{)}\PY{+w}{ }\PY{p}{=\PYZgt{}}\PY{+w}{ }\PY{p}{\PYZob{}} \PY{+w}{ }\PY{n+nb}{document}\PY{p}{.}\PY{n+nx}{getElementById}\PY{p}{(}\PY{l+s+s1}{\PYZsq{}disp\PYZhy{}scale\PYZsq{}}\PY{p}{)}\PY{p}{.}\PY{n+nx}{innerText}\PY{+w}{ }\PY{o}{=}\PY{+w}{ }\PY{l+s+sb}{`}\PY{l+s+sb}{SKALA: }\PY{l+s+si}{\PYZdl{}\PYZob{}}\PY{n+nx}{e}\PY{p}{.}\PY{n+nx}{target}\PY{p}{.}\PY{n+nx}{options}\PY{p}{[}\PY{n+nx}{e}\PY{p}{.}\PY{n+nx}{target}\PY{p}{.}\PY{n+nx}{selectedIndex}\PY{p}{]}\PY{p}{.}\PY{n+nx}{text}\PY{p}{.}\PY{n+nx}{toUpperCase}\PY{p}{(}\PY{p}{)}\PY{l+s+si}{\PYZcb{}}\PY{l+s+sb}{`}\PY{p}{;} \PY{+w}{ }\PY{p}{\PYZcb{}}\PY{p}{)}\PY{p}{;} \PY{+w}{ }\PY{n+nb}{document}\PY{p}{.}\PY{n+nx}{getElementById}\PY{p}{(}\PY{l+s+s1}{\PYZsq{}preset\PYZsq{}}\PY{p}{)}\PY{p}{.}\PY{n+nx}{addEventListener}\PY{p}{(}\PY{l+s+s1}{\PYZsq{}change\PYZsq{}}\PY{p}{,}\PY{+w}{ }\PY{p}{(}\PY{n+nx}{e}\PY{p}{)}\PY{+w}{ }\PY{p}{=\PYZgt{}}\PY{+w}{ }\PY{p}{\PYZob{}} \PY{+w}{ }\PY{n+nb}{document}\PY{p}{.}\PY{n+nx}{getElementById}\PY{p}{(}\PY{l+s+s1}{\PYZsq{}disp\PYZhy{}preset\PYZsq{}}\PY{p}{)}\PY{p}{.}\PY{n+nx}{innerText}\PY{+w}{ }\PY{o}{=}\PY{+w}{ }\PY{l+s+sb}{`}\PY{l+s+sb}{SYNTH: }\PY{l+s+si}{\PYZdl{}\PYZob{}}\PY{n+nx}{e}\PY{p}{.}\PY{n+nx}{target}\PY{p}{.}\PY{n+nx}{options}\PY{p}{[}\PY{n+nx}{e}\PY{p}{.}\PY{n+nx}{target}\PY{p}{.}\PY{n+nx}{selectedIndex}\PY{p}{]}\PY{p}{.}\PY{n+nx}{text}\PY{p}{.}\PY{n+nx}{toUpperCase}\PY{p}{(}\PY{p}{)}\PY{l+s+si}{\PYZcb{}}\PY{l+s+sb}{`}\PY{p}{;} \PY{+w}{ }\PY{k}{if}\PY{+w}{ }\PY{p}{(}\PY{n+nx}{mainOsc}\PY{p}{)}\PY{+w}{ }\PY{p}{\PYZob{}}\PY{+w}{ }\PY{n+nx}{stopSynth}\PY{p}{(}\PY{p}{)}\PY{p}{;}\PY{+w}{ }\PY{n+nx}{startSynth}\PY{p}{(}\PY{p}{)}\PY{p}{;}\PY{+w}{ }\PY{p}{\PYZcb{}} \PY{+w}{ }\PY{p}{\PYZcb{}}\PY{p}{)}\PY{p}{;} \PY{+w}{ }\PY{n+nb}{document}\PY{p}{.}\PY{n+nx}{getElementById}\PY{p}{(}\PY{l+s+s1}{\PYZsq{}beat\PYZhy{}pattern\PYZsq{}}\PY{p}{)}\PY{p}{.}\PY{n+nx}{addEventListener}\PY{p}{(}\PY{l+s+s1}{\PYZsq{}change\PYZsq{}}\PY{p}{,}\PY{+w}{ }\PY{p}{(}\PY{n+nx}{e}\PY{p}{)}\PY{+w}{ }\PY{p}{=\PYZgt{}}\PY{+w}{ }\PY{p}{\PYZob{}} \PY{+w}{ }\PY{n+nb}{document}\PY{p}{.}\PY{n+nx}{getElementById}\PY{p}{(}\PY{l+s+s1}{\PYZsq{}disp\PYZhy{}pattern\PYZsq{}}\PY{p}{)}\PY{p}{.}\PY{n+nx}{innerText}\PY{+w}{ }\PY{o}{=}\PY{+w}{ }\PY{l+s+sb}{`}\PY{l+s+sb}{BEAT: }\PY{l+s+si}{\PYZdl{}\PYZob{}}\PY{n+nx}{e}\PY{p}{.}\PY{n+nx}{target}\PY{p}{.}\PY{n+nx}{options}\PY{p}{[}\PY{n+nx}{e}\PY{p}{.}\PY{n+nx}{target}\PY{p}{.}\PY{n+nx}{selectedIndex}\PY{p}{]}\PY{p}{.}\PY{n+nx}{text}\PY{p}{.}\PY{n+nx}{toUpperCase}\PY{p}{(}\PY{p}{)}\PY{l+s+si}{\PYZcb{}}\PY{l+s+sb}{`}\PY{p}{;} \PY{+w}{ }\PY{p}{\PYZcb{}}\PY{p}{)}\PY{p}{;} \PY{+w}{ }\PY{n+nb}{document}\PY{p}{.}\PY{n+nx}{getElementById}\PY{p}{(}\PY{l+s+s1}{\PYZsq{}bpm\PYZsq{}}\PY{p}{)}\PY{p}{.}\PY{n+nx}{addEventListener}\PY{p}{(}\PY{l+s+s1}{\PYZsq{}change\PYZsq{}}\PY{p}{,}\PY{+w}{ }\PY{p}{(}\PY{n+nx}{e}\PY{p}{)}\PY{+w}{ }\PY{p}{=\PYZgt{}}\PY{+w}{ }\PY{p}{\PYZob{}} \PY{+w}{ }\PY{n+nb}{document}\PY{p}{.}\PY{n+nx}{getElementById}\PY{p}{(}\PY{l+s+s1}{\PYZsq{}disp\PYZhy{}bpm\PYZsq{}}\PY{p}{)}\PY{p}{.}\PY{n+nx}{innerText}\PY{+w}{ }\PY{o}{=}\PY{+w}{ }\PY{l+s+sb}{`}\PY{l+s+si}{\PYZdl{}\PYZob{}}\PY{n+nx}{e}\PY{p}{.}\PY{n+nx}{target}\PY{p}{.}\PY{n+nx}{value}\PY{l+s+si}{\PYZcb{}}\PY{l+s+sb}{ BPM}\PY{l+s+sb}{`}\PY{p}{;} \PY{+w}{ }\PY{p}{\PYZcb{}}\PY{p}{)}\PY{p}{;} \PY{p}{\PYZlt{}}\PY{p}{/}\PY{n+nt}{script}\PY{p}{\PYZgt{}} \PY{p}{\PYZlt{}}\PY{p}{/}\PY{n+nt}{body}\PY{p}{\PYZgt{}} \PY{p}{\PYZlt{}}\PY{p}{/}\PY{n+nt}{html}\PY{p}{\PYZgt{}} \end{Verbatim}