First of all, the post above about not owning the water is correct. As long as someone doesn't anchor so close to you that there's a danger of the boats swinging into you, they have as much right to be there as you do.
While I prefer that boats be further away from me than that, particularly in an uncrowded anchorage, it's their choice to anchor there just as it was my choice to anchor where I did.
That said, if you don't want other boats anchored near you, it's best to try to keep them away in the first place. Once they anchor, they are less likely to move.
Yes, you can play loud or obnoxious music but have it playing when you see them entering the anchorage, don't wait until they anchor to turn it on. That makes you a jerk.
Since I don't have external speakers or a supersized sound system and my own loud music would bother me as much as other boaters, what I do is parade around in my speedo. This usually keeps them away.
Better, perhaps would be walking around buck naked or peeing or taking a dump off the bow.
Keep in mind though, you're liable to meet up with these same folks at a marina in a day or two and what you do in the anchorage might be embarrassing.