A capriccio or caprice (sometimes plural: caprices, capri or, in Italian, capricci), is a piece of music, usually fairly free in form and of a lively character. The typical capriccio is one that is fast, intense, and often virtuosic in nature.
The term has been applied to a variety of works: in the Baroque era it was often used for short keyboard pieces (for example, by Girolamo Frescobaldi, and J.S. Bach concluded his C minor keyboard Partita BWV 826 with a Capriccio which, despite its title, is a densely contrapuntal piece carefully and methodically exploiting its lively, almost humorous, subject). Niccolò Paganini used it for a set of twenty-four virtuoso solo violin works, Luigi Legnani used it for a set of thirty-six virtuoso solo guitar works, and Pyotr Ilyich Tchaikovsky and Nikolai Rimsky-Korsakov used it for orchestral works (the Capriccio Italien and Capriccio espagnol respectively). Johannes Brahms wrote many capricci for piano during the later years of his life, all of which are considered to be among the most unusual and thoughtful pieces of the late Romantic music era. Camille Saint-Saëns wrote an Introduction and Rondo Capriccioso for violin and orchestra, the solo violin part of which contains concerto-like virtuoso writing.