The last few posts neglect a crucial line from the episode. It's not a question of Spock recognizing Brahms' style; the line is this:
"Captain, it is written in manuscript - an original manuscript in Brahms' own hand, which I recognize."
Therefore the difficulty Spock surmounts is twofold: (i) He not only can read, he can sit at the keyboard and sight-read, handwritten music, which - no matter who wrote it - is likely to have a multitude of idiosyncrasies (see above) not found in a typeset score; and (ii) he knows for a fact that Brahms wrote it himself, that it's no forgery.
And here I want to argue that the cause and effect of Spock's realization must be seen in the proper order: Spock is first presented with the outright, literally
spelled-out claim that this work is by Brahms (even if the ink is still wet), and he then dives into an attempt into disproving the claim, as is the proper order of things in any scientific analysis. When he fails to point out telltales of forgery (other than the wet ink), he lets his amazement reach the form of a statement to his superior officer.
What this means is that Spock needs a tad less competence in the person and art of Brahms, for the price of a bit of intellectual dishonesty (or shorthand if you may). He recognizes the way Johannes Brahms signed his works (his hand!), finds nothing wrong with the notation itself (such as blatant anachronisms or a totally dissimilar hand), and can easily scan his memory for the short list of Brahms' waltzes for confirmation that this is not a generally known work.
Yet this as such is not amazing yet, not in the slightest. The amazement (and our false impression that there would be more to Spock's analysis than there is) comes from the fact that there
are counterindications (the wet ink, the circumstances), meaning Spock has uncovered something significant. Not a Brahms waltz which in itself is totally insignificant, but a potential forgery that has no place in the surroundings, a stain in the polished image of Flint, and perhaps a key to the mysteries of the person.
(An unrelated point: I can't find the image online, but Timo writes above that Brahms' name is on the score Spock plays. I can't imagine any circumstance under which I'd put my own name on something that has never left my piano. Flint is alone on the planet; why would he sign anything?)
I would argue exactly because he is Flint. And Brahms. And Leonardo.
How else could he keep his resume straight?
(In other words, Flint isn't entertaining himself by writing music for himself. He's entertaining himself
by being Brahms again, for a moment. Notation software wouldn't go with that, either.)
What I object to is the perceived story need for him to know that no one else could have written it. He is puzzled anyway ("definitely the work of Brahms... and yet, unknown!") and could have been equally puzzled if the score had merely looked like it was by Brahms and/or had been in what Spock identified as being in the distinctive style (a term not used in the episode) of Brahms.
Indeed. But Spock is confronted by a stronger impossibility here than a mere unknown piece of music. He's facing a forgery that shouldn't be a forgery but must be. This in an environment where his senses have been collecting subliminal cues of forgeries that shouldn't be forgeries.
Basically, Kirk here is doing the very same thing: he's being amazed by Rayna Kapec, or more exactly the relationship between her and her apparent mentor and warden. Again, that's a forgery that shouldn't be - Rayna is not real, and the relationship is not what it seems, even if everything about it
appears genuine.
So my objection is that Spock is given a gratuitous talent that doesn't serve the story. I would never have thought this through before, so thanks for the opportunity.
There are depths to this that go well beyond what was written, yes, and it's a fun thing to ruminate on. I delight in the way the three heroes exercise their exceptional talents independently of each other, pursuiting separate paths, while only Spock and McCoy seem to share their findings. In fact, Kirk shares, too, and his path is the one leading to solution and salvation, but till the very last moment it appears to be anything but...
Timo Saloniemi