romanz / amodem

Audio MODEM Communication Library in Python

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

feature suggestion - boost microphone level

RichardGe opened this issue · comments

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

Could you please run amodem recv -vv -c and attach the output log?

In general, "too weak signal" shouldn't be an issue if the signal-to-noise ratio is OK.

here is the log:

2022-11-17 21:27:31,546 INFO         2000 Hz: too weak signal     total=0.0930, rms=0.0930, coherency=0.9999, peak=0.0846               calib.py:141
2022-11-17 21:27:31,736 INFO         2000 Hz: too weak signal     total=0.0930, rms=0.0930, coherency=0.9999, peak=0.0834               calib.py:141
2022-11-17 21:27:31,946 INFO         2000 Hz: too weak signal     total=0.0931, rms=0.0931, coherency=0.9999, peak=0.0832               calib.py:141
2022-11-17 21:27:32,137 INFO         2000 Hz: too weak signal     total=0.0931, rms=0.0931, coherency=0.9999, peak=0.0832               calib.py:141
2022-11-17 21:27:32,345 INFO         2000 Hz: too weak signal     total=0.0932, rms=0.0931, coherency=0.9999, peak=0.0829               calib.py:141
2022-11-17 21:27:32,536 INFO         2000 Hz: too weak signal     total=0.0932, rms=0.0932, coherency=0.9995, peak=0.0902               calib.py:141
2022-11-17 21:27:32,746 INFO         2000 Hz: too weak signal     total=0.0932, rms=0.0932, coherency=0.9999, peak=0.0823               calib.py:141
2022-11-17 21:27:32,935 INFO         2000 Hz: too weak signal     total=0.0932, rms=0.0932, coherency=0.9999, peak=0.0818               calib.py:141
2022-11-17 21:27:33,145 INFO         2000 Hz: good signal         total=0.1048, rms=0.1048, coherency=0.9999, peak=0.1229               calib.py:141
2022-11-17 21:27:33,337 INFO         2000 Hz: good signal         total=0.1438, rms=0.1438, coherency=1.0000, peak=0.1229               calib.py:141
2022-11-17 21:27:33,546 INFO         2000 Hz: good signal         total=0.1439, rms=0.1438, coherency=0.9998, peak=0.1388               calib.py:141
2022-11-17 21:27:33,736 INFO         2000 Hz: good signal         total=0.1435, rms=0.1432, coherency=0.9980, peak=0.1331               calib.py:141
2022-11-17 21:27:33,946 INFO         2000 Hz: good signal         total=0.1424, rms=0.1423, coherency=0.9993, peak=0.1303               calib.py:141
2022-11-17 21:27:34,135 INFO         2000 Hz: good signal         total=0.1422, rms=0.1422, coherency=0.9999, peak=0.1233               calib.py:141
2022-11-17 21:27:34,345 INFO         2000 Hz: good signal         total=0.1422, rms=0.1422, coherency=1.0000, peak=0.1203               calib.py:141
2022-11-17 21:27:34,537 INFO         2000 Hz: good signal         total=0.1420, rms=0.1420, coherency=1.0000, peak=0.1198               calib.py:141

Note that the switch between too weak signal and good signal is because I slightly increase the sound level of my speaker

And just in case, here is the wave in my Audacity :

image

zoomed in:

image

The signals look good, I think you can ignore the "too weak" warning if your coherency is above 0.999 :)

I see - maybe you should modify the condition to have the "too weak signal" message then ?
Thanks for your help.