Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
71 changes: 71 additions & 0 deletions .github/workflows/install.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
#
# install.yml
#
# Copyright The PyModulation Contributors.
#
# This file is part of PyModulation.
#
# PyModulation is free software; you can redistribute it
# and/or modify it under the terms of the GNU General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# PyModulation is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public
# License along with PyModulation; if not, see <http://www.gnu.org/licenses/>.
#
#
#

name: Install test

on:
push:
branches: [dev]
pull_request:
branches: [main, dev]

# 'workflow_dispatch' allows manual execution of this workflow under the repository's 'Actions' tab
workflow_dispatch:

jobs:

install-test:
name: Installing test
runs-on: ubuntu-latest

strategy:
fail-fast: false
matrix:
python-version: ['3.12', '3.13']

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}

- name: Upgrade pip and build tools
run: |
python -m pip install --upgrade pip
pip install setuptools wheel build

- name: Build package (sdist and wheel)
run: |
python setup.py sdist bdist_wheel

- name: Check built distributions
run: |
pip install twine
twine check dist/*

- name: Install package
run: |
python setup.py install
35 changes: 19 additions & 16 deletions .github/workflows/sphinx-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,28 +20,31 @@
#
#

name: Documentation build
name: Documentation build test

on:
push:
branches: [dev, main]
branches: [dev]
pull_request:
branches: [dev, main]
branches: [main, dev]

jobs:
build:
# 'workflow_dispatch' allows manual execution of this workflow under the repository's 'Actions' tab
workflow_dispatch:

jobs:
build-doc:
name: Documentation building
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
# Standard drop-in approach that should work for most people.
- uses: ammaraskar/sphinx-action@master
with:
docs-folder: "docs/"
pre-build-command: "pip install --upgrade pip"
# Create an artifact of the html output.
- uses: actions/upload-artifact@v4
with:
name: documentation_html
path: docs/_build/html/
- name: Checkout
uses: actions/checkout@v4
- name: Build pages
uses: Kjuly/sphinx-builder@main
with:
source_root: "docs/"
- name: Create artifact
uses: actions/upload-artifact@v4
with:
name: Documentation HTML
path: docs/_build/html/
2 changes: 1 addition & 1 deletion .github/workflows/sphinx-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ jobs:
# Create an artifact of the html output
- uses: actions/upload-artifact@v4
with:
name: documentation_html
name: Documentation HTML
path: docs/_build/html/
# Publish built docs to gh-pages branch
- name: Commit documentation changes
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ jobs:
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.12'

- name: Install dependencies
run: sudo apt install -y python3-pytest
Expand Down
9 changes: 9 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@

===========================================

v0.1 - 2026/01/09

- First release
- GFSK/GMSK support

===========================================
===========================================

v0.0 - 2025/03/30
Expand Down
17 changes: 14 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
# PyModulation
<h1 align="center">
<a href="https://mgm8.github.io/pymodulation/"><img src="docs/img/logo.jpg" alt="PyModulation" width="50%"></a>
</h1>

<a href="https://pypi.org/project/pymodulation/">
<img src="https://img.shields.io/pypi/v/pymodulation?style=for-the-badge">
Expand All @@ -15,11 +17,20 @@

## Overview

> TODO
PyModulation is a Python library that implements a collection of digital modulation and demodulation techniques with a strong focus on Software-Defined Radio (SDR) applications. The library is designed to provide a simple, consistent, and extensible interface for working with different modulation schemes, enabling rapid development, testing, and prototyping of wireless communication systems.

The main objective of PyModulation is to allow the direct use of supported modulation techniques with SDR hardware, while remaining flexible enough to be used in simulations, offline signal processing, and educational contexts. By abstracting common modulation tasks, the library helps users focus on system design and experimentation rather than low-level signal handling.

PyModulation is suitable for a wide range of applications, including SDR-based transmitters and receivers, communication protocol prototyping, academic research, and teaching digital communications concepts. Its modular architecture makes it easy to extend with new modulation schemes and integrate with existing Python-based SDR and signal-processing toolchains.

The following modulations are currently supported:

* GFSK/GMSK

## Dependencies

* None
* NumPy
* SciPy

## Installing

Expand Down
12 changes: 7 additions & 5 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,26 +3,28 @@
# For the full list of built-in configuration values, see the documentation:
# https://www.sphinx-doc.org/en/master/usage/configuration.html

import sphinx_rtd_theme

# -- Project information -----------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#project-information

project = 'PyModulation'
copyright = 'Copyright The PyModulation Contributors'
author = 'Gabriel Mariano Marcelino'
release = 'v0.0.0'
release = 'v0.1'

# -- General configuration ---------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration

extensions = []
extensions = [
'sphinx_rtd_theme',
]

templates_path = ['_templates']
exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store']



# -- Options for HTML output -------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#options-for-html-output

html_theme = 'alabaster'
html_theme = 'sphinx_rtd_theme'
html_static_path = ['_static']
Binary file added docs/img/logo.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/img/logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
24 changes: 14 additions & 10 deletions docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,22 @@
You can adapt this file completely to your liking, but it should at least
contain the root `toctree` directive.

Welcome to PyModulation's documentation!
========================================
.. image:: img/logo.jpg
:width: 400

.. toctree::
:maxdepth: 2
:caption: Contents:
PyModulation is a Python library that implements a collection of digital modulation and demodulation techniques with a strong focus on Software-Defined Radio (SDR) applications. The library is designed to provide a simple, consistent, and extensible interface for working with different modulation schemes, enabling rapid development, testing, and prototyping of wireless communication systems.

The project is fully open source and is available in a `GitHub repository <https://github.com/mgm8/pymodulation>`_. All contributions are welcome! If you found a bug, developed a new feature, or want to improve the documentation, there are two ways to do so: open an issue describing the suggested modification, or by opening a pull request. More information are available in the `CONTRIBUTING file <https://github.com/mgm8/pymodulation/blob/main/CONTRIBUTING.md>`_.

Any questions or suggestions can also be addressed to Gabriel Mariano Marcelino <`gabriel.mm8@gmail.com <mailto:gabriel.mm8@gmail.com>`_>.

Contents
========

Indices and tables
==================
.. toctree::
:maxdepth: 2

* :ref:`genindex`
* :ref:`modindex`
* :ref:`search`
overview
modulations
usage
installation
23 changes: 23 additions & 0 deletions docs/installation.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
************
Installation
************

The simplest way to install the PyModulation library is doing it from the PyPI repository [1]_:

::

pip install pymodulation

It is also possible to install directly from source files available in the git repository [2]_:

::

python setup.py install

With the github releases, there is also some ready to install distribuition packages (*.rpm*, *.tar.gz*, etc.).

References
==========

.. [1] https://pypi.org/project/pymodulation/
.. [2] https://github.com/mgm8/pymodulation
17 changes: 17 additions & 0 deletions docs/modulations.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
***********
Modulations
***********

GFSK
====

Gaussian Frequency Shift Keying (GFSK) is a modulation technique derived from Frequency Shift Keying (FSK), where digital data is transmitted by shifting the carrier frequency between discrete values. Unlike traditional FSK, GFSK applies a Gaussian filter to the baseband pulses before modulation, which smooths the phase transitions and reduces spectral bandwidth. This filtering minimizes abrupt frequency changes, resulting in a more compact power spectrum and reduced interference with adjacent channels. GFSK is particularly advantageous in wireless communication systems where efficient bandwidth utilization and low power consumption are critical.

One of the most notable applications of GFSK is in Bluetooth technology, where it is used for its robustness and spectral efficiency. The Gaussian filtering helps mitigate intersymbol interference (ISI) and improves performance in noisy environments. Additionally, GFSK supports both coherent and non-coherent detection, offering flexibility in receiver design. Its constant envelope property ensures efficient power amplifier operation, making it suitable for battery-powered devices. Overall, GFSK strikes a balance between simplicity, spectral efficiency, and reliability, making it a popular choice for short-range wireless communication systems.

GMSK
====

Gaussian Minimum Shift Keying (GMSK) is a continuous-phase modulation scheme derived from Frequency Shift Keying (FSK), where the digital signal is filtered using a Gaussian filter before modulation. This filtering smooths the phase transitions, resulting in a nearly constant envelope and significantly reduced spectral sidelobes compared to traditional FSK. The key feature of GMSK is its ability to achieve high spectral efficiency while maintaining low out-of-band emissions, making it ideal for bandwidth-constrained wireless systems.

A notable application of GMSK is in the Global System for Mobile Communications (GSM), where it was chosen for its robustness against interference and efficient use of available spectrum. The modulation's constant envelope allows for the use of highly efficient nonlinear power amplifiers, reducing power consumption in mobile devices. Additionally, GMSK's resistance to multipath fading and phase noise enhances performance in challenging radio environments. Despite its slightly higher complexity in demodulation compared to simpler FSK schemes, GMSK remains a widely adopted modulation technique due to its excellent balance between spectral efficiency, power efficiency, and reliability in wireless communication systems.
9 changes: 9 additions & 0 deletions docs/overview.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
********
Overview
********

PyModulation is a Python library that implements a collection of digital modulation and demodulation techniques with a strong focus on Software-Defined Radio (SDR) applications. The library is designed to provide a simple, consistent, and extensible interface for working with different modulation schemes, enabling rapid development, testing, and prototyping of wireless communication systems.

The main objective of PyModulation is to allow the direct use of supported modulation techniques with SDR hardware, while remaining flexible enough to be used in simulations, offline signal processing, and educational contexts. By abstracting common modulation tasks, the library helps users focus on system design and experimentation rather than low-level signal handling.

PyModulation is suitable for a wide range of applications, including SDR-based transmitters and receivers, communication protocol prototyping, academic research, and teaching digital communications concepts. Its modular architecture makes it easy to extend with new modulation schemes and integrate with existing Python-based SDR and signal-processing toolchains.
2 changes: 2 additions & 0 deletions docs/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Sphinx
sphinx-rtd-theme
49 changes: 49 additions & 0 deletions docs/usage.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
*****
Usage
*****

This section presents examples of how to use the library for each supported modulation type.

GFSK
====

The GFSK modulation can be used through the *GFSK* class, using the modulate and demodulate methods. An example of usage can be seen in the code below:

.. code-block:: python

from pymodulation import GFSK

mod = GFSK(2.5, 0.5, 9600) # Modulation index = 2.5, BT = 0.5, Baudrate = 9600 bps

data = list(range(100))

samples, fs, dur = mod.modulate(data)

print("IQ Samples:", samples[:10])

bits, bb_sig = mod.demodulate(fs, samples)

print("Demodulated bits:", list(map(int, bits)))

The *modulate* method returns the IQ samples of the generated signal, the corresponding sampling rate, and the signal duration in seconds. The *demodulate* method allows the demodulation of a GFSK signal, taking the corresponding IQ samples and sampling rate as input, and producing as output the data bitstream contained in the signal and the baseband signal samples (in NRZ format).

GMSK
====

This modulation can be used in a manner almost identical to GFSK modulation, with the difference that in this case the modulation index is fixed at 0.5, as expected for this type of modulation. An example of usage can be seen in the code below.

.. code-block:: python

from pymodulation import GMSK

mod = GMSK(0.5, 9600) # BT = 0.5, baudrate = 9600 bps

data = list(range(100))

samples, fs, dur = mod.modulate(data)

print("IQ Samples:", samples[:10])

bits, bb_sig = mod.demodulate(fs, samples)

print("Demodulated bits:", list(map(int, bits)))
4 changes: 3 additions & 1 deletion pymodulation/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,7 @@
#
#

from pymodulation.pymodulation import PyModulation
from pymodulation.version import __version__

from pymodulation.gfsk import GFSK
from pymodulation.gmsk import GMSK
Loading
Loading