Post by Jonathan Cauldwell on Apr 9, 2020 15:01:38 GMT
The only way to do this with a beeper would be to write the assembly routine so that it only plays sounds until the frame counter (stored at address 23672 on the Spectrum) changes. Then call the routine again in each subsequent frame, continuing from where it left off. However, there are two drawbacks. Firstly, your sound effect will sound a little more raspy and secondly I can't promise that it wouldn't interfere with the running of the game, depending on where the call is placed.
The beeper routines in the MPAGD and AGD engines only play sounds during spare CPU time at the end of each frame after all other processing has been completed. That is why the sound quality gets worse as more sprites and particles appear on screen