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,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 calculationsgen_freq_bitsgenerates tuples that describe a sine wave segment with frequency in Hz and duration in msgen_valuesgenerates samples between -1 and +1, performing sampling according to the samples per second value given during constructiongen_samplesgenerates discrete samples, performing quantization according to the bits per sample value given during constructionwrite_wavwrites 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
- receive-only "counterpart": https://github.com/windytan/slowrx
- free SSTV handbook: http://www.sstv-handbook.com/
- robot 36 encoder/decoder in C: https://github.com/xdsopl/robot36/
Dependencies
- Python 2.7 (tested on 2.7.9; 2.6 might work, but test suite lacks support) or 3.x (tested on 3.2, 3.3, 3.4 and 3.5)
- Python Imaging Library (Debian/Ubuntu package:
python-imaging)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file PySSTV-0.4.4.tar.gz.
File metadata
- Download URL: PySSTV-0.4.4.tar.gz
- Upload date:
- Size: 223.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.3.0 pkginfo/1.4.2 requests/2.25.1 setuptools/51.3.3 requests-toolbelt/0.9.1 tqdm/4.51.0 CPython/3.9.1+
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6dc2458d456c90e3956e956b6949e547086303f9efcb5ac279c7c1e7ad249fa1
|
|
| MD5 |
c39726f012471e4663cd7ae1e0431096
|
|
| BLAKE2b-256 |
9dba59d37c064b29b6c5f348cae0ba8db07331d1817c1bab462b34c0229e6c4c
|
File details
Details for the file PySSTV-0.4.4-py2-none-any.whl.
File metadata
- Download URL: PySSTV-0.4.4-py2-none-any.whl
- Upload date:
- Size: 20.3 kB
- Tags: Python 2
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.3.0 pkginfo/1.4.2 requests/2.25.1 setuptools/51.3.3 requests-toolbelt/0.9.1 tqdm/4.51.0 CPython/3.9.1+
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
37bd4a62daeea4c5415f5bb70afd20e67ce7a4654f1b109e2e3a4d05ad5b95ce
|
|
| MD5 |
b5662100e364e80742c9d75fc5ff88d1
|
|
| BLAKE2b-256 |
86be4decd07102cc8f9d8409d54a37393396759c9978ea67fdc8bb1a6832f1ad
|