Skip to main content

Cross-correlation based digital mode reciever/simulator for amateur radios

Project description

Chirp Modem Simulator

A Python-based simulator for chirp modulation communication systems. This project implements a complete modem system using chirp signals for binary data transmission, including frame synchronization, payload handling, and error detection.

Features

  • Configurable chirp-based modulation
  • Frame synchronization using preamble and Start Frame Delimiter (SFD)
  • CRC32 error detection
  • Configurable noise simulation
  • Detailed signal visualization and analysis tools
  • Support for WAV file input/output
  • Multiple verbosity levels for debugging

Project Structure

chirp-64/
├── pyproject.toml    # Poetry configuration
├── src/
|   ├── chirp_64/      # Main package directory
|   │   ├── __init__.py
|   │   ├── __main__.py   # Entry point
|   │   ├── config.py     # Configuration parameters and validation
|   │   ├── signal_processor.py # Signal processing utilities
|   │   ├── modem.py      # Transmitter, Receiver, and Channel classes
|   │   └── plotter.py    # Visualization tools
├── tests/            # Test directory
│   └── __init__.py
└── README.md         # This file

Requirements

  • Python 3.8+
  • Poetry for dependency management

Installation

  1. Install Poetry if you haven't already:
curl -sSL https://install.python-poetry.org | python3 -
  1. Clone the repository:
git clone https://github.com/yourusername/chirp-64.git
cd chirp-64
  1. Install dependencies using Poetry:
poetry install

Usage

Basic Usage

With Poetry, run the module using:

Generate and transmit a new signal:

poetry run chirp-64 -o output.wav

Process an existing WAV file:

poetry run chirp-64 -i input.wav

Running Directly from Source

Alternatively, you can run using Python module syntax:

poetry run python -m chirp_64 -o output.wav

Verbosity Levels

The program supports multiple verbosity levels:

  • Default: Only warnings and errors
  • -v: Basic info (SNR, BER, status messages)
  • -vv: Info + signal plots
  • -vvv: Debug info + all plots including correlations

Configuration Parameters

All major parameters can be configured via command-line arguments:

poetry run chirp-64 -o output.wav \
    --fs 48000 \            # Sampling frequency (Hz)
    --baud-rate 200 \       # Symbols per second
    --f-start 2000 \        # Start frequency for chirps (Hz)
    --f-end 2400 \          # End frequency for chirps (Hz)
    --amplitude 0.8 \       # Chirp amplitude
    --noise-power 0.5 \     # Noise power
    --preamble "11001100" \ # Preamble bit sequence
    --sfd "11111111" \      # Start Frame Delimiter sequence
    --payload-length 128 \  # Number of payload bits
    --max-bits 1000        # Maximum bits to annotate in plots

Example Commands

  1. Generate signal with default parameters:
poetry run chirp-64 -o output.wav
  1. Generate and visualize signal:
poetry run chirp-64 -vv -o output.wav
  1. Process input file with custom parameters:
poetry run chirp-64 -v -i input.wav --baud-rate 200 --f-start 2000 --f-end 2400
  1. Full debug mode with all plots:
poetry run chirp-64 -vvv -o output.wav

Development

Setting up Development Environment

  1. Clone the repository:
git clone https://github.com/yourusername/chirp-64.git
cd chirp-64
  1. Install development dependencies:
poetry install --with dev
  1. Activate the virtual environment:
poetry shell

Running Tests

poetry run pytest

Code Formatting

Format code using black:

poetry run black chirp_64

Signal Structure

The transmitted frame consists of:

  1. Preamble (8 bits): For frame detection
  2. Start Frame Delimiter (8 bits): For frame synchronization
  3. Payload Size Field (16 bits): Indicates payload length
  4. Payload (variable length): User data
  5. CRC32 (32 bits): Error detection

Output Files

  • WAV files containing the modulated signal
  • Plot visualizations (when using -vv or -vvv):
    • Transmitted signal with bit annotations
    • Received signal with frame structure markers
    • Correlation plots for frame detection

Logging Output

The program provides different levels of logging:

  • Transmission data (payload, CRC)
  • Reception data (received payload, CRC)
  • Signal-to-Noise Ratio (SNR)
  • Bit Error Rate (BER)
  • Frame detection status
  • Various debug information at higher verbosity levels

Advanced Usage

Custom Frame Parameters

poetry run chirp-64 -o output.wav \
    --preamble "10101010" \
    --sfd "11110000" \
    --payload-length 128

Noise Testing

poetry run chirp-64 -o output.wav --noise-power 2.0

High-Speed Communication

poetry run chirp-64 -o output.wav --baud-rate 200 --fs 48000

Contributing

  1. Fork the project
  2. Create your feature branch (git checkout -b feature/amazing-feature)
  3. Install development dependencies (poetry install --with dev)
  4. Make your changes
  5. Run tests (poetry run pytest)
  6. Format code (poetry run black chirp_64)
  7. Commit your changes (git commit -m 'Add amazing feature')
  8. Push to the branch (git push origin feature/amazing-feature)
  9. Open a Pull Request

License

MIT License

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

chirp_64-0.0.3.tar.gz (14.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

chirp_64-0.0.3-py3-none-any.whl (15.2 kB view details)

Uploaded Python 3

File details

Details for the file chirp_64-0.0.3.tar.gz.

File metadata

  • Download URL: chirp_64-0.0.3.tar.gz
  • Upload date:
  • Size: 14.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.3 CPython/3.12.7 Linux/6.2.0-39-generic

File hashes

Hashes for chirp_64-0.0.3.tar.gz
Algorithm Hash digest
SHA256 29b9cf427f421c3d067b2678ae60491bb5e56133173fd200a86cf7f3094cd576
MD5 409e1fd756f212c8f3f1949623bf47c4
BLAKE2b-256 612d9b9a58023ec559d68a194edf3c767866ffb10da2a1ab0e4fbd1e20f09714

See more details on using hashes here.

File details

Details for the file chirp_64-0.0.3-py3-none-any.whl.

File metadata

  • Download URL: chirp_64-0.0.3-py3-none-any.whl
  • Upload date:
  • Size: 15.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.3 CPython/3.12.7 Linux/6.2.0-39-generic

File hashes

Hashes for chirp_64-0.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 83c1c7dcedc9820be73e450941f1ffb2ce0a52709c3b6b5d8c638ff6110de6e1
MD5 192dc6f03c5bc1116c181b1cb21707da
BLAKE2b-256 147c2d4317ac6f172f6d5e1f3994b6d2cc43976a0190c47b2429953084891658

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page