The Mishna Brura (551:16) says that it is assur to dance in the 3 weeks. This is the reason for the issur of listening to music. All the recent poskim (including Rav Moshe Feinstein and the Minchas Yitzchok) say that this includes listening to music even recorded from a tape or CD.
Rav Elyashiv, Rav Shlomo Zalman Auerbach, The Tzitz Eliezer (15:33) and others say that even acapella recordings, singing that doesn’t have musical instruments, are also forbidden.
A gathering of people are forbidden to sing if it is the kind of songs that will lead to dancing. Songs of praise to Hashem or in the spirit of the nine days are permitted.
Singing to yourself is permitted because it is just to lift your spirits and you don’t usually break out in dance. Nevertheless the Steipler Gaon did not let his children sing during the 3 weeks, only on Shabbos.
Music teachers can continue to give lessons in the 3 weeks if they need to for their livelihood. Rav Elyashiv paskens that although permissible until Rosh Chodesh Av, lessons should not be given in the 9 days. (see Pischei Tshuvos 493:4 and 551:13)