Despereaux one day discovers the source of the wonderful sound he has been hearing and which he thinks sounds "like heaven." The sound comes from the princess's bedroom, where the princess's father plays guitar and sings to his daughter every night. Despereaux sneaks into a hole in the wall of the princess's bedroom so that he can better hear the music.
Despereaux likes the music so much that, without realizing it, he starts to crawl out of his hole, "all in an effort to get closer to the music." The music is so beautiful that it is almost as if he is hypnotized by it. Too late, Despereaux realizes that he has revealed himself to the princess and the king. The princess interrupts her father to point out the mouse. The king stops singing and looks where his daughter is pointing. Because Despereaux is so small, and because the king's own eyesight is so bad, he believes Despereaux to be "a bug, not a mouse."
While the king and his daughter are debating whether Despereaux is a mouse or a bug, Despereaux realizes that he has made "a very grave error." He has forgotten "the most basic and elemental of all mice rules," that rule being that you should not, "under any circumstances, reveal yourself to humans."
Although Despereaux makes "a grave error," he is not punished for it. He is tremendously lucky that the princess is so kind and takes pity on him. She asks her father to play music for Despereaux because he, Despereaux, looks "frightened" and "so afraid he's shaking." When the king plays again, Despereaux's fear leaves him, and he becomes once more transfixed by the music.