This demo shows how to create dynamic audio with the CPU and have it played back. It plays noise, a square wave, sin wave and saw tooth wave, all procedurally generated.
https://marketplace.yoyogames.com/assets/7257/simple-dynamic-audio-demo
Redistributed on the /r/GameMaker Discord community GitHub with permission