Its function is to produce sounds.
The preposition to, in this case, shows the relationship between the instrument and the sounds it is producing.
It´s function is to produce sounds.