← All questionsClaude Code makes a new AudioContext on every tap and my synth glitches. How do I make it refactor properly?
About Claude Code and JavaScript
Tilt Drone. Works on desktop, crackles on iPhone after a minute. I asked it to fix the crackle three times and it added try/catch.
Replies
Tell it the fix, not the symptom: 'one AudioContext, created on the first user gesture, kept in a module-level variable, resume() it if it's suspended'. It knows the pattern, it just doesn't reach for it unless you name it.
Sep 9Dmitri, Cyrus, Eli and others agree
And on iOS the context sometimes starts suspended even after the gesture. Call resume() in the touch handler, not on load.
Sep 10Fern and Alfie agree
FFern @fernSound designer · uses JavaScript and Claude Code That did it. It was also making a new oscillator on every tilt event, which I hadn't noticed. One context, one oscillator, no crackle.
Sep 10Alfie agrees
Sign in to reply.
Replies sit in the order people agree with them; the ones the asker marks “helped” lead. Names, never a number.