Why snapshots
A signal source puts a smooth 1000 Hz wave on a wire: x(t) = sin(2π·1000·t) volts. It has a value at every instant, so even one millisecond holds infinitely many values. No computer can store them all.
Taking a snapshot
So we only look now and then. A clock ticks fs = 10,000 times a second: the sampling rate. The time between ticks is the sampling period, Ts = 1/fs = 0.1 ms. Each tick closes a switch for a moment.
At each tick the switch joins the wire to a small capacitor, which charges to the voltage at that instant. Then the switch opens and the capacitor holds that voltage steady. This is a sample and hold: a snapshot.
While the value is held, the converter (ADC) measures it and writes the number to memory. Snapshot n is taken at t = n·Ts, so x[n] = x(n·Ts). For example x[2] = x(0.2 ms) = 0.951 V.
The smooth wave has become a list of numbers: 0, 0.588, 0.951, 0.951, 0.588 ... volts. The whole number n counts the ticks. This list x[n] is the discrete-time signal, and it is what the computer keeps.
How often?
How many snapshots are enough? The wave repeats 1000 times a second and the clock ticks 10,000 times, so each cycle gets fs/f0 = 10 snapshots. Phone calls are sampled 8000 times a second; CDs, 44,100.
Between two ticks the sampler does not look. Halfway between x[0] and x[1] the wave is at x(0.05 ms) = 0.309 V, but that value is not in the list. Sampling keeps only the instants t = n·Ts.
Tick four times faster, fs = 40,000 a second, and each cycle gets 40 snapshots. The dots follow the wave closely, but there are four times as many numbers to store and send. More detail costs more data.
Tick too slowly, fs = 1500 a second, and each cycle gets only 1.5 snapshots. The dots now sit exactly on a slower 500 Hz wave. From the list alone, you cannot tell which wave made them.
Snapshots in code
In Python with numpy, np.arange(21) numbers the ticks 0 to 20, n/fs turns each into a time in seconds, and np.sin takes every snapshot in one line. The first five match the memory.
The working
# step 1/10 · smooth
x(t) = A·sin(2π·f0·t)
A = 1 V
f0 = 1000 Hz (1000 cycles a second)
one cycle = 1/1000 s = 1 ms
between t = 0 and t = 1 ms there are
infinitely many instants, each with a value
plot: x(t) in volts against t in ms
motion in the figure: slowed down a lot
The 1000 Hz tone at 1 V and the 10,000 per second clock are chosen examples; 8000 per second is the telephone rate (ITU-T G.711) and 44,100 per second the audio CD rate. Every number and curve in the figure is computed from this model. The motion is slowed down a great deal: the real clock ticks every 0.1 ms, and the real switch closes for a far shorter time than drawn.