In the previous notebook, we set up the audio environment, listened to the transmitted signal from the loudspeaker and visualized the recorded signal from the microphone. However, since soon hearing the signal all the time could be annoying we used a cable to shortcut the connection between audio output and audio input.
Another possibility is to replace the actual audio transmission with a simulation of the propagation channel. Moreover, in contrast to the real audio channel, the behaviour of a simulated channel is reproducible, hence it can help debugging your signal processing chain. Therefore, in this notebook, we perform the same experiment as before, but use a simulated channel object.
So, first let's import the standard python packages:
import matplotlib
import matplotlib.pyplot as plt
%matplotlib ipympl
%load_ext autoreload
%autoreload 2
import numpy as np
import sys
sys.path.append('..')
try:
%load_ext tikzmagic
except ModuleNotFoundError:
print ("Did not find tikzmagic. You will not be able to compile the tex code!")
Subsequently, import the classes needed for the experiment:
from audioComms import Environment, TX
from audioComms.plotting import PlotSpectrum, PlotWaveform
In addition, let's import the SimulatedChannel
and a custom channel effect:
from audioComms.channels import SimulatedChannel, IdentityChannelEffect
The channel effect describes the actual behaviour of the channel. For example, common soundcards have a frequency range of 20Hz-20kHz, so a reasonable channel effect is to apply a bandpass to the transmitted signal. However for simplicity, here we use an ideal channel, which does not change the transmitted signal at all.
Now, let's setup our transmitter again:
# Source code has been redacted in online version
# Omitting 12 lines of source code
Similar to the previous notebook, the data flow for the subsequent experiment looks as follows:
# Source code has been redacted in online version
# Omitting 11 lines of source code
Eventually, let's setup the experiment and run it:
# Source code has been redacted in online version
# Omitting 18 lines of source code
As seen, the simulated channel also simply forwards the signal, which is then plotted as a spectrum and waveform.
With this notebook, we have finished setting up our programming environment. Let's get hands on real data transmission in the following notebook, where we will transmit a pulse-shaped signal in baseband and show the resulting eye diagram.
Copyright (C) 2025 - dspillustrations.com