How to Count Beats and Rhythms