and said to them, You are the heads of the fathers' [houses] of the Levites: sanctify yourselves, both you and your brothers, that you may bring up the ark of Yahweh, the God of Israel, to [the place] that I have prepared for it.
So David gave him the lyrics, and these guys started singing and worshipping the Lord with this song or psalm.