I’m now mourning for my father. Can I go to an environment such as an exercise class where there is music playing, since I’m not interested in hearing the music at all.
You may attend an exercise class.
The prohibition for an Avel is only to attend gatherings and listen to music which are intended for enjoyment and recreation. When it is for another purpose, such as for his livelihood, or in this case for exercise, it is clear his intention is not for the above, rather to keep in good health which is permitted for an Avel.
See Shulchan Aruch Y:D 391, Shu”t Maharam Shick Y:D 368, Shu”T Zkan Aharon 218 [who permits a musician to play for his livelihood during the 12 months of aveilus]