What's the noun for "off-key" or "out of tune"?
Solution 1:
Because of culture, not every word translates exactly with the same connotations. So there are some options.
dissonance or discord
is for two notes that sound wrong (discord also means strife).
incongruity
is for two general things that just don't go well together (incongruous is the adjective)
To be 'off-key' means to be out--of-step or altogether off. There doesn't seem to be a noun for this.
Solution 2:
A word that can be used for both for a visual and auditory reaction is discordance:
"I transported my friend to the airport" sounds off-key, if we swap the verb, transport, with took the discordancy no longer occurs.
That purple waistcoat (AmEng vest) is an unbearable discordance
discordant 1. being at variance; disagreeing; incongruous: discordant opinions. 2. disagreeable to the ear; dissonant; harsh.
Solution 3:
I think that inconsistency may suggest the idea you are looking for:
Lack of agreement or harmony between parts of something complex; compatibility
Examples:
Police noticed inconsistency in his two statements.
Customers have been complaining about the inconsistency in the quality of service they have received.
There is some inconsistency in her argument.
Careful editing of the entire text has eliminated inconsistencies of style. We noted a major inconsistency in his story.
Solution 4:
Metaphorically, when things are not in harmony, they clash. Something that clashes can be called a mismatch.
I have generally seen the adjective to be more common that the noun. Several synonyms for clash can be found in a thesaurus.
Often, the disharmony that your example (B) might refer to can be described as an offense or an eyesore, veering off in an only slightly different direction with respect to being unharmonious in the musical sense, but still fitting with clash.
When it comes to metaphors in English (as with most languages) you won't always find that the metaphors translate directly. In this case, they translate more directly as adjectives, though. Once you have the right word, you can go directly to thesaurus, and many of the words will be suitable substitutes. Without the right word, your thesaurus might not be so valuable.
Update In your example (A), you could substitute roughness or inelegance, or synonyms of these. In this example, using a strictly aural or visual metaphor is not common. At least nothing comes to my mind as quickly as these words do.