Audio clock & trigger best practices

Hello! MCUs and C++ noob here, so feel free to insult me/point me at the right learning resources if this doesn’t make sense :slight_smile:
After some tinkering with Arduino, I’m now experimenting to build my own STM32-based module, a kind of swiss knife modulation generator, so I’m in the need of a more precise clock mechanism.

I was wondering, what is the best approach to syncing to an external clock (non midi) signal? Right now I’m using interrupts on a digital pin on my MCU, calculating the ms between pulses and deriving my time interval from there, but I’m pretty sure that’s not best way of getting a stable clock (the results I’m getting are always off).

I’ve looked around at what others are doing, but because of my lack of experience with C++, I can’t really figure out how modules like MI Grids or O_c are getting and using a clock signal.
I’ve seen that my board (STM32F303K8 Nucleo) has several timers and some of these have an external clock option. Is that what I should be looking at?

2 Likes