It was in the year of 1981, as the PC in form of an IBM PC model 150 with a 8088 CPU saw the light of the world - a fact known by almost every computer enthusiast.
If something counted, then this: it had to be cheap! Other machines probably also didn't succeed as a result of their pretty high price tag. So then it even happened that the at that time better election, a Motorola-CPU, was discarded. It was simply too good for this product!
It was therefore a cut almost everywhere. The continuation of it namely found itself in many other parts of the PC, over which is partly sworn still today. So it was just about the same with the audio playback. As office machines don't have to be able to playback whole symphonies in every last detail, sound was restricted to the absolute minimum: the PC Speaker.
IBM PC Model 5150 - (c) www.old-computers.com
This utensil of the original IBM PC could exactly play a rectangle signal at a fixed volume and one sound channel, at least after all on different frequencies.
One would like to think that it would sound hideous to seriously play music through this thing, and admittedly, it mainly did. Only the human creativity often arises out of the pure limitation, and actually it was hardly different here.
While some games made use of quite simple tricks to get a better sound, for example playing in short frequency at different pitches, in order to simulate more channels, there were also other attempts, like with Lucasgames. To lend their songs some more pep, they tried to simulate drums (sample "Maniac Mansion").
However, the end of the flagpole was not yet reached. Meanwhile, clever programmers had found out how one could elicit real samples from the speaker! Admittedly not completely without expenditure, because this methodology necessitated a painstaking timing what made running a game in parallel very difficult on slow machines. Playback therefore was initially often restricted to the intros of the games.
A popular example, which existed alone to the demonstration of this technology, was "Magic Mushroom" - a small, ancient commercial, which was played through the PC-Speaker.
Inevitably each game supported the Speaker practically since a "real" sound card was still very expensive in these times.
To do justice about the question "how can that thing play samples anyway", here a small technical explanation:
The Speaker still is a piece of mechanics. This makes it inert, so only sounds limited to lower frequencies can pass. And exactly this is what is taken advantage from. Instead of feeding it with its usual frequency spectrum, an essentially higher frequency is being used, and switch it short in this frequency on or off, to get a resolution of 6 bits after all.
However, a problem was the often very low playback volume. Another interfering factor was the whistle of the loudspeaker of the high modulation frequency.
Both problems have been resolved later for example with dynamics compression (quiet sections louder), and also better programming, and so only one problem remained: many cheaper PC clones had installed a piezo-beeper, and this one could return higher frequencies, hence the modulation frequency, decidedly better - the inertia of the normal speaker was missing, and a useful playback was almost impossible.