Working for CBS and later on his own in the 40s and 50s, sound engineer Charley Douglass perfected the laugh track technique, which was then called sweetening. His secret weapon was the laff box, a machine that you could use like a typewriter to produce the type and sequence of laughter you needed for a particular situation. Here's how the machine worked:
The one-of-a-kind device -- affectionately known in the industry as the "laff box" -- was tightly secured with padlocks, stood more than two feet tall, and operated like an organ. Only immediate members of the family knew what the inside actually looked like (at one time, the "laff box" was called "the most sought after but well-concealed box in the world"). Since more than one member of the Douglass family was involved in the editing process, it was natural for one member to react differently to a joke than another. Charley himself was the most conservative of all, so producers would put in bids for other editors who were more liberal in their choice of laughter. Douglass used a keyboard to select the style, gender and age of the laugh as well as a foot pedal to time the length of the reaction. Inside the machine was a wide array of recorded chuckles, yocks, and belly laughs; exactly 320 laughs on 32 tape loops, 10 to a loop. Each loop contained 10 individual audience laughs spliced end-to-end, whirling around simultaneously waiting to be cued up. Since the tapes were looped, laughs were played in the same order repeatedly. Sound engineers would watch sitcoms and knew exactly which recurrent guffaws were next, even if they were viewing an episode for the first time. Frequently, Douglass would combine different laughs, either long or short in length. Attentive viewers could spot when he decided to mix chuckles together to give the effect of a more diverse audience.
I found out about the laff box from Kevin Slavin & Kenyatta Cheese's talk about how, with the Internet, the audience now has an audience.