Skip to main content

Python classes for generating Slow-scan Television transmissions

Project description

SSTV generator in pure Python

PySSTV generates SSTV modulated WAV files from any image that PIL can open (PNG, JPEG, GIF, and many others). These WAV files then can be played by any audio player connected to a shortwave radio for example.

My main motivation was to understand the internals of SSTV in practice, so performance is far from optimal. I tried keeping the code readable, and only performed such optimizations that wouldn't have complicated the codebase.

Command line usage

$ python -m pysstv -h
usage: __main__.py [-h]
              [--mode {MartinM1,MartinM2,ScottieS1,ScottieS2,Robot36,PasokonP3,PasokonP5,PasokonP7,PD90,PD120,PD160,PD180,PD240,PD290,Robot8BW,Robot24BW}]
              [--rate RATE] [--bits BITS] [--vox] [--fskid FSKID]
              [--chan CHAN]
              image.png output.wav

Converts an image to an SSTV modulated WAV file.

positional arguments:
  image.png             input image file name
  output.wav            output WAV file name

optional arguments:
  -h, --help            show this help message and exit
  --mode {MartinM1,MartinM2,ScottieS1,ScottieS2,Robot36,PasokonP3,PasokonP5,PasokonP7,PD90,PD120D160,PD180,PD240,Robot8BW,Robot24BW}
                        image mode (default: Martin M1)
  --rate RATE           sampling rate (default: 48000)
  --bits BITS           bits per sample (default: 16)
  --vox                 add VOX tones at the beginning
  --fskid FSKID         add FSKID at the end
  --chan CHAN           number of channels (default: mono)

Python interface

The SSTV class in the sstv module implements basic SSTV-related functionality, and the classes of other modules such as grayscale and color extend this. Most instances implement the following methods:

  • __init__ takes a PIL image, the samples per second, and the bits per sample as a parameter, but doesn't perform any hard calculations
  • gen_freq_bits generates tuples that describe a sine wave segment with frequency in Hz and duration in ms
  • gen_values generates samples between -1 and +1, performing sampling according to the samples per second value given during construction
  • gen_samples generates discrete samples, performing quantization according to the bits per sample value given during construction
  • write_wav writes the whole image to a Microsoft WAV file

The above methods all build upon those above them, for example write_wav calls gen_samples, while latter calls gen_values, so typically, only the first and the last, maybe the last two should be called directly, the others are just listed here for the sake of completeness and to make the flow easier to understand.

License

The whole project is available under MIT license.

Useful links

Dependencies

  • Python 3.5 or later
  • Python Imaging Library (Debian/Ubuntu package: python3-pil)

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

PySSTV-0.5.5.tar.gz (15.8 kB view details)

Uploaded Source

Built Distribution

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

PySSTV-0.5.5-py3-none-any.whl (20.3 kB view details)

Uploaded Python 3

File details

Details for the file PySSTV-0.5.5.tar.gz.

File metadata

  • Download URL: PySSTV-0.5.5.tar.gz
  • Upload date:
  • Size: 15.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.6

File hashes

Hashes for PySSTV-0.5.5.tar.gz
Algorithm Hash digest
SHA256 420ed712c063644af899a208f12536a0dc05d9967b7fc179e6527c600fa1e109
MD5 15e2ed94db56748619ab99c7e4fd7eb9
BLAKE2b-256 3b3937699abace125d5cda89421567a7133ddd3fe5b6f90b1c987d032ef17c3a

See more details on using hashes here.

File details

Details for the file PySSTV-0.5.5-py3-none-any.whl.

File metadata

  • Download URL: PySSTV-0.5.5-py3-none-any.whl
  • Upload date:
  • Size: 20.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.6

File hashes

Hashes for PySSTV-0.5.5-py3-none-any.whl
Algorithm Hash digest
SHA256 b2e7ae3fc7ff036d0e8f12329fb97715af15ed3c6a79b26f4f783df50ddcb471
MD5 dcb6552408e29784bd7cbbe262217131
BLAKE2b-256 9bcaab00ff0ce58709ca2fd208d9d995c6d8ad8e55fb47f405e806229c32d59c

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