app_timer_event() clock question
Horstmaista opened this issue · 1 comments
hey!
simple version: how often per millisecond is the app_timer_event called?
complex version: i'm trying to get a midi clock and also sequencer notes sent from the launchpad. based on the example code 20 event calls equal a midi clock for 125 bpm.
calculating backwards the calculation should be 2500/bpm. correct? so if i'm playing at 100 bpm i need to send out MIDITIMINGCLOCK message every 25 calls. right?
just getting into this, so forgive me if its a trivial question and thanks (a lot!) for releasing the firmware as open source!
thanks!
daniel
Yup, it's 1ms per app_timer_event() call, and your formula is correct!
Note that if you do this calculation with int's, you often won't get the exact answer (you'll get it rounded to the nearest millisecond). Properly handling arbitrary tempos is complex. Rearranging the above formula and using only the tempos that correspond to integer pulse intervals would be the easy way to get started ;)
Happy hacking!