A form of American music originating with Black African Americans and coming before Ragtime. It is supposed that the origin was that Southern Plantation slaves would parody the ballroom dances that their masters did and award a piece of cake for the best dance. It appears that this may have been condoned and encouraged by the masters who did the awarding in some cases.
Another theory is that it derived from a dance called the Chalk Line Walk which was itself derived from the Seminole Indians who performed a dance with similar moves but more solemnly.
Chances are that both are correct and they merged together. There is a suggestion that a Cakewalk was a regular Sunday event in some houses.
It is probable that it did not become the Cakewalk until minstrels started using it in their acts on stage. At this point the tunes would have been published and some specially composed (like Whistling Rufus or Coloured Aristocracy).