Code Monkey home page Code Monkey logo

amodem's Introduction

Audio Modem Communication Library

Python Versions License Package Version Development Status

Description

This program can transmit a file between 2 computers, using a simple headset, allowing true air-gapped communication (via a speaker and a microphone), or an audio cable (for higher transmission speed).

The sender modulates the input data into an audio signal, which is played to the sound card.

The receiver records the audio, and demodulates it back to the original data.

The process requires a single manual calibration step: the transmitter has to find the optimal output volume for its sound card, which will not saturate the receiving microphone and provide good enough Signal-to-Noise ratio for the demodulation to succeed.

HackerNews discussion: https://news.ycombinator.com/item?id=17333257

Technical Details

The modem is using OFDM over an audio cable with the following parameters:

  • Sampling rate: 8/16/32 kHz
  • Baud rate: 1 kHz
  • Symbol modulation: BPSK, 4-PSK, 16-QAM, 64-QAM, 256-QAM
  • Carriers: 2-11 kHz (up to ten carriers)

This way, modem may achieve 80kbps bitrate = 10 kB/s (for best SNR).

A simple CRC-32 checksum is used for data integrity verification on each 250 byte data frame.

Installation

Make sure that all the required packages are installed (on Debian):

$ sudo apt-get install python-numpy python-pip portaudio19-dev git

Get the latest released version from PyPI:

$ pip install --user amodem

Or, try the latest (unstable) development version from GitHub:

$ git clone https://github.com/romanz/amodem.git
$ cd amodem
$ pip install --user -e .

For graphs and visualization (optional), install matplotlib Python package.

For validation, run:

$ export BITRATE=48  # explicitly select high MODEM bit rate (assuming good SNR).
$ amodem -h
usage: amodem [-h] {send,recv} ...

Audio OFDM MODEM: 48.0 kb/s (64-QAM x 8 carriers) Fs=32.0 kHz

positional arguments:
  {send,recv}
    send         modulate binary data into audio signal.
    recv         demodulate audio signal into binary data.

optional arguments:
  -h, --help     show this help message and exit

On, Windows you may download the portaudio library from MinGW. Then, you should specify the DLL using the following command-line flag:

-l AUDIO_LIBRARY, --audio-library AUDIO_LIBRARY
                    File name of PortAudio shared library.

Calibration

Connect the audio cable between the sender and the receiver, and run the following scripts:

On the sender's side:

~/sender $ export BITRATE=48  # explicitly select high MODEM bit rate (assuming good SNR).
~/sender $ amodem send --calibrate

On the receiver's side:

~/receiver $ export BITRATE=48  # explicitly select high MODEM bit rate (assuming good SNR).
~/receiver $ amodem recv --calibrate

If BITRATE is not set, the MODEM will use 1 kbps settings (single frequency with BPSK modulation).

Change the sender computer's output audio level, until all frequencies are received well:

 3000 Hz: good signal
 4000 Hz: good signal
 5000 Hz: good signal
 6000 Hz: good signal
 7000 Hz: good signal
 8000 Hz: good signal
 9000 Hz: good signal
10000 Hz: good signal

If the signal is "too weak", increase the sender's output audio level.

If the signal is "too strong", decrease the sender's output audio level.

If the signal is "too noisy", it may be that the noise level is too high or that the analog signal is being distorted. Please run the following command during the calibration session, and send me the resulting audio.raw file for debugging:

~/receiver $ arecord --format=S16_LE --channels=1 --rate=32000 audio.raw

You can see a screencast of the calibration process.

Usage

Prepare the sender (generate a random binary data file to be sent):

~/sender $ dd if=/dev/urandom of=data.tx bs=60KB count=1 status=none
~/sender $ sha256sum data.tx
008df57d4f3ed6e7a25d25afd57d04fc73140e8df604685bd34fcab58f5ddc01  data.tx

Start the receiver (will wait for the sender to start):

~/receiver $ amodem recv -vv -o data.rx

Start the sender (will modulate the data and start the transmission):

~/sender $ amodem send -vv -i data.tx

A similar log should be emitted by the sender:

2015-02-06 18:12:46,222 DEBUG      Audio OFDM MODEM: 48.0 kb/s (64-QAM x 8 carriers) Fs=32.0 kHz
2015-02-06 18:12:46,222 INFO       PortAudio V19-devel (built Feb 25 2014 21:09:53) loaded
2015-02-06 18:12:48,297 INFO       Sending 2.150 seconds of training audio
2015-02-06 18:12:48,297 INFO       Starting modulation
2015-02-06 18:12:49,303 DEBUG      Sent      6.000 kB
2015-02-06 18:12:50,296 DEBUG      Sent     12.000 kB
2015-02-06 18:12:51,312 DEBUG      Sent     18.000 kB
2015-02-06 18:12:52,290 DEBUG      Sent     24.000 kB
2015-02-06 18:12:53,299 DEBUG      Sent     30.000 kB
2015-02-06 18:12:54,299 DEBUG      Sent     36.000 kB
2015-02-06 18:12:55,306 DEBUG      Sent     42.000 kB
2015-02-06 18:12:56,296 DEBUG      Sent     48.000 kB
2015-02-06 18:12:57,311 DEBUG      Sent     54.000 kB
2015-02-06 18:12:58,293 DEBUG      Sent     60.000 kB
2015-02-06 18:12:58,514 INFO       Sent 60.000 kB @ 10.201 seconds
2015-02-06 18:12:59,506 DEBUG      Closing input and output

A similar log should be emitted by the receiver:

2015-02-06 18:12:44,848 DEBUG      Audio OFDM MODEM: 48.0 kb/s (64-QAM x 8 carriers) Fs=32.0 kHz
2015-02-06 18:12:44,849 INFO       PortAudio V19-devel (built Feb 25 2014 21:09:53) loaded
2015-02-06 18:12:44,929 DEBUG      AsyncReader thread started
2015-02-06 18:12:44,930 DEBUG      Skipping 0.100 seconds
2015-02-06 18:12:45,141 INFO       Waiting for carrier tone: 3.0 kHz
2015-02-06 18:12:47,846 INFO       Carrier detected at ~2265.0 ms @ 3.0 kHz
2015-02-06 18:12:47,846 DEBUG      Buffered 1000 ms of audio
2015-02-06 18:12:48,025 DEBUG      Carrier starts at 2264.000 ms
2015-02-06 18:12:48,029 DEBUG      Carrier symbols amplitude : 0.573
2015-02-06 18:12:48,030 DEBUG      Current phase on carrier: 0.061
2015-02-06 18:12:48,030 DEBUG      Frequency error: -0.009 ppm
2015-02-06 18:12:48,030 DEBUG      Frequency correction: 0.009 ppm
2015-02-06 18:12:48,030 DEBUG      Gain correction: 1.746
2015-02-06 18:12:48,198 DEBUG      Prefix OK
2015-02-06 18:12:48,866 DEBUG        3.0 kHz: SNR = 34.82 dB
2015-02-06 18:12:48,866 DEBUG        4.0 kHz: SNR = 36.39 dB
2015-02-06 18:12:48,867 DEBUG        5.0 kHz: SNR = 37.88 dB
2015-02-06 18:12:48,867 DEBUG        6.0 kHz: SNR = 38.58 dB
2015-02-06 18:12:48,867 DEBUG        7.0 kHz: SNR = 38.86 dB
2015-02-06 18:12:48,867 DEBUG        8.0 kHz: SNR = 38.63 dB
2015-02-06 18:12:48,867 DEBUG        9.0 kHz: SNR = 38.07 dB
2015-02-06 18:12:48,868 DEBUG       10.0 kHz: SNR = 37.22 dB
2015-02-06 18:12:48,869 INFO       Starting demodulation
2015-02-06 18:12:49,689 DEBUG      Got       6.000 kB, SNR: 41.19 dB, drift: -0.01 ppm
2015-02-06 18:12:50,659 DEBUG      Got      12.000 kB, SNR: 41.05 dB, drift: -0.00 ppm
2015-02-06 18:12:51,639 DEBUG      Got      18.000 kB, SNR: 40.96 dB, drift: -0.00 ppm
2015-02-06 18:12:52,610 DEBUG      Got      24.000 kB, SNR: 41.47 dB, drift: -0.01 ppm
2015-02-06 18:12:53,610 DEBUG      Got      30.000 kB, SNR: 41.06 dB, drift: -0.00 ppm
2015-02-06 18:12:54,589 DEBUG      Got      36.000 kB, SNR: 41.37 dB, drift: -0.00 ppm
2015-02-06 18:12:55,679 DEBUG      Got      42.000 kB, SNR: 41.13 dB, drift: -0.00 ppm
2015-02-06 18:12:56,650 DEBUG      Got      48.000 kB, SNR: 41.31 dB, drift: -0.00 ppm
2015-02-06 18:12:57,631 DEBUG      Got      54.000 kB, SNR: 41.23 dB, drift: +0.00 ppm
2015-02-06 18:12:58,605 DEBUG      Got      60.000 kB, SNR: 41.31 dB, drift: +0.00 ppm
2015-02-06 18:12:58,857 DEBUG      EOF frame detected
2015-02-06 18:12:58,857 DEBUG      Demodulated 61.205 kB @ 9.988 seconds (97.9% realtime)
2015-02-06 18:12:58,858 INFO       Received 60.000 kB @ 9.988 seconds = 6.007 kB/s
2015-02-06 18:12:58,876 DEBUG      Closing input and output
2015-02-06 18:12:58,951 DEBUG      AsyncReader thread stopped (read 896000 bytes)

After the receiver has finished, verify the received file's hash:

~/receiver $ sha256sum data.rx
008df57d4f3ed6e7a25d25afd57d04fc73140e8df604685bd34fcab58f5ddc01  data.rx

You can see a screencast of the data transfer process.

I/O redirection

The audio can be written/read to an intermediate PCM file (instead of the speaker/microphone) using:

$ echo 123 | amodem send -o /tmp/file.pcm
Sending 0.800 seconds of training audio
Starting modulation
Sent 0.004 kB @ 0.113 seconds

$ amodem recv -i /tmp/file.pcm
Waiting for carrier tone: 2.0 kHz
Carrier detected at ~150.0 ms @ 2.0 kHz
Carrier coherence: 100.000%
Carrier symbols amplitude : 1.000
Frequency error: 0.000 ppm
Starting demodulation
123
Received 0.004 kB @ 0.011 seconds = 0.376 kB/s

Visualization

Make sure that matplotlib package is installed, and run (at the receiver side):

~/receiver $ amodem recv --plot -o data.rx

amodem's People

Contributors

anduck avatar babetoduarte avatar jwoillez avatar mgorny avatar romanz avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

amodem's Issues

error: AttributeError: 'NoneType' object has no attribute 'modem_bps'

$export BITRATE=1200
$amodem -h

Traceback (most recent call last):
  File "/home/user/.local/bin/amodem", line 8, in <module>
    sys.exit(_main())
  File "/home/user/.local/lib/python3.8/site-packages/amodem/__main__.py", line 217, in _main
    config.modem_bps / 1e3, len(config.symbols),
AttributeError: 'NoneType' object has no attribute 'modem_bps'

fedora Linux 5.11.22-100.fc32.x86_64 #1 SMP Wed May 19 18:58:25 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux

Using other sampling rates

Can you please add the ability to use other sampling rates, for example: Iโ€™m trying to get amodem working using a USB audio card but it only supports 44100Hz sampling.

AttributeError: /lib/libportaudio.so: undefined symbol: Pa_GetVersionText

last ubuntu on raspbery pi (all version)
5.15.61+ #1579 Fri Aug 26 11:08:59 BST 2022 armv6l GNU/Linux

$echo "p" | amodem send
Audio OFDM MODEM v1.15.3: 48.0 kb/s (64-QAM x 8 carriers) Fs=32.0 kHz
Traceback (most recent call last):
  File "/home/userek/.local/bin/amodem", line 8, in <module>
    sys.exit(_main())
  File "/home/userek/.local/lib/python3.9/site-packages/amodem/__main__.py", line 248, in _main
    interface.load(args.audio_library)
  File "/home/userek/.local/lib/python3.9/site-packages/amodem/audio.py", line 20, in load
    version = self.call('GetVersionText', restype=ctypes.c_char_p)
  File "/home/userek/.local/lib/python3.9/site-packages/amodem/audio.py", line 32, in call
    func = getattr(self.lib, func_name)
  File "/usr/lib/python3.9/ctypes/__init__.py", line 387, in __getattr__
    func = self.__getitem__(name)
  File "/usr/lib/python3.9/ctypes/__init__.py", line 392, in __getitem__
    func = self._FuncPtr((name_or_ordinal, self))
AttributeError: /lib/libportaudio.so: undefined symbol: Pa_GetVersionText

$ python --version
Python 3.9.2

Just a question

If I had two computers in a room, and one computer had speakers, and the other one had a microphone, could I use this library to send data from the first one to the second one?

How to use with uv-5r

As the title suggests I am trying to use amodem to transfer files using a pair of uv-5rs. I have two APRS cables and two TRRS USB sound cards that I bought off Amazon. I am testing this on a single Linux machine. During the calibration process I managed to get a good signal indication with the following settings:

On the sender's side:

makis@nuc:~/.local/bin$ BITRATE=8 ./amodem send --calibrate
Audio OFDM MODEM v1.15.3: 8.0 kb/s (16-QAM x 2 carriers) Fs=8.0 kHz
b'PortAudio V19.6.0-devel, revision 396fe4b6699ae929d3a685b3ef8a7e97396139a4' loaded
ALSA lib pcm_dsnoop.c:638:(snd_pcm_dsnoop_open) unable to open slave
ALSA lib pcm.c:2660:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.rear
ALSA lib pcm.c:2660:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.center_lfe
ALSA lib pcm.c:2660:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.side
ALSA lib pcm_route.c:877:(find_matching_chmap) Found no matching channel map
ALSA lib pcm_route.c:877:(find_matching_chmap) Found no matching channel map
ALSA lib pcm_route.c:877:(find_matching_chmap) Found no matching channel map
ALSA lib pcm_oss.c:377:(_snd_pcm_oss_open) Unknown field port
ALSA lib pcm_oss.c:377:(_snd_pcm_oss_open) Unknown field port
ALSA lib pcm_usb_stream.c:486:(_snd_pcm_usb_stream_open) Invalid type for card
ALSA lib pcm_usb_stream.c:486:(_snd_pcm_usb_stream_open) Invalid type for card

and on the receiver's side:

makis@nuc:~/.local/bin$ BITRATE=8 ./amodem recv --calibrate
Audio OFDM MODEM v1.15.3: 8.0 kb/s (16-QAM x 2 carriers) Fs=8.0 kHz
b'PortAudio V19.6.0-devel, revision 396fe4b6699ae929d3a685b3ef8a7e97396139a4' loaded
ALSA lib pcm_dsnoop.c:638:(snd_pcm_dsnoop_open) unable to open slave
ALSA lib pcm.c:2660:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.rear
ALSA lib pcm.c:2660:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.center_lfe
ALSA lib pcm.c:2660:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.side
ALSA lib pcm_route.c:877:(find_matching_chmap) Found no matching channel map
ALSA lib pcm_route.c:877:(find_matching_chmap) Found no matching channel map
ALSA lib pcm_route.c:877:(find_matching_chmap) Found no matching channel map
ALSA lib pcm_oss.c:377:(_snd_pcm_oss_open) Unknown field port
ALSA lib pcm_oss.c:377:(_snd_pcm_oss_open) Unknown field port
ALSA lib pcm_usb_stream.c:486:(_snd_pcm_usb_stream_open) Invalid type for card
ALSA lib pcm_usb_stream.c:486:(_snd_pcm_usb_stream_open) Invalid type for card
verbose: 0
  2000 Hz: good signal         
  2000 Hz: good signal         
  2000 Hz: good signal         
  2000 Hz: good signal         
  2000 Hz: good signal         
  1000 Hz: good signal         
  1000 Hz: good signal         
  1000 Hz: good signal         
  1000 Hz: good signal         
  1000 Hz: good signal         
  2000 Hz: good signal         
  2000 Hz: good signal         
  2000 Hz: good signal         
  2000 Hz: good signal         
  2000 Hz: good signal         
  1000 Hz: good signal         
  1000 Hz: good signal     

But when I actually attempt to send files with the same exact settings I always get invalid check-sums.

On the receiver's side:

makis@nuc:~/.local/bin$ BITRATE=8 ./amodem recv -vv -o ~/amodem
2022-04-10 11:16:36,171 INFO       Audio OFDM MODEM v1.15.3: 8.0 kb/s (16-QAM x 2 carriers) Fs=8.0 kHz                                  __main__.py:230
2022-04-10 11:16:36,172 INFO       b'PortAudio V19.6.0-devel, revision 396fe4b6699ae929d3a685b3ef8a7e97396139a4' loaded                 audio.py:21
ALSA lib pcm_dsnoop.c:638:(snd_pcm_dsnoop_open) unable to open slave
ALSA lib pcm.c:2660:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.rear
ALSA lib pcm.c:2660:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.center_lfe
ALSA lib pcm.c:2660:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.side
ALSA lib pcm_route.c:877:(find_matching_chmap) Found no matching channel map
ALSA lib pcm_route.c:877:(find_matching_chmap) Found no matching channel map
ALSA lib pcm_route.c:877:(find_matching_chmap) Found no matching channel map
ALSA lib pcm_oss.c:377:(_snd_pcm_oss_open) Unknown field port
ALSA lib pcm_oss.c:377:(_snd_pcm_oss_open) Unknown field port
ALSA lib pcm_usb_stream.c:486:(_snd_pcm_usb_stream_open) Invalid type for card
ALSA lib pcm_usb_stream.c:486:(_snd_pcm_usb_stream_open) Invalid type for card
2022-04-10 11:16:36,190 DEBUG      AsyncReader thread started                                                                           async_reader.py:26
2022-04-10 11:16:36,190 DEBUG      Skipping 0.100 seconds                                                                               main.py:46
2022-04-10 11:16:36,815 INFO       Waiting for carrier tone: 1.0 kHz                                                                    main.py:53
2022-04-10 11:16:39,798 INFO       Carrier detected at ~2900.0 ms @ 1.0 kHz                                                             detect.py:60
2022-04-10 11:16:39,798 DEBUG      Buffered 1000 ms of audio                                                                            detect.py:63
2022-04-10 11:16:39,799 INFO       Carrier coherence: 96.556%                                                                           detect.py:94
2022-04-10 11:16:39,799 DEBUG      Carrier starts at 2899.875 ms                                                                        detect.py:73
2022-04-10 11:16:39,800 INFO       Carrier symbols amplitude : 0.387                                                                    detect.py:105
2022-04-10 11:16:39,801 INFO       Frequency error: -2259.673 ppm                                                                       detect.py:115
2022-04-10 11:16:39,801 DEBUG      Frequency correction: 2264.791 ppm                                                                   main.py:57
2022-04-10 11:16:39,801 DEBUG      Gain correction: 2.581                                                                               main.py:60
2022-04-10 11:16:39,801 DEBUG      Receiving                                                                                            recv.py:161
2022-04-10 11:16:39,814 DEBUG      Prefix OK                                                                                            recv.py:50
2022-04-10 11:16:39,828 DEBUG      Training completed                                                                                   recv.py:73
2022-04-10 11:16:39,842 DEBUG        1.0 kHz: SNR =  0.44 dB                                                                            recv.py:95
2022-04-10 11:16:39,842 DEBUG        2.0 kHz: SNR =  0.40 dB                                                                            recv.py:95
2022-04-10 11:16:39,842 ERROR      Decoding failed                                                                                      main.py:67
Traceback (most recent call last):
  File "/home/makis/.local/lib/python3.9/site-packages/amodem/main.py", line 64, in recv
    receiver.run(sampler, gain=1.0/amplitude, output=dst)
  File "/home/makis/.local/lib/python3.9/site-packages/amodem/recv.py", line 165, in run
    filt = self._train(sampler, order=10, lookahead=10)
  File "/home/makis/.local/lib/python3.9/site-packages/amodem/recv.py", line 77, in _train
    self._verify_training(equalized, train_symbols)
  File "/home/makis/.local/lib/python3.9/site-packages/amodem/recv.py", line 98, in _verify_training
    assert error_rate == 0, error_rate
AssertionError: 1.0
2022-04-10 11:16:39,916 DEBUG      AsyncReader thread stopped (read 59200 bytes)                                                        async_reader.py:31
2022-04-10 11:16:39,917 DEBUG      Finished I/O                                                                                         __main__.py:261

Can anyone point me into the right direction? Any other logs you want me to provide? I have little to no experience with signal processing so any help would be appreciated!

Can't install locally

Tried to install locally from setup.py (python setup.py install), but there seems to have a problem with numpy/cython installation ?

Running from numpy source directory.
C:\Users\JJ\AppData\Local\Temp\easy_install-94a3s9dn\numpy-1.19.0\setup.py:460: UserWarning: Unrecognized setuptools command, proceeding with generating Cython sources and expanding templates
run_build = parse_setuppy_commands()
Cythonizing sources
Processing numpy/random_bounded_integers.pxd.in
Processing numpy/random\bit_generator.pyx
Traceback (most recent call last):
File "C:\Users\JJ\AppData\Local\Temp\easy_install-94a3s9dn\numpy-1.19.0\tools\cythonize.py", line 59, in process_pyx
from Cython.Compiler.Version import version as cython_version
ModuleNotFoundError: No module named 'Cython'

Input/output from wav files

It would be cool to have the option of reading and writing data to a wav file instead of an audio interface. (I'm having trouble getting either ALSA or PortAudio working with my setup, but also it seems like this could be useful for other reasons too.)

Specify Audio Device other than Default

Hi,

I was trying to figure out the way to use this in Raspberry Pi.
Since Raspberry PI does not have Default Microphone, we need to use USB Sound Card for Microphone

The USB Sound Card comes up as plughw:1,0 which is different from Default ALSA Playback and Capture Device.

can you point me to the changes in code, which can be done to change the default Audio Card to other card value?

Also, the procedure to modify the code and compile again.

Regards,
Gurtaj

Decoding failed

Hi!
I am testing this on some of my systems and can't get a transfer to work:

Sender (using aplay because amodem picks the wrong interface):

$ echo  123 |  amodem  send -vvvv -o - | aplay
2021-08-03 12:49:32,213 INFO       Audio OFDM MODEM v1.15.3: 1.0 kb/s (2-QAM x 1 carriers) Fs=8.0 kHz                                   __main__.py:230
Playing raw data 'stdin' : Unsigned 8 bit, Rate 8000 Hz, Mono
2021-08-03 12:49:32,221 INFO       Sending 1.050 seconds of training audio                                                              main.py:23
2021-08-03 12:49:32,221 INFO       Starting modulation                                                                                  main.py:28
2021-08-03 12:49:32,226 INFO       Sent 0.004 kB @ 0.113 seconds                                                                        main.py:32
2021-08-03 12:49:32,226 DEBUG      Finished I/O                                                                                         __main__.py:261
$ 

Receiver:

$ amodem  recv  -vv
2021-08-03 12:49:31,789 INFO       Audio OFDM MODEM v1.15.3: 1.0 kb/s (2-QAM x 1 carriers) Fs=8.0 kHz                                   __main__.py:230
2021-08-03 12:49:31,790 INFO       b'PortAudio V19.6.0-devel, revision 396fe4b6699ae929d3a685b3ef8a7e97396139a4' loaded                 audio.py:21
ALSA lib pcm_dsnoop.c:642:(snd_pcm_dsnoop_open) unable to open slave
ALSA lib pcm_dmix.c:1090:(snd_pcm_dmix_open) unable to open slave
ALSA lib pcm.c:2660:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.rear
ALSA lib pcm.c:2660:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.center_lfe
ALSA lib pcm.c:2660:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.side
ALSA lib pcm_oss.c:377:(_snd_pcm_oss_open) Unknown field port
ALSA lib pcm_oss.c:377:(_snd_pcm_oss_open) Unknown field port
ALSA lib pcm_usb_stream.c:486:(_snd_pcm_usb_stream_open) Invalid type for card
ALSA lib pcm_usb_stream.c:486:(_snd_pcm_usb_stream_open) Invalid type for card
ALSA lib pcm_dmix.c:1090:(snd_pcm_dmix_open) unable to open slave
2021-08-03 12:49:31,878 DEBUG      AsyncReader thread started                                                                           async_reader.py:26
2021-08-03 12:49:31,878 DEBUG      Skipping 0.100 seconds                                                                               main.py:46
2021-08-03 12:49:32,572 INFO       Waiting for carrier tone: 2.0 kHz                                                                    main.py:53
2021-08-03 12:49:36,086 INFO       Carrier detected at ~3634.0 ms @ 2.0 kHz                                                             detect.py:60
2021-08-03 12:49:36,087 DEBUG      Buffered 1000 ms of audio                                                                            detect.py:63
2021-08-03 12:49:36,088 INFO       Carrier coherence: 71.645%                                                                           detect.py:94
2021-08-03 12:49:36,088 DEBUG      Carrier starts at 3714.625 ms                                                                        detect.py:73
2021-08-03 12:49:36,089 INFO       Carrier symbols amplitude : 0.916                                                                    detect.py:105
2021-08-03 12:49:36,090 INFO       Frequency error: 1.633 ppm                                                                           detect.py:115
2021-08-03 12:49:36,090 DEBUG      Frequency correction: -1.633 ppm                                                                     main.py:57
2021-08-03 12:49:36,090 DEBUG      Gain correction: 1.092                                                                               main.py:60
2021-08-03 12:49:36,090 DEBUG      Receiving                                                                                            recv.py:161
2021-08-03 12:49:36,106 ERROR      Decoding failed                                                                                      main.py:67
Traceback (most recent call last):
  File "/home/david/.local/lib/python3.8/site-packages/amodem/main.py", line 64, in recv
    receiver.run(sampler, gain=1.0/amplitude, output=dst)
  File "/home/david/.local/lib/python3.8/site-packages/amodem/recv.py", line 163, in run
    self._prefix(symbols, gain=gain)
  File "/home/david/.local/lib/python3.8/site-packages/amodem/recv.py", line 49, in _prefix
    raise ValueError(msg)
ValueError: Incorrect prefix: 50 errors
2021-08-03 12:49:36,175 DEBUG      AsyncReader thread stopped (read 67200 bytes)                                                        async_reader.py:31
2021-08-03 12:49:36,177 DEBUG      Finished I/O                                                                                         __main__.py:261

However, calibration seems good?

2021-08-03 12:47:20,394 INFO         2000 Hz: good signal         total=0.9294, rms=0.9291, coherency=0.9996, peak=0.9813               calib.py:141
2021-08-03 12:47:20,594 INFO         2000 Hz: good signal         total=0.9205, rms=0.9201, coherency=0.9996, peak=0.9687               calib.py:141
2021-08-03 12:47:20,809 INFO         2000 Hz: good signal         total=0.9119, rms=0.9116, coherency=0.9996, peak=0.9649               calib.py:141
2021-08-03 12:47:20,985 INFO         2000 Hz: good signal         total=0.9052, rms=0.9048, coherency=0.9996, peak=0.9596               calib.py:141
2021-08-03 12:47:21,214 INFO         2000 Hz: good signal         total=0.9077, rms=0.9073, coherency=0.9996, peak=0.9631               calib.py:141
2021-08-03 12:47:21,413 INFO         2000 Hz: good signal         total=0.9063, rms=0.9060, coherency=0.9996, peak=0.9611               calib.py:141
2021-08-03 12:47:21,613 INFO         2000 Hz: good signal         total=0.9061, rms=0.9057, coherency=0.9996, peak=0.9582               calib.py:141
2021-08-03 12:47:21,814 INFO         2000 Hz: good signal         total=0.9074, rms=0.9070, coherency=0.9996, peak=0.9605               calib.py:141
2021-08-03 12:47:21,986 INFO         2000 Hz: good signal         total=0.9075, rms=0.9071, coherency=0.9996, peak=0.9640               calib.py:141
2021-08-03 12:47:22,171 INFO         2000 Hz: good signal         total=0.9067, rms=0.9063, coherency=0.9996, peak=0.9563               calib.py:141
2021-08-03 12:47:22,371 INFO         2000 Hz: good signal         total=0.9077, rms=0.9073, coherency=0.9996, peak=0.9636               calib.py:141
2021-08-03 12:47:22,598 INFO         2000 Hz: good signal         total=0.9078, rms=0.9074, coherency=0.9996, peak=0.9638               calib.py:141
2021-08-03 12:47:22,772 INFO         2000 Hz: good signal         total=0.9061, rms=0.9057, coherency=0.9996, peak=0.9608               calib.py:141
2021-08-03 12:47:22,971 INFO         2000 Hz: good signal         total=0.9073, rms=0.9069, coherency=0.9996, peak=0.9599               calib.py:141
2021-08-03 12:47:23,202 INFO         2000 Hz: good signal         total=0.9064, rms=0.9060, coherency=0.9996, peak=0.9592               calib.py:141
2021-08-03 12:47:23,397 INFO         2000 Hz: good signal         total=0.9062, rms=0.9058, coherency=0.9996, peak=0.9606               calib.py:141
2021-08-03 12:47:23,598 INFO         2000 Hz: good signal         total=0.9085, rms=0.9081, coherency=0.9996, peak=0.9623               calib.py:141
2021-08-03 12:47:23,798 INFO         2000 Hz: good signal         total=0.9069, rms=0.9065, coherency=0.9996, peak=0.9608               calib.py:141
2021-08-03 12:47:23,998 INFO         2000 Hz: good signal         total=0.9053, rms=0.9049, coherency=0.9996, peak=0.9564               calib.py:141
2021-08-03 12:47:24,202 INFO         2000 Hz: good signal         total=0.9074, rms=0.9070, coherency=0.9996, peak=0.9604               calib.py:141
2021-08-03 12:47:24,402 INFO         2000 Hz: good signal         total=0.9041, rms=0.9037, coherency=0.9996, peak=0.9534               calib.py:141
2021-08-03 12:47:24,602 INFO         2000 Hz: good signal         total=0.9050, rms=0.9047, coherency=0.9996, peak=0.9611               calib.py:141
2021-08-03 12:47:24,802 INFO         2000 Hz: good signal         total=0.9068, rms=0.9064, coherency=0.9996, peak=0.9576 

Can you advise? Thanks

Decoding failed

Trying to use amodem with I/O redirection, I get the following timeout, with the latest checkout from trunk. I am on macOS High Sierra, with the latest stable release of portaudio. I get a similar behavior when going the audio way. Any more diagnostics I could send?

$ echo "Hello, how are you doing?" | amodem send -l /opt/local/lib/libportaudio.dylib -o data.pcm
Audio OFDM MODEM v1.14.0: 1.0 kb/s (2-QAM x 1 carriers) Fs=8.0 kHz
Sending 0.800 seconds of training audio
Starting modulation
Sent 0.026 kB @ 0.289 seconds

$ amodem recv -l /opt/local/lib/libportaudio.dylib -i data.pcm
Audio OFDM MODEM v1.14.0: 1.0 kb/s (2-QAM x 1 carriers) Fs=8.0 kHz
Waiting for carrier tone: 2.0 kHz
Carrier detected at ~150.0 ms @ 2.0 kHz
Carrier coherence: 100.000%
Carrier symbols amplitude : 1.000
Frequency error: 0.000 ppm
Starting demodulation
Decoding failed
Traceback (most recent call last):
  File "/Users/jwoillez/Library/Python/3.6/lib/python/site-packages/amodem-1.14.0-py3.6.egg/amodem/main.py", line 63, in recv
    receiver.run(sampler, gain=1.0/amplitude, output=dst)
  File "/Users/jwoillez/Library/Python/3.6/lib/python/site-packages/amodem-1.14.0-py3.6.egg/amodem/recv.py", line 168, in run
    for frame in framing.decode_frames(bitstream):
  File "/Users/jwoillez/Library/Python/3.6/lib/python/site-packages/amodem-1.14.0-py3.6.egg/amodem/framing.py", line 123, in decode_frames
    for frame in framer.decode(_to_bytes(bits)):
  File "/Users/jwoillez/Library/Python/3.6/lib/python/site-packages/amodem-1.14.0-py3.6.egg/amodem/framing.py", line 59, in decode
    frame = _take_len(data, length)
  File "/Users/jwoillez/Library/Python/3.6/lib/python/site-packages/amodem-1.14.0-py3.6.egg/amodem/framing.py", line 77, in _take_len
    chunk = bytearray(itertools.islice(data, length))
  File "/Users/jwoillez/Library/Python/3.6/lib/python/site-packages/amodem-1.14.0-py3.6.egg/amodem/framing.py", line 117, in _to_bytes
    func=tuple, truncate=True):
  File "/Users/jwoillez/Library/Python/3.6/lib/python/site-packages/amodem-1.14.0-py3.6.egg/amodem/common.py", line 41, in iterate
    buf = list(itertools.islice(data, size))
  File "/Users/jwoillez/Library/Python/3.6/lib/python/site-packages/amodem-1.14.0-py3.6.egg/amodem/recv.py", line 129, in _demodulate
    for i, block_of_bits in enumerate(stream, 1):
  File "/Users/jwoillez/Library/Python/3.6/lib/python/site-packages/amodem-1.14.0-py3.6.egg/amodem/common.py", line 81, in izip
    yield tuple([next(iterable) for iterable in iterables])
  File "/Users/jwoillez/Library/Python/3.6/lib/python/site-packages/amodem-1.14.0-py3.6.egg/amodem/common.py", line 81, in <listcomp>
    yield tuple([next(iterable) for iterable in iterables])
  File "/Users/jwoillez/Library/Python/3.6/lib/python/site-packages/amodem-1.14.0-py3.6.egg/amodem/dsp.py", line 105, in decode
    for received in symbols:
  File "/Users/jwoillez/Library/Python/3.6/lib/python/site-packages/amodem-1.14.0-py3.6.egg/amodem/common.py", line 66, in icapture
    for i in iter(iterable):
  File "/Users/jwoillez/Library/Python/3.6/lib/python/site-packages/amodem-1.14.0-py3.6.egg/amodem/common.py", line 57, in _gen
    for item in it:
  File "/Users/jwoillez/Library/Python/3.6/lib/python/site-packages/amodem-1.14.0-py3.6.egg/amodem/dsp.py", line 33, in next
    frame = self.sampler.take(size=self.Nsym)
  File "/Users/jwoillez/Library/Python/3.6/lib/python/site-packages/amodem-1.14.0-py3.6.egg/amodem/sampling.py", line 71, in _take
    self.buff[-1] = next(self.src)  # throws StopIteration
  File "/Users/jwoillez/Library/Python/3.6/lib/python/site-packages/amodem-1.14.0-py3.6.egg/amodem/stream.py", line 43, in next
    raise IOError('timeout')
OSError: timeout
Received 0.000 kB @ 2.056 seconds = 0.000 kB/s

communication transparently data link

It is possible to use it as a data link
Your project made something I was thinking about feasible

in this case it would be to open an audio link to send data and another to receive
or a phone call and use it as a modem and useful to get around places where the speed is low or where there is an additional charge for higher speeds

Bidirectional operation and encryption

Discovered your project on Google Play. It works really well with a tablet and phone running Android 11 and 9 respectively. I tested transmission ability about a foot (30.5 cm) apart with the tablet and phone even with some TV background noise and a fan.

This is something I've been after and I'm delighted to have found it. I would like to suggest a couple improvements.

  1. The ability for bidirectional messaging for RX/TX at the same time.

  2. Encrypted text ability. Something like AES256 or PGP would be great.

Thanks again for this marvelous software. ๐Ÿ‘

Does not work with BITRATE larger than 32 ?

Tested with several bitrates, but did not work above 32 kb/s. Setting BITRATE=48 or 80 caused "ValueError: Invalid checksum".
I used 3.5mm jack as Line in receiving side and headphone out in sending side.

Also when calibrating it showed frequency change ?
fc

Add Windows support (use DLL of PortAudio library)

The library seems to function well when used on Windows with variations of PortAudio.
(either from MSYS2 / MinGW, or the one provided here, both are V19.6.0-devel).

I've tested the DLL with the CLI so far (adding '-l' argument with the DLL path as parameter).

So Windows support is just a matter of searching a DLL in the relevant paths (C:\Windows\System32 or <path-to-msys-or-mingw>\mingw64\bin\libportaudio-2.dll) and maybe bundling a default DLL with the project.

(By the way, I'm guessing it's the same case for better macOS support [the above source has also dylib variation of PortAudio] but i'm guessing *.so file is already sufficient for this platform...)

IOError timeout

Trying to use amodem with I/O redirection on Linux 5.4.0-73-generic #82~18.04.1-Ubuntu and
python (Python 3.7.5) I've got the following timeout:

$file test_data
test_data: ASCII text, with no line terminators
$ cat test_data
1234567891234454

$ amodem send -vv -i test_data -o test.pcm
2021-06-16 09:26:30,136 INFO       Audio OFDM MODEM v1.15.1: 1.0 kb/s (2-QAM x 1 carriers) Fs=8.0 kHz                                   __main__.py:235
2021-06-16 09:26:30,141 INFO       Sending 0.800 seconds of training audio                                                              main.py:23
2021-06-16 09:26:30,141 INFO       Starting modulation                                                                                  main.py:28
2021-06-16 09:26:30,147 INFO       Sent 0.016 kB @ 0.209 seconds                                                                        main.py:33
2021-06-16 09:26:30,147 DEBUG      Finished I/O     __main__.py:266


$ amodem recv -vv -i test.pcm -o data_test
2021-06-16 09:27:07,608 INFO       Audio OFDM MODEM v1.15.1: 1.0 kb/s (2-QAM x 1 carriers) Fs=8.0 kHz                                   __main__.py:235
2021-06-16 09:27:07,608 DEBUG      Skipping 0.100 seconds                                                                               main.py:46
2021-06-16 09:27:07,609 INFO       Waiting for carrier tone: 2.0 kHz                                                                    main.py:53
2021-06-16 09:27:07,620 INFO       Carrier detected at ~150.0 ms @ 2.0 kHz                                                              detect.py:61
2021-06-16 09:27:07,620 DEBUG      Buffered 330 ms of audio                                                                             detect.py:63
2021-06-16 09:27:07,620 INFO       Carrier coherence: 100.000%                                                                          detect.py:94
2021-06-16 09:27:07,621 DEBUG      Carrier starts at 149.875 ms                                                                         detect.py:73
2021-06-16 09:27:07,622 INFO       Carrier symbols amplitude : 1.000                                                                    detect.py:105
2021-06-16 09:27:07,622 INFO       Frequency error: 0.000 ppm                                                                           detect.py:115
2021-06-16 09:27:07,622 DEBUG      Frequency correction: 0.000 ppm                                                                      main.py:57
2021-06-16 09:27:07,622 DEBUG      Gain correction: 1.000                                                                               main.py:60
2021-06-16 09:27:07,622 DEBUG      Receiving                                                                                            recv.py:161
2021-06-16 09:27:07,647 DEBUG      Prefix OK                                                                                            recv.py:50
2021-06-16 09:27:07,674 DEBUG      Training completed                                                                                   recv.py:73
2021-06-16 09:27:07,689 DEBUG        2.0 kHz: SNR = 305.91 dB                                                                           recv.py:95
2021-06-16 09:27:07,690 DEBUG      Training verified                                                                                    recv.py:99
2021-06-16 09:27:07,691 INFO       Starting demodulation                                                                                recv.py:130
2021-06-16 09:27:07,719 DEBUG      Good checksum: 7005c488                                                                              framing.py:32
2021-06-16 09:27:09,729 ERROR      Decoding failed                                                                                      main.py:67
Traceback (most recent call last):
  File "/usr/local/lib/python3.7/dist-packages/amodem/main.py", line 64, in recv
    receiver.run(sampler, gain=1.0/amplitude, output=dst)
  File "/usr/local/lib/python3.7/dist-packages/amodem/recv.py", line 171, in run
    for frame in framing.decode_frames(bitstream):
  File "/usr/local/lib/python3.7/dist-packages/amodem/framing.py", line 122, in decode_frames
    for frame in framer.decode(_to_bytes(bits)):
  File "/usr/local/lib/python3.7/dist-packages/amodem/framing.py", line 58, in decode
    frame = _take_len(data, length)
  File "/usr/local/lib/python3.7/dist-packages/amodem/framing.py", line 76, in _take_len
    chunk = bytearray(itertools.islice(data, length))
  File "/usr/local/lib/python3.7/dist-packages/amodem/framing.py", line 116, in _to_bytes
    func=tuple, truncate=True):
  File "/usr/local/lib/python3.7/dist-packages/amodem/common.py", line 41, in iterate
    buf = list(itertools.islice(data, size))
  File "/usr/local/lib/python3.7/dist-packages/amodem/recv.py", line 131, in _demodulate
    for i, block_of_bits in enumerate(stream, 1):
  File "/usr/local/lib/python3.7/dist-packages/amodem/common.py", line 81, in izip
    yield tuple([next(iterable) for iterable in iterables])
  File "/usr/local/lib/python3.7/dist-packages/amodem/common.py", line 81, in <listcomp>
    yield tuple([next(iterable) for iterable in iterables])
  File "/usr/local/lib/python3.7/dist-packages/amodem/dsp.py", line 104, in decode
    for received in symbols:
  File "/usr/local/lib/python3.7/dist-packages/amodem/common.py", line 66, in icapture
    for i in iter(iterable):
  File "/usr/local/lib/python3.7/dist-packages/amodem/common.py", line 57, in _gen
    for item in it:
  File "/usr/local/lib/python3.7/dist-packages/amodem/dsp.py", line 33, in next
    frame = self.sampler.take(size=self.Nsym)
  File "/usr/local/lib/python3.7/dist-packages/amodem/sampling.py", line 74, in _take
    self.buff[-1] = next(self.src)  # throws StopIteration
  File "/usr/local/lib/python3.7/dist-packages/amodem/stream.py", line 42, in next
    raise IOError('timeout')
OSError: timeout
2021-06-16 09:27:09,731 DEBUG      Demodulated 0.026 kB @ 2.040 seconds (990.4% realtime)                                               recv.py:181
2021-06-16 09:27:09,731 INFO       Received 0.016 kB @ 2.040 seconds = 0.008 kB/s                                                       recv.py:185
2021-06-16 09:27:09,732 DEBUG      Finished I/O                                                                                         __main__.py:266

I tried all from Decoding failed #33 (amodem recv -vvv -l ALSA, and increase Reader.timeout from 2s to 30s) but
the timeout still happening.

I noted that the timeout depends on symbols quantity in the test_data file. For instance with 16 symbols (123456789123445)
there are no timeout (previous was 17)

m$ cat test_data
123456789123445
$ amodem send -vv -i test_data -o test.pcm
2021-06-16 09:35:02,973 INFO       Audio OFDM MODEM v1.15.1: 1.0 kb/s (2-QAM x 1 carriers) Fs=8.0 kHz                                   __main__.py:235
2021-06-16 09:35:02,978 INFO       Sending 0.800 seconds of training audio                                                              main.py:23
2021-06-16 09:35:02,978 INFO       Starting modulation                                                                                  main.py:28
2021-06-16 09:35:02,984 INFO       Sent 0.015 kB @ 0.201 seconds                                                                        main.py:33
2021-06-16 09:35:02,984 DEBUG      Finished I/O                                                                                         __main__.py:266
$ amodem recv -vv -i test.pcm -o data_test
2021-06-16 09:35:07,212 INFO       Audio OFDM MODEM v1.15.1: 1.0 kb/s (2-QAM x 1 carriers) Fs=8.0 kHz                                   __main__.py:235
2021-06-16 09:35:07,213 DEBUG      Skipping 0.100 seconds                                                                               main.py:46
2021-06-16 09:35:07,213 INFO       Waiting for carrier tone: 2.0 kHz                                                                    main.py:53
2021-06-16 09:35:07,224 INFO       Carrier detected at ~150.0 ms @ 2.0 kHz                                                              detect.py:61
2021-06-16 09:35:07,224 DEBUG      Buffered 330 ms of audio                                                                             detect.py:63
2021-06-16 09:35:07,225 INFO       Carrier coherence: 100.000%                                                                          detect.py:94
2021-06-16 09:35:07,225 DEBUG      Carrier starts at 149.875 ms                                                                         detect.py:73
2021-06-16 09:35:07,226 INFO       Carrier symbols amplitude : 1.000                                                                    detect.py:105
2021-06-16 09:35:07,227 INFO       Frequency error: 0.000 ppm                                                                           detect.py:115
2021-06-16 09:35:07,227 DEBUG      Frequency correction: 0.000 ppm                                                                      main.py:57
2021-06-16 09:35:07,227 DEBUG      Gain correction: 1.000                                                                               main.py:60
2021-06-16 09:35:07,227 DEBUG      Receiving                                                                                            recv.py:161
2021-06-16 09:35:07,251 DEBUG      Prefix OK                                                                                            recv.py:50
2021-06-16 09:35:07,278 DEBUG      Training completed                                                                                   recv.py:73
2021-06-16 09:35:07,292 DEBUG        2.0 kHz: SNR = 305.91 dB                                                                           recv.py:95
2021-06-16 09:35:07,293 DEBUG      Training verified                                                                                    recv.py:99
2021-06-16 09:35:07,294 INFO       Starting demodulation                                                                                recv.py:130
2021-06-16 09:35:07,321 DEBUG      Good checksum: 605a7717                                                                              framing.py:32
2021-06-16 09:35:07,328 DEBUG      Good checksum: 00000000                                                                              framing.py:32
2021-06-16 09:35:07,328 DEBUG      EOF frame detected                                                                                   framing.py:61
2021-06-16 09:35:07,328 DEBUG      Demodulated 0.025 kB @ 0.034 seconds (17.0% realtime)                                                recv.py:181
2021-06-16 09:35:07,328 INFO       Received 0.015 kB @ 0.034 seconds = 0.441 kB/s                                                       recv.py:185
2021-06-16 09:35:07,328 DEBUG      Finished I/O                                                                                         __main__.py:266
$ sha256sum test_data
edba68fe901b11e8827c8fe9d55887fdd651a77629f6e9c1f0fba5e8bef069c6  test_data
$ sha256sum data_test
edba68fe901b11e8827c8fe9d55887fdd651a77629f6e9c1f0fba5e8bef069c6  data_test

with 100 timeout, with 124 -no timeout... May be there is something with framing...

Server side wav generation

@romanz can I use this module to generate a wav file from a string ?
I want to generate the wav file in a virtual machine in the cloud (without a sound card/system).

Adding a Python example

Hi,

This is a amazing project. I have installed the source code with pip. However, the amodem does not work. Would you please add a Python example program?

Please update reedsolo

Hello,

I am the current maintainer of reedsolo.

We have recently pushed major updates which increase speed and stability, but the API had to be changed.

If you are still using reedsolo, please ensure that you handle the 3 variables returned by reedsolo.

Before:

>>> rsc = RSCodec(12)
>>> tampered_msg = b'heXlo worXd\xed%T\xc4\xfdX\x89\xf3\xa8\xaa'
>>> decoded_msg = rsc.decode(tampered_msg)

Now:

>>> rsc = RSCodec(10)
>>> tampered_msg = b'heXlo worXd\xed%T\xc4\xfdX\x89\xf3\xa8\xaa'
>>> rmes, rmesecc, errata_pos = rsc.decode(tampered_msg)

As an alternative, you can setup your requirements.txt to require reedsolo<=0.3 to avoid the need to update.

Specify audio output device

When there are multiple audio output devices installed in the PC, is there a way to specify which one amodem uses?

I found some hints about a PA_RECOMMENDED_OUTPUT_DEVICE environment variable here but can't locate a pa_devs.exe binary (partiularly for Windows) to figure out which value(s) I should try it with.

streaming decode amodem

Hi, I'm a radio amateur. I want to do an experiment to send flags with bpsk modulation. after seeing the issue section I already know how to get wav output from amodem and I will try to send it via rf. but my problem is whether the modem can do the deocde process by streaming? thank you.

Running from Python script!

Can someone show a short example how to run this from Python? I want to use this from Python script - function send and recv respectivelly ?

from amodem import config
from amodem import audio
from amodem import main

configuaration = config.Configuration()
interface = audio.Interface(configuration)
audio_library = "../../libportaudio64bit.dll"
interface.load(audio_library)

#src =
#dst =

main.send(config, src, dst, gain=1.0, extra_silence=0.0)

Add electrical engineering description

It's amazing what your have done. Thanks for it.
I still need to have an some detail about electronic schematics which lead to the code and also dependency schematic between python classes.
It will be very didactical to have a description from scratch to code, leading by circuit design documentation.

Once more, thanks for what you have already done.

feature suggestion - boost microphone level

Hi,
Your project works well. However for microphone/speaker transmission, I need to set the speaker very loud and stick my microphone really close to the speaker ( otherwise I have the "too weak signal" during calibration ).

This seems to be because my mic level is quite low ( I'm observing that also when I do recordings on Audacity for example ). I have never been able to fix that - my "Mic level" is correctly set at 100% in the OS - I'm on Windows 10 btw.

I was thinking that it could be useful to have a way to amplify the received signal.
Maybe with a multiplication constant that we can set with env variable, like we do for BITRATE ?

If you prefer to not implement it, please just point me where I should add this constant in your source code myself.
Thanks

Big frequency errors

for some reason i'm getting frequency errors of -65.546 ppm and higher. consequently the demodulation fails when im using BITRATE=8, and at BITRATE=1 even decoding fails. it says good signal during calibration. i'm using windows 7

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.