I'm looking for the Star Trek: TNG episode (or rather the scene) where Mr. Data practices playing a musical instrument, possibly the violin. He complains about being unable to get the performance perfectly correct, while the errors are of course unnoticeable for a human.
It doesn't quite match your comment about him saying there are imperfections, but might you be thinking of "Inheritance"?
(Data plays violin for her. Juliana applauds)
DATA: Thank you. I will be playing this piece at a recital tomorrow evening.
JULIANA: That was beautiful.
DATA: I have been told that my playing is technically flawless, but no one has described it as beautiful.
JULIANA: It was, really.
DATA: Are you certain you are not saying this because you are my mother? I have noticed that parents tend to exaggerate when it comes to their children's accomplishments.
JULIANA: I suppose there's a certain amount of vanity involved, considering that giving you a creative aspect was my idea. Your father didn't really see the point. He thought that since you didn't have emotions, there would be no real need for you to express yourself. Somehow I had the feeling the opposite would be true.
I found the scene I recalled. It is not Data who fails to perform. It is Jenna D'Sora, in the Episode "In Theory" and Data analysing her playing.
DATA: Is anything wrong?
JENNA: My tempo was way off. I felt like I was rushing through the whole piece.
DATA: I do not believe that is so. Your rhythmic control has improved markedly. I heard no fluctuations during the performance.
JENNA: Well, maybe, but I ruined the coda. I got confused with the phrasing again. I kept breathing at the wrong times.
DATA: The contrapuntal nature of the composition is most demanding. We will give more attention to the rhythmic patterns at our next rehearsal. However, I am quite certain the audience was oblivious to such nuances. They seemed to enjoy the performance thoroughly.
JENNA: Thank you, Data. You're very generous.
Actually then you are probably remembering Data commenting on the Android Juliana. From TNG "Inheritance"
RIKER: Only you could have noticed something like that.
DATA: Then there was the concert in Ten Forward.
RIKER: What about it?
DATA: We had practised the piece, and I noticed that she played it the same way during the performance. Every pitch, every intonation, was exactly the same. Only an artificial life form could have done that.
Possibly Star Trek:TNG "The Ensigns of Command"
Transcript from http://www.chakoteya.net/NextGen/149.htm
DATA: Captain. Doctor. I am honoured by your presence, but may I suggest you attend the second concert.
CRUSHER: Why, Data?
DATA: Ensign Ortiz will perform the violin part. My rendition will be less enjoyable.
DATA: Although I am technically proficient, according to my fellow performers, I lack soul.