Ongoing History Daily: The Rhythmicon
The first real attempt at creating a drum machine happened in 1931 when the inventor of the Theremin accepted a challenge to build a device that could reliably play back some complicated rhythms that could accompany a human musician.
The result was a device that looked rather like an organ called the Rhythmicon. Pressing any of the 16 keys provided a different beat. If you wanted to get really complicated, you could hold down to or more keys and have the machine play multiple rhythms at the same time.
A second prototype was commissioned which could do even more. There was even an orchestral score written for it. Unfortunately, critics thought the whole thing was stupid and the Rhythmicon died a quick death. It was, however, the first step towards a programmable drum machine.