Windows Audio Jitter

I’m having a bit of a problem with an app I’ve built. It’s a musical rhythm sequencer, running on windows, and I’m finding that sometimes I get slowdown that distorts rhythms, and (less frequently) causes glitching on the audio.

The app is running at c 5% cpu, and when this issue occurs the overall system CPU is not that high.

Things that seem pertinent

  • I’m using quite simple FM audio synthesis to test this, via the Tonic library (tho 16 voices, so c 50% of the app’s CPU use)
  • the rhythm generation engine (c 2% of overall app CPU) runs in the audio thread, one update step per audio request at the start of the audio request callback.
  • The GUI/ graphical part of the system is isolated from the rhythm generation bit - it queues requests for action, and the rhythm generation bit actions all those requests at the start of its update step.
  • as a backup (earlier stage in dev, yet to remove) the rhythm generation engine is mutexing any resources it requires for its calculations - so even if I’ve missed something above, the graphics thread shouldn’t be holding up the audio thread.

Any thoughts, ideas I may have missed?

Also any tips on how to identify if requests from the graphics thread is somehow still holding up my audio thread?