In Jeremiah 10:2, the context of that passage involves the fact that the Israelites were enslaved by the Babylons because in Jeremiah 5, they were rebelling against God. God reveals this in verses 7-9
“Why should I pardon you?
Your sons have forsaken Me
And sworn by those who are not gods.
When I had fed them to the full,
They committed adultery
And trooped to the harlot’s house.
“They were well-fed lusty horses,
Each one neighing after his neighbor’s wife.
“Shall I not punish these people,” declares the Lord,
“And on a nation such as this
Shall I not avenge Myself?
(Jeremiah 5:7-9 NASB)
Later on, it is said that God would send Babylon to capture the Israelites and enslave them as punishment. But in Jeremiah 10, they are told by the Prophet Jeremiah the words and warnings of God if they seek to be reconciled. That is to not learn the religious ways of the pagan ways. The hebrew word is goy and in it's lexicon use and context, it is simply referring to the religious ways of the pagans. So he's not condeming the music since it is most likely the same music David and the other Psalmists played since this was afterwards. It is the lyrics, the religious activity and the false Gods that is mentioned as the ways of the heathen in the text.