can one listen to music during 3 weeks while exercising?
It is permitted to listen to music for the purpose of exercise. One should not choose music that one particularly enjoys.
We find a number of leniencies concerning playing music when this is done for purposes other than enjoyment.
For instance, it is permitted for somebody whose livelihood depends on playing musical instruments to play music (to practice, or for non-Jews). As Rav Moshe Feinstein writes (Iggros Moshe, Orach Chaim Vol. 3, no. 87), it is permitted to study music, or to teach music, when one does so for reasons related to one’s livelihood, and not for pleasure (see also Seder Pesach Kehilchaso, Chap. 12, no. 16; Tzitz Eliezer Vol. 16, no. 19).
It is likewise permitted to play music for the purpose of calming a young child (who has not reached the age of chinuch), or for calming and soothing the sick (Shut Devar Shalom, Vol. 4, no. 80; Nitei Gavriel, Pesach Vol. 3, Chap. 53, no. 5, 7). It is likewise permitted to listen to music while driving, if the purpose of the music is to keep the driver alert to his environment (one should preferably play slow (classical or other) music, and not dance music).
Some of the sources above refer to the sefirah period, but the same rulings apply to the three weeks.
Therefore, when the music is not being played for enjoyment, but only for “keeping the beat,” there is no prohibition. However, one should ensure that the intention is not to enjoy the music, but to keep the beat, and one should not select one’s favorite pieces for the occasion.