solfa 31
The origin is in the solfeo, a method of teaching music that takes the names of the notes sun and fa. From there we have a meaning for "something well done, with art and effort". But we also have another as a "joke, laughable situation", and while the origin is discussed, it seems to come also from the musicians, but the Middle Ages who sang about popular themes mocking kings and institutions. Thus we have a positive meaning from erudite music, ecclesiastical music and elevated art, and another negative from popular music sung by blind and minstrels.