Mozart composed his sonatas for violin and piano in spurts. There are the dozen-plus that he wrote during the 1760s when not yet even a teenager, the six Mannheim sonatas of 1778, the six sonatas of 1781, and finally the four glorious late works put to paper during the mid- and late 1780s. The Sonata for violin and piano No. 26 in B flat major, K. 317d (formerly K. 378), comes from the 1781 set, though it seems that the piece might actually have been composed two years earlier (in 1779) than its five companion pieces. Mozart moved to Vienna in March 1781; these six violin sonatas, minus perhaps the present work (which, if it does date from 1779, counts among the Salzburg works), were composed over the course of his first months as a resident of the bustling Austrian metropolis, and they were the first music of his to be published in the city (as Op. 2).
The sonata is of the three-movement variety standard before Beethoven made a habit of including a minuet/scherzo in the chamber music sequence of events. The movements are Allegro moderato, Andante sostenuto e cantabile, and Allegro (rondo). The first movement is of a breadth and melodic suppleness unknown to the violin sonata before Mozart made it his own; the transition passages burst forth with thematic life of their own, the sweet-tasting opening melody and the sprightly, punctuated parallel thirds of the second theme (in F major, naturally) being laced together by upwards of a half dozen unique little motives. The suave rhythmic overlay of the E flat major Andantino (triplets against dotted figures) offers just a hint of the "Elvira Madigan" Piano Concerto, still half a decade in the future, especially considering the upward-reaching nature of the dotted figures. The refrain theme of the rondo finale spins gently downward upon gossamer ornaments. The first episode is in G minor. The second, which appears after a truncated rendition of the refrain, is a wonderful interruption of meter and rhythm: 3/8 is replaced by a 4/4 meter filled with running eighth-note triplets. This new idea is so fun and so arresting that a complete break is necessary to remind the two players that they must return once more to the carefree refrain theme if they are in fact to finish the movement!