Transmission: 1 Analog Vs Digital Transmission
Transmission: 1 Analog Vs Digital Transmission
Now we can read in an audio file from disk; we can plot it and play it back. The
wavfile.read() function returns the audio data and the playback rate, which we will need
to pass to the playback functions.
1
1.1 The “Analog” and “Digital” Signals
We will now create two version of the audio signal, an “analog” version and a “digital” version.
Obviously the analog version is just a simulation, since we’re using a digital computer; we will
assume that, by using floating point values, we’re in fact close enough to infinite precision. In the
digital version of the signal, on the other hand, the audio samples will only take integer values
between -100 and +100 (i.e. we will use approximately 8 bits per audio sample).
In [3]: # the analog signal is simply rescaled between -100 and +100
# largest element in magnitude:
norm = 1.0 / max(np.absolute([min(s), max(s)]))
sA = 100.0 * s * norm
Remmeber that there is no free lunch and quantization implies a loss of quality; this initial loss
(that we can minimize by using more bits per sample) is the price to pay for digital transmission.
We can plot the error and compute the Signal to Noise Ratio (SNR) of the quantized signal
In [4]: plt.plot(sA-sD);
2
as expected, the error is between -0.5 and +0.5, since in the “analog” signal the values are
real-valued, whereas in the “digital” version they can only take integer values. As for the SNR,
SNR = 17.124344 dB
3
1.2 Transmission
Let’s now define a function that represents the net effect of transmitting audio over a cable seg-
ment terminated by a repeater: * the signal is attenuated * the signal is accumulates additive noise
as it propagates through the cable * the signal is amplified to the original amplitude by the repeater
we can use the repeater for both analog and digital signals. Transmission of the analog signal
is simply a sequence of repeaters:
For digital signals, however, we can rectify the signal after each repeater, because we know
that values should only be integer-valued:
In [11]: NUM_REPEATERS = 70
NOISE_AMPLITUDE = 0.2
ATTENUATION = 0.5
As you can see, the SNR after digital transmission has not changed! Now the difference be-
tween audio clips should be easy to hear:
4
In [12]: IPython.display.Audio(yA, rate=rate)
Note however that, if the noise amplitude exceeds a certain value, digital transmission de-
grades even less gracefully than analog transmission:
In [ ]: