David recited his scripture and glorified Allah while the mountains joined him in praise and the birds rallied around him. Almighty Allah directed: Be patient (O Muhammad) of what they say, and remember Our slave David, endued with power. Verily, he was ever oft-returning in all matters and in repentance (toward Allah.) Surah 38: 17
David's sincerity was not the only factor responsible for the birds and beasts joining with him in glorifying Allah, nor was the sweetness of his voice. It was a miracle from Allah. This was not his only miracle, for Allah also endowed him with the faculty of understanding the languages of birds and animals.
Related Quran Ayaaths of this Hadith.
Surah 6 : Ayah 84 Surah 4 : Ayah 163 Surah 11 : Ayah 25 Surah 11 : Ayah 32 Surah 11 : Ayah 36 Surah 17 : Ayah 55 Surah 27 : Ayah 15 Surah 27 : Ayah 16"When a person dies, his works end, except for three: ongoing charity, knowledge that is benefited from, and a righteous child who prays for him."
Prophet Mohammed (PBUH)
"The best of what a man leaves behind are three: a righteous child who supplicates for him, ongoing charity the reward of which reaches him, and knowledge that is acted upon after him."
Sunan Ibn Mājah
"Every day two angels come down from Heaven and one of them says, 'O Allah! Compensate every person who spends in Your Cause,' and the other (angel) says, 'O Allah! Destroy every miser.'"
Sahih Bukhari