Beyond the qualities of the instructor, it is important to foster a sense of cohesion among the members of your class. Classes where members have a sense a cohesion have significantly greater adherence than classes with low group cohesion. One technique for building cohesion is making the group distinctive — having a group name, group t-shirt, neon sweat bands — these may sound trivial but research suggests that these simple strategies enhance adherence. An example of this research is by Spink and Carron in The Journal of Sport and Exercise Psychology, 1993, volume 15 (“The effects of team building on the adherence patterns of female exercise participants”). This is just one example of cohesion building strategies.
I currently teach 6 cycling classes per week, and although the music may be a factor, I am not sure that it is the critical element. There is a very wide range of music preferences expressed by participants and no one musical style will fit with all participants. I do think it is important as suggested above that the workout be planned, that the plan be communicated to the class, and that the plan be followed. It helps also to provide the reasoning behind why a particular workout is designed a certain way.
It has also been helpful for me to prepare a monthly schedule of my rides which give the workout type for each day (intervals, endurance, strength, etc.). I also do a monthly “race day” with a race profile ride and a first place medal for all the riders. It sounds hokey, I know, but people like it.
Just keep trying different things and find what works. Solicit feedback from your group members — what do they like particularly about your class, what gets in the way of attendance.