Everything on this site runs in your web browser — nothing to install. Copy these lines into your HTML file. Load them in this order: p5.js first, then p5.sound, then ProControls.
<!-- Google icon font (optional — used by ProControls) -->
<link href="https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined&display=block" rel="stylesheet">
<!-- p5.js -->
<script src="https://cdn.jsdelivr.net/npm/p5@1.11.13/lib/p5.min.js"></script>
<!-- p5.sound (requires p5.js above) -->
<script src="https://cdn.jsdelivr.net/npm/p5@1.11.13/lib/addons/p5.sound.min.js"></script>
<!-- ProControls — needed for section 3 -->
<script src="https://cdn.jsdelivr.net/gh/dstein-art/proControls4p5js@v0.8.3/ProControls.js"></script>
<!-- Your sketch -->
<script src="sketch.js"></script>
This sketch plays one steady beep so you know sound is working.
In setup(), create a p5.Oscillator — that's a tone generator.
Use amp() to set how loud it is and freq() to set how high or low it sounds.
Then call osc.start() to play it.
Browsers won't play sound until you click something — it's a safety rule.
This example works in the p5.js Editor because you already clicked Play to run it.
In section 3, userStartAudio() turns sound on the first time you use the pad.
ProControls gives you an XYPad — a square you drag inside.
Left and right changes pitch (how high or low the note is).
Up and down changes volume (how loud it is).
Call proControlBackground() in draw() to draw the panel behind your controls.
When the pad moves (onChange), call userStartAudio() and update the oscillator.