A feature story at the end of this readme. Readthedocs also contains a nice collection of Jupyter notebook examples, including RTL-SDR streaming, among the module documentation. The actual notebook files (
.ipynb) are in the docs folder at nb_examples. This folder is in the master branch once you have cloned the repo. Click the docs badge above to be taken to the documentation.
The origin of this package comes from the writing the book Signals and Systems for Dummies, published by Wiley in 2013. The original module for this book is named
scikit-dsp-commthis module is renamed to
sigsys.pyto better reflect the fact that signal processing and communications theory is founded in signals and systems, a traditional subject in electrical engineering curricula.
Package High Level Overview¶
This package is a collection of functions and classes to support signal processing and communications theory teaching and research. The foundation for this package is
scipy.signal. The code in particular currently requires Python
The real-time audio DSP capabilities of
pyaudio_helper allow for two channel algorithm development with real-time user control enabled by the
ipywidgets when running in the Jupyter notebook.
Finally, we now can utilize the real-time DSP capabilities of
pyaudio_helper to work in combination with streaming of I/Q samples using new functions
rtlsdr_helper. This allows in particular demodulation of radio signals and downsampling to baseband analog signals for streaming playback of say an FM broadcast station. This new capability is featured as a short article at the end of this readme file.
There are presently ten modules that make up scikit-dsp-comm:
sigsys.pyfor basic signals and systems functions both continuous-time and discrete-time, including graphical display tools such as pole-zero plots, up-sampling and down-sampling.
digitalcomm.pyfor digital modulation theory components, including asynchronous resampling and variable time delay functions, both useful in advanced modem testing.
synchronization.pywhich contains phase-locked loop simulation functions and functions for carrier and phase synchronization of digital communications waveforms.
fec_conv.pyfor the generation rate one-half and one-third convolutional codes and soft decision Viterbi algorithm decoding, including soft and hard decisions, trellis and trellis-traceback display functions, and puncturing.
fir_design_helper.pywhich for easy design of lowpass, highpass, bandpass, and bandstop filters using the Kaiser window and equal-ripple designs, also includes a list plotting function for easily comparing magnitude, phase, and group delay frequency responses.
iir_design_helper.pywhich for easy design of lowpass, highpass, bandpass, and bandstop filters using scipy.signal Butterworth, Chebyshev I and II, and elliptical designs, including the use of the cascade of second-order sections (SOS) topology from scipy.signal, also includes a list plotting function for easily comparing of magnitude, phase, and group delay frequency responses.
multirate.pythat encapsulate digital filters into objects for filtering, interpolation by an integer factor, and decimation by an integer factor.
C/C++header files for FIR and IIR filters implemented in
C/C++, using the cascade of second-order section representation for the IIR case. This last module find use in real-time signal processing on embedded systems, but can be used for simulation models in
Presently the collection of modules contains about 125 functions and classes. The authors/maintainers are working to get more detailed documentation in place.
This package contains the helper modules
pyaudio_helper which require the packages pyrtlsdr and PyAudio. To use the full functionality of these helpers, install the package from the scikit-dsp-comm folder as follows:
pip install -e .[helpers]
Installation is described in greater detail below.
pyaudio_helper.pywraps a class around the code required in
PyAudio(wraps the C++ library
PortAudio) to set up a non-blocking audio input/output stream. The user only has to write the callback function to implement real-time DSP processing using any of the input/output devices available on the platform. This resulting object also contains a capture buffer for use in post processing and a timing markers for assessing the processing time utilized by the callback function. When developing apps in the Jupyter Notebook there is support for the
IPywidgetsalong with threading.
pyrtldsrto provide a simple captures means for complex baseband software defined radio (SDR) samples from the low-cost (~$20) RTL-SDR USB hardware dongle. The remaining functions in this module support the implementation of demodulators for FM modulation and examples of complete receivers for FM mono, FM stereo, and tools for FSK demodulation, including bit synchronization. Real-time streaming is a new capability included.
Documentation is now housed on
readthedocs which you can get to by clicking the docs badge near the top of this
README. Example notebooks can be viewed on GitHub pages. In time more notebook postings will be extracted from Dr. Wickert’s Info Center.
Getting Set-up on Your System¶
The best way to use this package is to clone this repository and then install it.
git clone https://github.com/mwickert/scikit-dsp-comm.git
There are package dependencies for some modules that you may want to avoid. Specifically these are whenever hardware interfacing is involved. Specific hardware and software configuration details are discussed in wiki pages.
For Windows users
pip install takes care of almost everything. I assume below you have Python on your path, so for example with Anaconda, I suggest letting the installer set these paths up for you.
Across the three popular platforms, Windows, macOS, and Linux,
the underlying framework that
pyaudio_helper relies upon. Getting
PyAudio configured is different for all three OS’s. Conda and CondaForge have support for installing
on both Linux and Windows. Under Python 3.6 and below PyAudio will install when
pip installing the scikit-dsp-comm package, as described below. For Python 3.7+
PyAudio first needs to be installed using
conda install pyaudio to obtain binary (
All the capability of the package is available less
PyAudio and the RTL-SDR radio, without doing any special installations. See the wiki pages for more information. Just keep in mind that now a Python 3.7+ install on windows must include the installation
PyAudio as described above.
Editable Install with Dependencies¶
With the terminal in the root directory of the cloned repo perform an editable
pip install using
pip install -e .[helpers]
Editable Install without Dependencies¶
To install without the PyAudio and RTL-SDR dependency, and hence not be able to use those modules,
pip install -e .
Why an Editable Install?¶
The advantage of the editable
pip install is that it is very easy to keep
scikit-dsp-comm up to date. If you know that updates have been pushed to the master branch, you simply go to your local repo folder and
git pull origin master
This will update you local repo and automatically update the Python install without the need to run
pip again. Note: If you have any Python kernels running, such as a Jupyter Notebook, you will need to restart the kernel to insure any module changes get reloaded.
Feature: Added Software Defined Radio Streaming to
rtlsdr_helper with Interface to
A recent push to the master branch now allows real-time SDR streaming from the RTL-SDR to
pyaudio_helper. In this first release of the API, the system block diagram takes the from shown in the figure below:
This capability is made possible via the new
await capabilities of Python 3.7. For the details as to how this works you have to dig into the details found in the module
rtlsdr_helper.py and the examples found in the notebook
rtlsdr_helper_streaming_sample.ipynb. A screenshot from the sample Jupyter notebook, that implements a broadcast FM receiver, is shown below:
This is just the beginning of making a complete SDR receiver possible in a Jupyter notebook. Not only is the receiver a reality, the algorithms that implement the receiver, in Python, can easily be coded by the user.
To help develop demodulator algorithms a streaming code block interface standard, of sorts, is being developed this summer. The idea is to provide examples of how to write a simple Python class that will manage states in the DSP code that is inside the Callback Process block of the block diagram. More details by the end of the summer is expected, along with another sample notebook.
- Jupyter Notebook Examples
- Introduction to Python and the Jupyter Notebook
- Rectangle and Triangle Pulses Defined
- Energy and Power Signals
- Fourier Series and Line Spectra Plotting
- Fourier Transforms
- Spectrum of PN Sequence (exact)
- Spectrum of PN Sequence (approx)
- Spectral Containment Bandwidth (text problem 2.55)
- Filter Analysis
- Filter Design Using the Helper Modules
- Design From Amplitude Response Requirements
- Linear Phase FIR Filter Design
- Traditional IIR Filter Design using the Bilinear Transform
- Multirate Signal Processing Using
- Real-Time Loop Through
- Widgets Examples
- RTLSDR Stream Class
- Probing in Time and Frequency
- Convolutional Coding
- Block Codes