Ravana became a devoted follower of Shiva. To honor the god he decided to make a musical instrument: a veena. Ravana cut off one of his heads and one of his arms and made them into a veena, and to string the veena he used his own guts.
Ravana then sang for Shiva as he played the veena made of his own body.
Impressed, Shiva appeared before Ravana. "Behold the indestructible Moon-sword, Chandrahasa," said Shiva, as he waved a sword that was crescent-shaped, like the moon. "I give it to you."
Ravana bowed in reverence, accepting the sword from Shiva.