If she had chosen more observant friends, it would have worked. Instead, Hermione just gave him a smile. She could probably command him to sing in front of the two and they would disregard it. One thing Hermione could always count on Ron and Harry was being blind to literally everything around them.