 Melani was a favorite composer of Cardinal Giulio Rospigliosi (later Pope Clement IX).The Papal conclave of 1667 commissioned him to write an opera (title now unknown) for Carnival of 1668.His next opera, "L'empio punito" (commissioned by Marie Mancini), premiered at Carnival a year later and was notably the first opera on the subject of Don Juan.