Code Monkey home page Code Monkey logo

nrz-audio-modem's Introduction

Audio NRZ/Manchester modem

Some information

  • Decoder is based on zilog80 Vaisala RS41 decoder https://github.com/rs1729/RS/
  • Using same header as RS41 for NRZ, for Manchester use extended header Manchester header (similar to DFM)
  • File > Encoder > Transmission line + noise > Decoder > File
  • Eg. Arduino > RF modulator from STB > Transmission line + noise > RTL-SDR > Decoder > collectd > RRD Graphs
  • Eg. RS41 radiosonde > Transmission line + noise > RTL-SDR > nrz-audio-modem
  • Manchester from NRZ is coded like: 01->1,10->0 , Maybe it is inverted if my system use little endian byte order. (I'm not sure now.)

Frame structure

Frame structure for speed 4800 baud/s, 16 user bytes => total 26 bytes (HEAD+DATA+CRC).

  • NRZ coding:
HEAD = "0000100001101101010100111000100001000100011010010100100000011111"

/--------------*-------------------------*-----------------------\
| HEAD 64 bits | NRZ coded DATA 128 bits | NRZ coded CRC 16 bits |
\--------------*-------------------------*-----------------------/

Total: 208 bits -> 26 bytes

  • Manchester coding:
HEAD = "0101100110011001100110011001100110010101101101101010101010101010"

/--------------*--------------------------------*------------------------------\
| HEAD 64 bits | Manchester coded DATA 256 bits | Manchester coded CRC 32 bits |
\--------------*--------------------------------*------------------------------/

Total: 352 bits -> 44 bytes

Reed-Solomon ECC

Support for following RS codes:

  • RS(255,247)
  • RS(255,239)
  • RS(255,231)
  • RS(255,223)
  • RS(255,215)
  • RS(255,207)

Reed-Solomon coder and decoder is taken from https://github.com/supurloop/ssf. Galois Field GF(2^8). Maximum RS block size is 255 bytes (message + parity).

Programs help:

  • Decoder
Audio NRZ/Manchester decoder
Usage: ../decoder/decoder -i <filename> [-o <filename> -IRA -b <rate> -M -L <frame length> ] -F <RS level> | -h
  -i <filename> Input 8 or 16 bit WAV file
  -i -          Read from stdin
  -o <filename> Output data file
  -o -          Write to stdout
  -b <rate>     Signal baud rate, default 4800
  -L <frm len>  Set usefull data lenght in bytes, default 246 bytes, minimum 8
  -F <RS level> Check Reed-Solomon parity bytes: 0 = uncoded (default), 1 = (255,247), 2 = (255,239)
                3 = (255,231), 4 = (255,223), 5 = (255,215), 6 = (255,207)
  -M            Use Manchester coding, default is NRZ
  -I            Inverse signal
  -R            Better bit resolution
  -A            Average decoding
  -P <mode>     Frame printing mode number
                0 - HEX frame output, default
                1 - Decoding from STM32 bluepill test
                2 - Decoding from Vaisala RS41
                3 - Decoding from Vaisala RS41 sounding sonde
  -h            Show this help
                Build: 21:21:53 Sep 10 2021, GCC 5.3.0
Run:
sox -t pulseaudio default -t wav - 2>/dev/null | ./decoder -i -
Decoder is under test with STM32 Blue pill board and Si5351 transmitter
  • Encoder
Audio NRZ/Manchester encoder
Usage: ./encoder -o <filename> [-i <filename> -b <rate> -w <rate> -M -R -L <frame length>] -F <RS level> | -h
  -i <filename> Data file to read
  -i -          Read from stdin
  -o <filename> Output WAV file
  -o -          Write to stdout
  -b <rate>     Signal baud rate, default 4800 bit/s
  -L <frm len>  Set usefull data lenght in bytes, default 246 bytes, minimum 8
  -F <RS level> Add Reed-Solomon parity bytes: 0 = uncoded (default), 1 = (255,247), 2 = (255,239)
                3 = (255,231), 4 = (255,223), 5 = (255,215), 6 = (255,207)
  -M            Use Manchester coding, default is NRZ
  -R            RAW output
  -w <rate>     WAV file sample rate, default 24000 Hz
  -h            Show this help
                Build: 21:17:30 Sep 10 2021, GCC 5.3.0
Run:
./encoder -o - -b 4800 -w 44100 | sox --ignore-length - -t wav - fir gauss2.4.txt  | play -t wav -

TODO

nrz-audio-modem's People

Contributors

tom2238 avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.