He wrote 24 Preludes and Fugues for piano , a piano trio , two piano concertos , a piano quintet , a sonata for cello and piano and a sonata for viola and piano ( his last work ) . Music for chamber ensembles includes 15 string quartets , a piano quintet , two pieces for a string octet , and two piano trios . For the piano he composed two solo sonatas , an early set of preludes , and a later set of 24 preludes and fugues .