romanz / amodem

Audio MODEM Communication Library in Python
Other
965 stars 121 forks source link

Big frequency errors #23

Closed norill closed 8 years ago

norill commented 8 years ago

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

romanz commented 8 years ago

Could you please post the logs of the receiver? Run it with -vv flag for most verbose logging.

norill commented 8 years ago
2016-09-08 22:39:40,421 DEBUG      Audio OFDM MODEM v1.13: 8.0 kb/s (16-QAM x 2 carriers) Fs=8.0 kHz
            __main__.py:219
2016-09-08 22:39:40,421 INFO       PortAudio V19-devel (built Sep  8 2016 20:56:08) loaded
            audio.py:19
2016-09-08 22:39:40,506 DEBUG      AsyncReader thread started
            async.py:23
2016-09-08 22:39:40,509 DEBUG      Skipping 0.100 seconds
            main.py:44
2016-09-08 22:39:41,115 INFO       Waiting for carrier tone: 1.0 kHz
            main.py:51
2016-09-08 22:39:46,740 INFO       Carrier detected at ~5620.0 ms @ 1.0 kHz
            detect.py:58
2016-09-08 22:39:46,740 DEBUG      Buffered 1000 ms of audio
            detect.py:60
2016-09-08 22:39:46,769 INFO       Carrier coherence: 97.641%
            detect.py:93
2016-09-08 22:39:46,769 DEBUG      Carrier starts at 5619.000 ms
            detect.py:70
2016-09-08 22:39:46,769 INFO       Carrier symbols amplitude : 0.096
            detect.py:104
2016-09-08 22:39:46,779 INFO       Frequency error: -17.801 ppm
            detect.py:114
2016-09-08 22:39:46,779 DEBUG      Frequency correction: 17.802 ppm
            main.py:55
2016-09-08 22:39:46,779 DEBUG      Gain correction: 10.415
            main.py:58
2016-09-08 22:39:46,829 DEBUG      Prefix OK
            recv.py:49
2016-09-08 22:39:47,288 DEBUG        1.0 kHz: SNR = 13.19 dB
            recv.py:93
2016-09-08 22:39:47,288 DEBUG        2.0 kHz: SNR =  7.06 dB
            recv.py:93
2016-09-08 22:39:47,288 INFO       Starting demodulation
            recv.py:127
2016-09-08 22:39:47,338 WARNING    Invalid checksum: ee7f188a != ae15727
            framing.py:29
2016-09-08 22:39:47,338 ERROR      Decoding failed
            main.py:64
Traceback (most recent call last):
  File "C:\Program Files\Python27\lib\site-packages\amodem\main.py", line 61, in recv
    receiver.run(sampler, gain=1.0/amplitude, output=dst)
  File "C:\Program Files\Python27\lib\site-packages\amodem\recv.py", line 167, in run
    for frame in framing.decode_frames(bitstream):
  File "C:\Program Files\Python27\lib\site-packages\amodem\framing.py", line 120, in decode_frames
    for frame in framer.decode(_to_bytes(bits)):
  File "C:\Program Files\Python27\lib\site-packages\amodem\framing.py", line 57, in decode
    block = self.checksum.decode(frame)
  File "C:\Program Files\Python27\lib\site-packages\amodem\framing.py", line 30, in decode
    raise ValueError('Invalid checksum')
ValueError: Invalid checksum
2016-09-08 22:39:47,338 DEBUG      Demodulated 0.255 kB @ 0.051 seconds (20.0% realtime)
            recv.py:177
2016-09-08 22:39:47,338 INFO       Received 0.000 kB @ 0.051 seconds = 0.000 kB/s
            recv.py:181
2016-09-08 22:39:47,418 DEBUG      AsyncReader thread stopped (read 110400 bytes)
            async.py:28
2016-09-08 22:39:47,438 DEBUG      Finished I/O
            __main__.py:246
romanz commented 8 years ago

The SNR indeed seems quite low...

Could you dump the received audio using --dump flag, and send it to me? BTW, do you use a microphone & speaker on the same computer, or on separate computers?

norill commented 8 years ago

same computer dmp.gz

norill commented 8 years ago

on different computers i get either too noisy or too strong during calibration

romanz commented 8 years ago

The waveform and the spectrogram of the recorded audio:

$ python scripts/plot.py /tmp/dmp

figure_waveform

Looking on the leading tone, it seems that the background noise is quite dominant and there is a bit of echo (note the trailing oscillations after the tone is over): figure_tone

It seems that this causes the frequency drift estimator to estimate the wrong frequency drift and the rest of demodulation pipeline fails to compensate for it later.

romanz commented 8 years ago

Unfortunately, I think that this SNR won't allow reliable transmission in 8kb/s bitrate. Could you please run and post the calibration results using BITRATE=1? (the lowest bitrate possible) Here are my results: https://asciinema.org/a/25065

By the way, could you put the microphone closer to the speaker? I can also recommend using a simple audio cable to connect the computers: cable This should improve significantly the SNR, so you could use higher bitrates...

norill commented 8 years ago

same computer, mic at 100%:

C:\>amodem recv -vvc
2016-09-09 16:45:37,497 DEBUG      Audio OFDM MODEM v1.13: 1.0 kb/s (2-QAM x 1 carriers) Fs=8.0 kHz
             __main__.py:219
2016-09-09 16:45:37,502 INFO       PortAudio V19-devel (built Sep  8 2016 20:56:08) loaded
             audio.py:19
2016-09-09 16:45:37,584 DEBUG      AsyncReader thread started
             async.py:23
2016-09-09 16:45:37,584 INFO       verbose: 2
             calib.py:132
2016-09-09 16:45:38,200 INFO         2000 Hz: too weak signal     total=0.0087, rms=0.0009, coherency=0.1082, peak=0.0153
             calib.py:138
2016-09-09 16:45:38,400 INFO         2000 Hz: too weak signal     total=0.0089, rms=0.0010, coherency=0.1106, peak=0.0157
             calib.py:138
2016-09-09 16:45:38,594 INFO         2000 Hz: too weak signal     total=0.0085, rms=0.0010, coherency=0.1118, peak=0.0161
             calib.py:138
2016-09-09 16:45:38,799 INFO         2000 Hz: too weak signal     total=0.0081, rms=0.0011, coherency=0.1347, peak=0.0157
             calib.py:138
2016-09-09 16:45:39,000 INFO         2000 Hz: too weak signal     total=0.0081, rms=0.0010, coherency=0.1267, peak=0.0156
             calib.py:138
2016-09-09 16:45:39,200 INFO         2000 Hz: too weak signal     total=0.0087, rms=0.0010, coherency=0.1130, peak=0.0165
             calib.py:138
2016-09-09 16:45:39,394 INFO         2000 Hz: too weak signal     total=0.0085, rms=0.0010, coherency=0.1151, peak=0.0190
             calib.py:138
2016-09-09 16:45:39,594 INFO         2000 Hz: too weak signal     total=0.0084, rms=0.0010, coherency=0.1204, peak=0.0166
             calib.py:138
2016-09-09 16:45:39,799 INFO         2000 Hz: too weak signal     total=0.0092, rms=0.0010, coherency=0.1070, peak=0.0164
             calib.py:138
2016-09-09 16:45:40,000 INFO         2000 Hz: too weak signal     total=0.0093, rms=0.0010, coherency=0.1094, peak=0.0163
             calib.py:138
2016-09-09 16:45:40,200 INFO         2000 Hz: too weak signal     total=0.0087, rms=0.0010, coherency=0.1193, peak=0.0180
             calib.py:138
2016-09-09 16:45:40,394 INFO         2000 Hz: too weak signal     total=0.0079, rms=0.0013, coherency=0.1654, peak=0.0141
             calib.py:138
2016-09-09 16:45:40,594 INFO         2000 Hz: too weak signal     total=0.0090, rms=0.0039, coherency=0.4315, peak=0.0194
             calib.py:138
2016-09-09 16:45:40,793 INFO         2000 Hz: too weak signal     total=0.0100, rms=0.0062, coherency=0.6146, peak=0.0196
             calib.py:138
2016-09-09 16:45:41,000 INFO         2000 Hz: too weak signal     total=0.0169, rms=0.0145, coherency=0.8579, peak=0.0316
             calib.py:138
2016-09-09 16:45:41,198 INFO         2000 Hz: too weak signal     total=0.0253, rms=0.0236, coherency=0.9322, peak=0.0399
             calib.py:138
2016-09-09 16:45:41,400 INFO         2000 Hz: too weak signal     total=0.0287, rms=0.0272, coherency=0.9485, peak=0.0411
             calib.py:138
2016-09-09 16:45:41,599 INFO         2000 Hz: too weak signal     total=0.0320, rms=0.0306, coherency=0.9585, peak=0.0462
             calib.py:138
2016-09-09 16:45:41,799 INFO         2000 Hz: too weak signal     total=0.0375, rms=0.0365, coherency=0.9713, peak=0.0538
             calib.py:138
2016-09-09 16:45:41,999 INFO         2000 Hz: too weak signal     total=0.0456, rms=0.0449, coherency=0.9846, peak=0.0575
             calib.py:138
2016-09-09 16:45:42,198 INFO         2000 Hz: too weak signal     total=0.0515, rms=0.0508, coherency=0.9865, peak=0.0639
             calib.py:138
2016-09-09 16:45:42,398 INFO         2000 Hz: too weak signal     total=0.0542, rms=0.0535, coherency=0.9882, peak=0.0692
             calib.py:138
2016-09-09 16:45:42,598 INFO         2000 Hz: too weak signal     total=0.0653, rms=0.0647, coherency=0.9907, peak=0.0768
             calib.py:138
2016-09-09 16:45:42,799 INFO         2000 Hz: too weak signal     total=0.0726, rms=0.0721, coherency=0.9924, peak=0.0841
             calib.py:138
2016-09-09 16:45:42,999 INFO         2000 Hz: too weak signal     total=0.0855, rms=0.0851, coherency=0.9950, peak=0.1030
             calib.py:138
2016-09-09 16:45:43,198 INFO         2000 Hz: too weak signal     total=0.0936, rms=0.0930, coherency=0.9943, peak=0.1060
             calib.py:138
2016-09-09 16:45:43,392 INFO         2000 Hz: too weak signal     total=0.0934, rms=0.0929, coherency=0.9949, peak=0.1034
             calib.py:138
2016-09-09 16:45:43,592 INFO         2000 Hz: too weak signal     total=0.0933, rms=0.0930, coherency=0.9960, peak=0.1021
             calib.py:138
2016-09-09 16:45:43,799 INFO         2000 Hz: good signal         total=0.1018, rms=0.1014, coherency=0.9965, peak=0.1139
             calib.py:138
2016-09-09 16:45:43,999 INFO         2000 Hz: good signal         total=0.1044, rms=0.1040, coherency=0.9965, peak=0.1136
             calib.py:138
2016-09-09 16:45:44,198 INFO         2000 Hz: good signal         total=0.1045, rms=0.1041, coherency=0.9961, peak=0.1127
             calib.py:138
2016-09-09 16:45:44,398 INFO         2000 Hz: good signal         total=0.1165, rms=0.1161, coherency=0.9973, peak=0.1252
             calib.py:138
2016-09-09 16:45:44,598 INFO         2000 Hz: good signal         total=0.1170, rms=0.1167, coherency=0.9976, peak=0.1257
             calib.py:138
2016-09-09 16:45:44,799 INFO         2000 Hz: good signal         total=0.1170, rms=0.1167, coherency=0.9977, peak=0.1256
             calib.py:138
2016-09-09 16:45:44,999 INFO         2000 Hz: good signal         total=0.1170, rms=0.1167, coherency=0.9976, peak=0.1236
             calib.py:138
2016-09-09 16:45:45,193 INFO         2000 Hz: good signal         total=0.1286, rms=0.1283, coherency=0.9979, peak=0.1390
             calib.py:138
2016-09-09 16:45:45,394 INFO         2000 Hz: good signal         total=0.1470, rms=0.1468, coherency=0.9984, peak=0.1543
             calib.py:138
2016-09-09 16:45:45,598 INFO         2000 Hz: good signal         total=0.1479, rms=0.1476, coherency=0.9981, peak=0.1562
             calib.py:138
2016-09-09 16:45:45,792 INFO         2000 Hz: good signal         total=0.1590, rms=0.1588, coherency=0.9985, peak=0.1709
             calib.py:138
2016-09-09 16:45:45,993 INFO         2000 Hz: good signal         total=0.1658, rms=0.1656, coherency=0.9987, peak=0.1729
             calib.py:138
2016-09-09 16:45:46,193 INFO         2000 Hz: good signal         total=0.1681, rms=0.1679, coherency=0.9988, peak=0.1895
             calib.py:138
2016-09-09 16:45:46,394 INFO         2000 Hz: good signal         total=0.1896, rms=0.1894, coherency=0.9992, peak=0.2101
             calib.py:138
2016-09-09 16:45:46,595 INFO         2000 Hz: good signal         total=0.2066, rms=0.2064, coherency=0.9992, peak=0.2085
             calib.py:138
2016-09-09 16:45:46,796 INFO         2000 Hz: good signal         total=0.2118, rms=0.2116, coherency=0.9992, peak=0.2368
             calib.py:138
2016-09-09 16:45:46,999 INFO         2000 Hz: good signal         total=0.2340, rms=0.2338, coherency=0.9993, peak=0.2369
             calib.py:138
2016-09-09 16:45:47,198 INFO         2000 Hz: good signal         total=0.2555, rms=0.2553, coherency=0.9994, peak=0.2659
             calib.py:138
2016-09-09 16:45:47,398 INFO         2000 Hz: good signal         total=0.2628, rms=0.2626, coherency=0.9995, peak=0.2599
             calib.py:138
2016-09-09 16:45:47,598 INFO         2000 Hz: good signal         total=0.2630, rms=0.2629, coherency=0.9995, peak=0.2600
             calib.py:138
2016-09-09 16:45:47,799 INFO         2000 Hz: good signal         total=0.2937, rms=0.2936, coherency=0.9996, peak=0.2972
             calib.py:138
2016-09-09 16:45:47,993 INFO         2000 Hz: good signal         total=0.2955, rms=0.2954, coherency=0.9996, peak=0.2902
             calib.py:138
2016-09-09 16:45:48,193 INFO         2000 Hz: good signal         total=0.3121, rms=0.3120, coherency=0.9996, peak=0.3291
             calib.py:138
2016-09-09 16:45:48,398 INFO         2000 Hz: good signal         total=0.3318, rms=0.3317, coherency=0.9996, peak=0.3264
             calib.py:138
2016-09-09 16:45:48,595 INFO         2000 Hz: good signal         total=0.3582, rms=0.3581, coherency=0.9997, peak=0.3692
             calib.py:138
2016-09-09 16:45:48,799 INFO         2000 Hz: good signal         total=0.4033, rms=0.4032, coherency=0.9997, peak=0.4105
             calib.py:138
2016-09-09 16:45:48,994 INFO         2000 Hz: good signal         total=0.4230, rms=0.4229, coherency=0.9998, peak=0.4480
             calib.py:138
2016-09-09 16:45:49,197 INFO         2000 Hz: good signal         total=0.4491, rms=0.4490, coherency=0.9998, peak=0.4238
             calib.py:138
2016-09-09 16:45:49,394 INFO         2000 Hz: good signal         total=0.4741, rms=0.4740, coherency=0.9998, peak=0.4797
             calib.py:138
2016-09-09 16:45:49,598 INFO         2000 Hz: good signal         total=0.4909, rms=0.4908, coherency=0.9998, peak=0.4590
             calib.py:138
2016-09-09 16:45:49,795 INFO         2000 Hz: good signal         total=0.5157, rms=0.5156, coherency=0.9998, peak=0.5186
             calib.py:138
2016-09-09 16:45:49,999 INFO         2000 Hz: good signal         total=0.5404, rms=0.5403, coherency=0.9998, peak=0.5758
             calib.py:138
2016-09-09 16:45:50,198 INFO         2000 Hz: good signal         total=0.5891, rms=0.5891, coherency=0.9999, peak=0.5478
             calib.py:138
2016-09-09 16:45:50,398 INFO         2000 Hz: good signal         total=0.5966, rms=0.5965, coherency=0.9998, peak=0.6254
             calib.py:138
2016-09-09 16:45:50,598 INFO         2000 Hz: good signal         total=0.6365, rms=0.6364, coherency=0.9999, peak=0.5810
             calib.py:138
2016-09-09 16:45:50,795 INFO         2000 Hz: good signal         total=0.6616, rms=0.6615, coherency=0.9999, peak=0.6610
             calib.py:138
2016-09-09 16:45:50,996 INFO         2000 Hz: good signal         total=0.6892, rms=0.6892, coherency=0.9999, peak=0.6243
             calib.py:138
2016-09-09 16:45:51,194 INFO         2000 Hz: good signal         total=0.7458, rms=0.7457, coherency=0.9999, peak=0.7073
             calib.py:138
2016-09-09 16:45:51,398 INFO         2000 Hz: good signal         total=0.7656, rms=0.7655, coherency=0.9999, peak=0.6876
             calib.py:138
2016-09-09 16:45:51,598 INFO         2000 Hz: good signal         total=0.7597, rms=0.7596, coherency=0.9999, peak=0.6838
             calib.py:138
2016-09-09 16:45:51,792 INFO         2000 Hz: good signal         total=0.7552, rms=0.7551, coherency=0.9999, peak=0.6790
             calib.py:138
2016-09-09 16:45:51,993 INFO         2000 Hz: good signal         total=0.6154, rms=0.6151, coherency=0.9996, peak=0.6814
             calib.py:138
2016-09-09 16:45:52,198 INFO         2000 Hz: good signal         total=0.2697, rms=0.2695, coherency=0.9992, peak=0.3620
             calib.py:138
2016-09-09 16:45:52,394 INFO         2000 Hz: too weak signal     total=0.0907, rms=0.0903, coherency=0.9957, peak=0.1492
             calib.py:138
2016-09-09 16:45:52,598 INFO         2000 Hz: too weak signal     total=0.0538, rms=0.0531, coherency=0.9861, peak=0.0752
             calib.py:138
2016-09-09 16:45:52,799 INFO         2000 Hz: too weak signal     total=0.0502, rms=0.0493, coherency=0.9830, peak=0.0688
             calib.py:138
2016-09-09 16:45:52,993 INFO         2000 Hz: too weak signal     total=0.0511, rms=0.0502, coherency=0.9833, peak=0.0653
             calib.py:138
2016-09-09 16:45:53,200 INFO         2000 Hz: too weak signal     total=0.0508, rms=0.0500, coherency=0.9845, peak=0.0633
             calib.py:138
2016-09-09 16:45:53,398 INFO         2000 Hz: too weak signal     total=0.0502, rms=0.0496, coherency=0.9878, peak=0.0611
             calib.py:138
2016-09-09 16:45:53,599 INFO         2000 Hz: too weak signal     total=0.0499, rms=0.0493, coherency=0.9874, peak=0.0627
             calib.py:138
2016-09-09 16:45:53,799 INFO         2000 Hz: too weak signal     total=0.0499, rms=0.0493, coherency=0.9876, peak=0.0611
             calib.py:138
2016-09-09 16:45:53,999 INFO         2000 Hz: too weak signal     total=0.0501, rms=0.0494, coherency=0.9864, peak=0.0619
             calib.py:138
2016-09-09 16:45:54,198 INFO         2000 Hz: too weak signal     total=0.0504, rms=0.0496, coherency=0.9847, peak=0.0612
             calib.py:138
2016-09-09 16:45:54,398 INFO         2000 Hz: too weak signal     total=0.0508, rms=0.0499, coherency=0.9840, peak=0.0622
             calib.py:138
2016-09-09 16:45:54,598 INFO         2000 Hz: too weak signal     total=0.0508, rms=0.0500, coherency=0.9850, peak=0.0651
             calib.py:138
2016-09-09 16:45:54,799 INFO         2000 Hz: too weak signal     total=0.0506, rms=0.0499, coherency=0.9859, peak=0.0618
             calib.py:138
2016-09-09 16:45:54,993 INFO         2000 Hz: too weak signal     total=0.0502, rms=0.0496, coherency=0.9883, peak=0.0602
             calib.py:138
2016-09-09 16:45:55,194 INFO         2000 Hz: too weak signal     total=0.0503, rms=0.0497, coherency=0.9874, peak=0.0611
             calib.py:138
2016-09-09 16:45:55,398 INFO         2000 Hz: too weak signal     total=0.0503, rms=0.0496, coherency=0.9865, peak=0.0649
             calib.py:138
2016-09-09 16:45:55,598 INFO         2000 Hz: too weak signal     total=0.0500, rms=0.0493, coherency=0.9856, peak=0.0619
             calib.py:138
2016-09-09 16:45:55,799 INFO         2000 Hz: too weak signal     total=0.0500, rms=0.0490, coherency=0.9789, peak=0.0634
             calib.py:138
2016-09-09 16:45:56,000 INFO         2000 Hz: too weak signal     total=0.0495, rms=0.0487, coherency=0.9849, peak=0.0603
             calib.py:138
2016-09-09 16:45:56,198 INFO         2000 Hz: too weak signal     total=0.0496, rms=0.0488, coherency=0.9851, peak=0.0615
             calib.py:138
2016-09-09 16:45:56,398 INFO         2000 Hz: too weak signal     total=0.0170, rms=0.0147, coherency=0.8628, peak=0.0753
             calib.py:138
2016-09-09 16:45:56,598 INFO         2000 Hz: too weak signal     total=0.0077, rms=0.0009, coherency=0.1221, peak=0.0139
             calib.py:138
2016-09-09 16:45:56,799 INFO         2000 Hz: too weak signal     total=0.0083, rms=0.0011, coherency=0.1267, peak=0.0170
             calib.py:138
2016-09-09 16:45:56,992 DEBUG      AsyncReader thread stopped (read 310400 bytes)
             async.py:28
2016-09-09 16:45:57,009 DEBUG      Finished I/O

different computers, mic at 100%:

C:\>python -m amodem recv -vvc
2016-09-09 16:58:30,388 DEBUG      Audio OFDM MODEM v1.13: 1.0 kb/s (2-QAM x 1 carriers) Fs=8.0 kHz
            __main__.py:219
2016-09-09 16:58:30,388 INFO       PortAudio V19-devel (built Sep  8 2016 20:56:08) loaded
            audio.py:19
2016-09-09 16:58:30,700 DEBUG      AsyncReader thread started
            async.py:23
2016-09-09 16:58:30,700 INFO       verbose: 2
            calib.py:132
2016-09-09 16:58:31,316 INFO         2000 Hz: too noisy signal    total=0.1859, rms=0.0806, coherency=0.4339, peak=0.2989
            calib.py:138
2016-09-09 16:58:31,506 INFO         2000 Hz: too noisy signal    total=0.1927, rms=0.0809, coherency=0.4199, peak=0.2930
            calib.py:138
2016-09-09 16:58:31,717 INFO         2000 Hz: too noisy signal    total=0.1945, rms=0.0803, coherency=0.4130, peak=0.3716
            calib.py:138
2016-09-09 16:58:31,917 INFO         2000 Hz: too noisy signal    total=0.1953, rms=0.0804, coherency=0.4118, peak=0.3043
            calib.py:138
2016-09-09 16:58:32,117 INFO         2000 Hz: too noisy signal    total=0.1882, rms=0.0809, coherency=0.4301, peak=0.3279
            calib.py:138
2016-09-09 16:58:32,316 INFO         2000 Hz: too noisy signal    total=0.1844, rms=0.0815, coherency=0.4423, peak=0.3303
            calib.py:138
2016-09-09 16:58:32,516 INFO         2000 Hz: too noisy signal    total=0.1972, rms=0.0824, coherency=0.4178, peak=0.3257
            calib.py:138
2016-09-09 16:58:32,707 INFO         2000 Hz: too noisy signal    total=0.2032, rms=0.0821, coherency=0.4039, peak=0.3752
            calib.py:138
2016-09-09 16:58:32,917 INFO         2000 Hz: too noisy signal    total=0.1992, rms=0.0814, coherency=0.4088, peak=0.3538
            calib.py:138
2016-09-09 16:58:33,107 INFO         2000 Hz: too noisy signal    total=0.2046, rms=0.0815, coherency=0.3982, peak=0.3617
            calib.py:138
2016-09-09 16:58:33,316 INFO         2000 Hz: too noisy signal    total=0.2470, rms=0.1696, coherency=0.6866, peak=0.4520
            calib.py:138
2016-09-09 16:58:33,506 INFO         2000 Hz: too noisy signal    total=0.2761, rms=0.2053, coherency=0.7434, peak=0.4454
            calib.py:138
2016-09-09 16:58:33,717 INFO         2000 Hz: too noisy signal    total=0.2768, rms=0.2115, coherency=0.7642, peak=0.4326
            calib.py:138
2016-09-09 16:58:33,917 INFO         2000 Hz: too noisy signal    total=0.3136, rms=0.2602, coherency=0.8295, peak=0.4422
            calib.py:138
2016-09-09 16:58:34,117 INFO         2000 Hz: too noisy signal    total=0.4035, rms=0.3624, coherency=0.8980, peak=0.5609
            calib.py:138
2016-09-09 16:58:34,306 INFO         2000 Hz: too noisy signal    total=0.4809, rms=0.4463, coherency=0.9281, peak=0.6540
            calib.py:138
2016-09-09 16:58:34,516 INFO         2000 Hz: too noisy signal    total=0.5618, rms=0.5324, coherency=0.9476, peak=0.6820
            calib.py:138
2016-09-09 16:58:34,707 INFO         2000 Hz: too noisy signal    total=0.7931, rms=0.7722, coherency=0.9737, peak=0.9927
            calib.py:138
2016-09-09 16:58:34,927 INFO         2000 Hz: too strong signal   total=1.1473, rms=1.1432, coherency=0.9964, peak=1.0244
            calib.py:138
2016-09-09 16:58:35,107 INFO         2000 Hz: too strong signal   total=1.1955, rms=1.1939, coherency=0.9987, peak=1.0244
            calib.py:138
2016-09-09 16:58:35,316 INFO         2000 Hz: too strong signal   total=1.1997, rms=1.1989, coherency=0.9993, peak=1.0242
            calib.py:138
2016-09-09 16:58:35,516 INFO         2000 Hz: too strong signal   total=1.1878, rms=1.1872, coherency=0.9995, peak=1.0244
            calib.py:138
2016-09-09 16:58:35,726 INFO         2000 Hz: too strong signal   total=1.1727, rms=1.1722, coherency=0.9996, peak=1.0245
            calib.py:138
2016-09-09 16:58:35,907 INFO         2000 Hz: too strong signal   total=1.1591, rms=1.1586, coherency=0.9996, peak=1.0245
            calib.py:138
2016-09-09 16:58:36,127 INFO         2000 Hz: too strong signal   total=1.1402, rms=1.1399, coherency=0.9997, peak=1.0240
            calib.py:138
2016-09-09 16:58:36,316 INFO         2000 Hz: too strong signal   total=1.1234, rms=1.1231, coherency=0.9998, peak=1.0246
            calib.py:138
2016-09-09 16:58:36,516 INFO         2000 Hz: too strong signal   total=1.1087, rms=1.1085, coherency=0.9998, peak=1.0250
            calib.py:138
2016-09-09 16:58:36,707 INFO         2000 Hz: too strong signal   total=1.0935, rms=1.0934, coherency=0.9998, peak=1.0252
            calib.py:138
2016-09-09 16:58:36,927 INFO         2000 Hz: too strong signal   total=1.0811, rms=1.0810, coherency=0.9998, peak=1.0257
            calib.py:138
2016-09-09 16:58:37,117 INFO         2000 Hz: too strong signal   total=1.0703, rms=1.0702, coherency=0.9999, peak=1.0256
            calib.py:138
2016-09-09 16:58:37,316 INFO         2000 Hz: too strong signal   total=1.0588, rms=1.0587, coherency=0.9999, peak=1.0260
            calib.py:138
2016-09-09 16:58:37,516 INFO         2000 Hz: too strong signal   total=1.0476, rms=1.0475, coherency=0.9999, peak=1.0262
            calib.py:138
2016-09-09 16:58:37,717 INFO         2000 Hz: too strong signal   total=1.0410, rms=1.0409, coherency=0.9999, peak=1.0266
            calib.py:138
2016-09-09 16:58:37,917 INFO         2000 Hz: too strong signal   total=1.0368, rms=1.0367, coherency=0.9999, peak=1.0266
            calib.py:138
2016-09-09 16:58:38,127 INFO         2000 Hz: too strong signal   total=1.0320, rms=1.0319, coherency=0.9999, peak=1.0271
            calib.py:138
2016-09-09 16:58:38,306 INFO         2000 Hz: too strong signal   total=1.0290, rms=1.0289, coherency=0.9999, peak=1.0273
            calib.py:138
2016-09-09 16:58:38,516 INFO         2000 Hz: too strong signal   total=1.0267, rms=1.0266, coherency=0.9999, peak=1.0269
            calib.py:138
2016-09-09 16:58:38,717 INFO         2000 Hz: too strong signal   total=1.0257, rms=1.0256, coherency=0.9999, peak=1.0266
            calib.py:138
2016-09-09 16:58:38,927 INFO         2000 Hz: too strong signal   total=1.0251, rms=1.0250, coherency=0.9999, peak=1.0268
            calib.py:138
2016-09-09 16:58:39,107 INFO         2000 Hz: too strong signal   total=1.0269, rms=1.0267, coherency=0.9998, peak=1.0261
            calib.py:138
2016-09-09 16:58:39,326 INFO         2000 Hz: too strong signal   total=1.0302, rms=1.0298, coherency=0.9996, peak=1.0248
            calib.py:138
2016-09-09 16:58:39,516 INFO         2000 Hz: too strong signal   total=0.9894, rms=0.9850, coherency=0.9956, peak=1.0245
            calib.py:138
2016-09-09 16:58:39,717 INFO         2000 Hz: too noisy signal    total=0.3675, rms=0.3223, coherency=0.8771, peak=0.7486
            calib.py:138
2016-09-09 16:58:39,907 INFO         2000 Hz: too noisy signal    total=0.1729, rms=0.0215, coherency=0.1246, peak=0.3493
            calib.py:138
2016-09-09 16:58:40,117 INFO         2000 Hz: too noisy signal    total=0.1647, rms=0.0156, coherency=0.0948, peak=0.2633
            calib.py:138
2016-09-09 16:58:40,316 INFO         2000 Hz: too noisy signal    total=0.1678, rms=0.0164, coherency=0.0975, peak=0.2821
            calib.py:138
2016-09-09 16:58:40,526 INFO         2000 Hz: too noisy signal    total=0.1881, rms=0.0169, coherency=0.0900, peak=0.3024
            calib.py:138
2016-09-09 16:58:40,717 INFO         2000 Hz: too noisy signal    total=0.1750, rms=0.0157, coherency=0.0896, peak=0.3090
            calib.py:138
2016-09-09 16:58:40,917 INFO         2000 Hz: too noisy signal    total=0.1811, rms=0.0174, coherency=0.0962, peak=0.2897
            calib.py:138
2016-09-09 16:58:41,107 INFO         2000 Hz: too noisy signal    total=0.1980, rms=0.0179, coherency=0.0906, peak=0.3317
            calib.py:138
2016-09-09 16:58:41,397 DEBUG      AsyncReader thread stopped (read 171200 bytes)
            async.py:28

different computers, mic at 30%:


C:\>python -m amodem recv -vvc
2016-09-09 17:09:53,085 DEBUG      Audio OFDM MODEM v1.13: 1.0 kb/s (2-QAM x 1 carriers) Fs=8.0 kHz
            __main__.py:219
2016-09-09 17:09:53,095 INFO       PortAudio V19-devel (built Sep  8 2016 20:56:08) loaded
            audio.py:19
2016-09-09 17:09:53,286 DEBUG      AsyncReader thread started
            async.py:23
2016-09-09 17:09:53,286 INFO       verbose: 2
            calib.py:132
2016-09-09 17:09:53,905 INFO         2000 Hz: too weak signal     total=0.0507, rms=0.0040, coherency=0.0799, peak=0.0719
            calib.py:138
2016-09-09 17:09:54,105 INFO         2000 Hz: too weak signal     total=0.0532, rms=0.0042, coherency=0.0799, peak=0.0744
            calib.py:138
2016-09-09 17:09:54,315 INFO         2000 Hz: too weak signal     total=0.0534, rms=0.0042, coherency=0.0788, peak=0.0745
            calib.py:138
2016-09-09 17:09:54,506 INFO         2000 Hz: too weak signal     total=0.0535, rms=0.0042, coherency=0.0793, peak=0.0725
            calib.py:138
2016-09-09 17:09:54,716 INFO         2000 Hz: too weak signal     total=0.0551, rms=0.0044, coherency=0.0790, peak=0.0761
            calib.py:138
2016-09-09 17:09:54,905 INFO         2000 Hz: too weak signal     total=0.0544, rms=0.0044, coherency=0.0811, peak=0.0747
            calib.py:138
2016-09-09 17:09:55,125 INFO         2000 Hz: too weak signal     total=0.0553, rms=0.0046, coherency=0.0832, peak=0.0732
            calib.py:138
2016-09-09 17:09:55,305 INFO         2000 Hz: too weak signal     total=0.0551, rms=0.0048, coherency=0.0865, peak=0.0774
            calib.py:138
2016-09-09 17:09:55,516 INFO         2000 Hz: too weak signal     total=0.0559, rms=0.0129, coherency=0.2304, peak=0.0865
            calib.py:138
2016-09-09 17:09:55,706 INFO         2000 Hz: too weak signal     total=0.0594, rms=0.0200, coherency=0.3370, peak=0.0923
            calib.py:138
2016-09-09 17:09:55,915 INFO         2000 Hz: too weak signal     total=0.0627, rms=0.0303, coherency=0.4827, peak=0.1050
            calib.py:138
2016-09-09 17:09:56,105 INFO         2000 Hz: too weak signal     total=0.0772, rms=0.0540, coherency=0.6992, peak=0.1310
            calib.py:138
2016-09-09 17:09:56,315 INFO         2000 Hz: too weak signal     total=0.0923, rms=0.0745, coherency=0.8070, peak=0.1526
            calib.py:138
2016-09-09 17:09:56,506 INFO         2000 Hz: too noisy signal    total=0.1098, rms=0.0958, coherency=0.8725, peak=0.1763
            calib.py:138
2016-09-09 17:09:56,716 INFO         2000 Hz: too noisy signal    total=0.1300, rms=0.1182, coherency=0.9097, peak=0.1873
            calib.py:138
2016-09-09 17:09:56,905 INFO         2000 Hz: too noisy signal    total=0.1582, rms=0.1485, coherency=0.9385, peak=0.2281
            calib.py:138
2016-09-09 17:09:57,115 INFO         2000 Hz: too noisy signal    total=0.1774, rms=0.1691, coherency=0.9532, peak=0.2556
            calib.py:138
2016-09-09 17:09:57,305 INFO         2000 Hz: too noisy signal    total=0.2533, rms=0.2471, coherency=0.9758, peak=0.3537
            calib.py:138
2016-09-09 17:09:57,526 INFO         2000 Hz: too noisy signal    total=0.3367, rms=0.3325, coherency=0.9875, peak=0.4263
            calib.py:138
2016-09-09 17:09:57,706 INFO         2000 Hz: too noisy signal    total=0.3697, rms=0.3655, coherency=0.9887, peak=0.4675
            calib.py:138
2016-09-09 17:09:57,915 INFO         2000 Hz: good signal         total=0.4350, rms=0.4317, coherency=0.9924, peak=0.5140
            calib.py:138
2016-09-09 17:09:58,105 INFO         2000 Hz: good signal         total=0.4987, rms=0.4958, coherency=0.9942, peak=0.5938
            calib.py:138
2016-09-09 17:09:58,315 INFO         2000 Hz: good signal         total=0.5591, rms=0.5563, coherency=0.9950, peak=0.7127
            calib.py:138
2016-09-09 17:09:58,506 INFO         2000 Hz: good signal         total=0.6625, rms=0.6602, coherency=0.9965, peak=0.7957
            calib.py:138
2016-09-09 17:09:58,716 INFO         2000 Hz: good signal         total=0.7486, rms=0.7465, coherency=0.9973, peak=0.8888
            calib.py:138
2016-09-09 17:09:58,905 INFO         2000 Hz: good signal         total=0.8277, rms=0.8260, coherency=0.9979, peak=0.8964
            calib.py:138
2016-09-09 17:09:59,105 INFO         2000 Hz: too strong signal   total=0.9156, rms=0.9138, coherency=0.9981, peak=1.0127
            calib.py:138
2016-09-09 17:09:59,305 INFO         2000 Hz: too strong signal   total=1.0085, rms=1.0077, coherency=0.9992, peak=1.0246
            calib.py:138
2016-09-09 17:09:59,516 INFO         2000 Hz: too strong signal   total=1.0342, rms=1.0338, coherency=0.9996, peak=1.0248
            calib.py:138
2016-09-09 17:09:59,706 INFO         2000 Hz: too strong signal   total=1.0402, rms=1.0399, coherency=0.9997, peak=1.0247
            calib.py:138
2016-09-09 17:09:59,915 INFO         2000 Hz: too strong signal   total=1.0427, rms=1.0424, coherency=0.9997, peak=1.0245
            calib.py:138
2016-09-09 17:10:00,105 INFO         2000 Hz: too strong signal   total=1.0461, rms=1.0458, coherency=0.9997, peak=1.0245
            calib.py:138
2016-09-09 17:10:00,305 INFO         2000 Hz: too strong signal   total=1.0495, rms=1.0492, coherency=0.9997, peak=1.0245
            calib.py:138
2016-09-09 17:10:00,506 INFO         2000 Hz: too strong signal   total=1.0551, rms=1.0549, coherency=0.9998, peak=1.0247
            calib.py:138
2016-09-09 17:10:00,716 INFO         2000 Hz: too strong signal   total=1.0615, rms=1.0613, coherency=0.9998, peak=1.0249
            calib.py:138
2016-09-09 17:10:00,905 INFO         2000 Hz: too strong signal   total=1.0706, rms=1.0705, coherency=0.9998, peak=1.0248
            calib.py:138
2016-09-09 17:10:01,115 INFO         2000 Hz: too strong signal   total=1.0786, rms=1.0784, coherency=0.9998, peak=1.0249
            calib.py:138
2016-09-09 17:10:01,305 INFO         2000 Hz: too strong signal   total=1.0895, rms=1.0893, coherency=0.9999, peak=1.0250
            calib.py:138
2016-09-09 17:10:01,516 INFO         2000 Hz: too strong signal   total=1.0982, rms=1.0981, coherency=0.9999, peak=1.0249
            calib.py:138
2016-09-09 17:10:01,696 INFO         2000 Hz: too strong signal   total=1.1062, rms=1.1061, coherency=0.9999, peak=1.0249
            calib.py:138
2016-09-09 17:10:01,915 INFO         2000 Hz: too strong signal   total=1.1166, rms=1.1165, coherency=0.9999, peak=1.0250
            calib.py:138
2016-09-09 17:10:02,105 INFO         2000 Hz: too strong signal   total=1.1260, rms=1.1259, coherency=0.9999, peak=1.0252
            calib.py:138
2016-09-09 17:10:02,305 INFO         2000 Hz: too strong signal   total=1.1334, rms=1.1334, coherency=0.9999, peak=1.0251
            calib.py:138
2016-09-09 17:10:02,506 INFO         2000 Hz: too strong signal   total=1.1412, rms=1.1411, coherency=0.9999, peak=1.0250
            calib.py:138
2016-09-09 17:10:02,716 INFO         2000 Hz: too strong signal   total=1.0210, rms=1.0202, coherency=0.9992, peak=1.0244
            calib.py:138
2016-09-09 17:10:02,905 INFO         2000 Hz: too noisy signal    total=0.3217, rms=0.3172, coherency=0.9859, peak=0.6558
            calib.py:138
2016-09-09 17:10:03,115 INFO         2000 Hz: too weak signal     total=0.0531, rms=0.0045, coherency=0.0850, peak=0.0770
            calib.py:138
2016-09-09 17:10:03,305 INFO         2000 Hz: too weak signal     total=0.0547, rms=0.0043, coherency=0.0785, peak=0.0728
            calib.py:138
2016-09-09 17:10:03,506 INFO         2000 Hz: too weak signal     total=0.0561, rms=0.0045, coherency=0.0811, peak=0.0804
            calib.py:138
2016-09-09 17:10:03,706 INFO         2000 Hz: too weak signal     total=0.0544, rms=0.0044, coherency=0.0801, peak=0.0772
            calib.py:138
2016-09-09 17:10:03,915 INFO         2000 Hz: too weak signal     total=0.0546, rms=0.0043, coherency=0.0794, peak=0.0720
            calib.py:138
2016-09-09 17:10:04,105 INFO         2000 Hz: too weak signal     total=0.0540, rms=0.0044, coherency=0.0822, peak=0.0757
            calib.py:138
2016-09-09 17:10:04,315 INFO         2000 Hz: too weak signal     total=0.0541, rms=0.0045, coherency=0.0824, peak=0.0714
            calib.py:138
2016-09-09 17:10:04,506 INFO         2000 Hz: too weak signal     total=0.0547, rms=0.0043, coherency=0.0788, peak=0.0711
            calib.py:138
2016-09-09 17:10:04,716 INFO         2000 Hz: too weak signal     total=0.0548, rms=0.0044, coherency=0.0804, peak=0.0763
            calib.py:138
2016-09-09 17:10:04,895 INFO         2000 Hz: too weak signal     total=0.0562, rms=0.0046, coherency=0.0817, peak=0.0746
            calib.py:138
2016-09-09 17:10:05,115 INFO         2000 Hz: too weak signal     total=0.0551, rms=0.0044, coherency=0.0805, peak=0.0748
            calib.py:138
2016-09-09 17:10:05,395 DEBUG      AsyncReader thread stopped (read 193600 bytes)
            async.py:28
2016-09-09 17:10:05,415 DEBUG      Finished I/O

microphone right next to the speaker in every case. i couldn't find a cable like that in the house

norill commented 8 years ago

how should the spectrogram for high SNR look like? are there any methods that would make it work for low SNR at even further reduced bitrate?

romanz commented 8 years ago

An example for good SNR & almost no echo: figure_good_snr

romanz commented 8 years ago

There is a "hack" that you could may try though... Note that when you ran 1kbps calibration, you got almost perfect coherency (very close to 1.0) even when the signal was "too strong". There is a nice mathematical coincidence that allows for that (only for 1 kpbs bitrate in this MODEM), so I'd suggest you to try and do a transmission after the calibration shows high coherency (>0.999), "ignoring" the fact that input signal is saturated (e.g. "too strong").

romanz commented 8 years ago

Unfortunately, I wasn't developing this MODEM to be resilient to low SNR & significant echoes. I would recommend to try the quiet library/tool which may have better performance in low SNR scenarios.

romanz commented 8 years ago

@norill Is there anything else I can help with?

norill commented 8 years ago

nah, but thanks for your time.