Veja esse projeto da Processing Foundation.
https://processing.org/reference/libraries/sound/index.html
https://github.com/processing/processing-sound
https://editor.p5js.org/HelenaCui/sketches/O1wf7kNhj
Nesta playlist, Daniel Shiffman introduz a biblioteca p5.js sound com vários exemplos em Javascript.
https://www.youtube.com/playlist?list=PLRqwX-V7Uu6aFcVjlDAkkGIixw70s7jpW