Samuel anoints David as king over Israel in 1 Samuel 16:1-13. It is notable that this comes before David kills Goliath and before he first starts playing the lyre for Saul. In other words, David was already king over Israel before either of those other things happened.
The story of David playing the lyre for Saul comes at 1 Samuel 16:14-23. Now, it is very clear from this passage that Saul had never heard of David ever before.