Browse Source

0.0.2

p2p
mach327 1 year ago
parent
commit
b25af8dbeb
  1. 54
      README.md
  2. 12
      m17/__main__.py
  3. 8
      m17/audio_test.py
  4. 11
      m17/client.py
  5. 10
      makefile
  6. 9
      requirements_debian_10.txt
  7. 23
      setup.py

54
README.md

@ -1,20 +1,56 @@
# Python package for M17 radio and radio-over-IP protocols
M17 is a new, experimental radio protocol similar to DMR/MotoTRBO, P25, D-STAR, and others.
It uses the Codec2 vocoder by David Rowe.
[![Build Status](https://drone.mmcginty.me/api/badges/mike/pyM17/status.svg?ref=refs/heads/master)](https://drone.mmcginty.me/mike/pyM17)
Full python support for handling M17 addresses, framing and parsing,
This package has full python support for handling M17 addresses, framing and parsing,
and including a full Python native VoIP client.
M17 is a new, experimental radio protocol similar to DMR/MotoTRBO, P25, D-STAR, and others.
It uses the Codec2 vocoder by David Rowe.
## Features
### Base
* `python -m m17.address <callsign>` - print the encoded M17 base40 representation of the callsigns given
* see `frames.py` and `framer.py` in the source for M17 frame classes and example usage.
### [Codec2]
* `python -m m17.audio_test 3200` where 3200 can also be 1600, 1200, or other supported Codec2 bitrate. Takes your microphone, encodes and decodes it into Codec2, and plays it back. Useful for getting your microphone input tuned properly for Codec2.
## Installation
### Pip
You can install with `pip install m17`, and get a basic feature set
including framing and M17 address translation.
However, to get all features that use `Codec2`, including the full M17 VoIP node
and `audio_test`, you must first have `Codec2` installed on
your system, including the `Codec2` development headers, and `Cython`. Once that's
complete, you can then `pip install m17[Codec2]` to install all features.
Note that installing `Cython` separately before `pycodec2` seems to be
required in order to make sure it's available for `pycodec2`'s setup
process.
Here's an example for Arch Linux.
```
pacman -Syu base-devel codec2 python python-pip python-setuptools
pip install --upgrade pip numpy Cython wheel setuptools
pip install m17[Codec2]
```
Naturally you need the typical compilation tools, which on Arch are `base-devel`.
Use this Python (Py3 only) package to implement or integrate M17 systems,
or if you need more performance or embedded support, please check out
[libm17](https://git.mmcginty.me/mike/libm17).
On systems that separate development headers, you need those too for
Codec2, i.e. both `codec2` and `codec2-dev`, or whatever the appropriate
names are for your distro.
On many Ubuntu and Debian systems, the codec2 packages in the distro
repositories is too out of date for use with pycodec2, so you may need
to follow the [upstream Codec2 instructions](https://github.com/drowe67/codec2)
and the [upstream pycodec2 instructions](https://github.com/gregorias/pycodec2)
to get a fully working installation of both.
# Installation
`pip install .`
[Different purposes of setup.py and requirements.txt](https://stackoverflow.com/a/33685899)
You may email me with clearly described problems regarding installation
and I will do my best to help.

12
m17/__main__.py

@ -1,7 +1,15 @@
helptext="""
python -m m17.address W2FBI
python -m m17.client
`python -m m17` doesn't do anything on it's own (yet).
Examples:
Without `pip install m17[Codec2]`
python -m m17.address W2FBI
With `pip install m17[Codec2]`
python -m m17.audio_test 3200
python -m m17.client
"""
def main():
print(helptext)

8
m17/audio_test.py

@ -1,7 +1,11 @@
import sys
import time
import numpy
import pycodec2
try:
import pycodec2
import numpy
except:
raise(Exception("Need to install with [Codec2]"))
def audio_test_soundcard(mode):
import soundcard as sc

11
m17/client.py

@ -2,14 +2,9 @@
import sys
import time
import queue
import numpy
import socket
import binascii
import pycodec2
import threading
import multiprocessing
import scipy
import scipy.signal
from .const import default_port
from .address import Address
@ -18,7 +13,11 @@ from .framer import M17_IPFramer
from .const import *
from .misc import example_bytes,_x,chunk
try:
import pycodec2
import numpy
except:
raise(Exception("Need to install with [Codec2]"))
def null(config, inq, outq):

10
makefile

@ -0,0 +1,10 @@
.PHONY: test
test:
python -m unittest discover -v
test_install:
rm -rf env
python -m venv env; source env/bin/activate; pip install .; python setup.py sdist bdist_wheel;
test_install2:
python -m venv env; source env/bin/activate; pip install .[Codec2]; python setup.py sdist bdist_wheel;

9
requirements_debian_10.txt

@ -1,10 +1 @@
bitstruct==8.11.0
cffi==1.14.2
Cython==0.29.21
numpy==1.19.1
pycodec2==1.0.3
pycparser==2.20
samplerate==0.1.0
scipy==1.5.2
SoundCard==0.4.0
twine

23
setup.py

@ -1,6 +1,7 @@
#!/usr/bin/env python
import setuptools
from setuptools import setup
from os import path
#for reference: https://github.com/navdeep-G/setup.py/blob/master/setup.py
#
@ -10,20 +11,17 @@ URL = 'https://git.mmcginty.me/mike/pym17'
EMAIL = 'pyM17@tarxvf.tech'
AUTHOR = 'tarxvf'
REQUIRES_PYTHON = '>=3.8.0'
VERSION = '0.0.1'
VERSION = '0.0.2'
REQUIRED=[
"Cython",
"numpy",
"scipy",
"soundcard",
"bitstruct",
"samplerate",
"pycodec2"
"wheel"
]
this_directory = path.abspath(path.dirname(__file__))
with open(path.join(this_directory, 'README.md'), encoding='utf-8') as f:
long_description = f.read()
long_description = DESCRIPTION
#look into sourcing VERSION from git tag
@ -41,6 +39,15 @@ setuptools.setup(
install_requires=REQUIRED,
packages=setuptools.find_packages(),
include_package_data=True,
extras_require={
"Codec2":[
"Cython",
"numpy",
"soundcard",
"samplerate",
"pycodec2"
]
},
classifiers=[
# Trove classifiers
# Full list: https://pypi.python.org/pypi?%3Aaction=list_classifiers

Loading…
Cancel
Save