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.
So, "how can that thing play samples anyway"? Here's 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 - with pulse width modulation.
The speaker can be connected to the PC Programable Interval Timer (PIT) 2. The PIT is able to turn the speaker on and off at a given frequency, which normally makes you hear the "beep" frequency you are used to. To play back a sample, you change the speed of PIT 2 of the speaker to represent a pulse width that your current sample needs - and this thousands of times a second, depending on your playback frequency.
However, a problem was the often very low playback volume. Another interfering factor can be the whistle of the loudspeaker of the high modulation frequency, depending on how the speaker is being accessed. Also the sample resolution is limited by the actual PIT frequency and the playback frequency. The higher the playback frequency, the lower the resolution gets. For example, you can achieve 6 bits resolution at about 18600 Hz.
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 and laptops had installed a piezo-beeper, which didn't have the inertia of the PC speaker. Hence, the pulse width modulation doesn't work with it, and you either heard whistling or very distorted sounds.