A sonata was a type of musical composition.
In 2370, Varani played a sonata at Quark's that Kira Nerys enjoyed very much. (DS9: "Sanctuary")
In 2372, while playing the holoprogram Janeway Lambda one, "Lucille Davenport" recalled hearing Beatrice Burleigh play a Mozart sonata while in the music room. (VOY: "Persistence of Vision")