romanz / amodem

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

Add Windows support (use DLL of PortAudio library) #44

Closed RonAmihai closed 4 years ago

RonAmihai commented 4 years ago

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...)

zack77789 commented 4 years ago

I could not get it to work on Windows 10. Help will be appreciated!

Traceback (most recent call last): (.venv) C:\Users\zz\Documents\2020\py-projects\amodem.venv\Scripts>amodem send --calibrate Audio OFDM MODEM v1.15.0: 48.0 kb/s (64-QAM x 8 carriers) Fs=32.0 kHz Traceback (most recent call last): File "C:\Users\zz\AppData\Local\Programs\Python\Python36\lib\runpy.py", line 193, in _run_module_as_main "main", mod_spec) File "C:\Users\zz\AppData\Local\Programs\Python\Python36\lib\runpy.py", line 85, in _run_code exec(code, run_globals) File "C:\Users\zz\Documents\2020\py-projects\amodem.venv\Scripts\amodem.exe__main.py", line 7, in File "c:\users\zz\documents\2020\py-projects\amodem.venv\lib\site-packages\amodem\main.py", line 250, in _main interface.load(args.audio_library) File "c:\users\zz\documents\2020\py-projects\amodem.venv\lib\site-packages\amodem\audio.py", line 18, in load self.lib = ctypes.CDLL(name) File "C:\Users\zz\AppData\Local\Programs\Python\Python36\lib\ctypes\init.py", line 348, in init__ self._handle = _dlopen(self._name, mode) OSError: [WinError 126] The specified module could not be found

RonAmihai commented 4 years ago

I could not get it to work on Windows 10. Help will be appreciated!

Traceback (most recent call last): (.venv) C:\Users\zz\Documents\2020\py-projects\amodem.venv\Scripts>amodem send --calibrate Audio OFDM MODEM v1.15.0: 48.0 kb/s (64-QAM x 8 carriers) Fs=32.0 kHz Traceback (most recent call last): File "C:\Users\zz\AppData\Local\Programs\Python\Python36\lib\runpy.py", line 193, in _run_module_as_main "main", mod_spec) File "C:\Users\zz\AppData\Local\Programs\Python\Python36\lib\runpy.py", line 85, in _run_code exec(code, run_globals) File "C:\Users\zz\Documents\2020\py-projects\amodem.venv\Scripts\amodem.exemain.py", line 7, in File "c:\users\zz\documents\2020\py-projects\amodem.venv\lib\site-packages\amodemmain.py", line 250, in _main interface.load(args.audio_library) File "c:\users\zz\documents\2020\py-projects\amodem.venv\lib\site-packages\amodem\audio.py", line 18, in load self.lib = ctypes.CDLL(name) File "C:\Users\zz\AppData\Local\Programs\Python\Python36\lib\ctypesinit.py", line 348, in init self._handle = _dlopen(self._name, mode) OSError: [WinError 126] The specified module could not be found

It seems you run the command without specifying DLL explicitly.

As I've mentioned, on Windows you should mention it as part of the command, as follows: amodem send -c -l <path-to-portaudio-dll>

zack77789 commented 4 years ago

I could not get it to work on Windows 10. Help will be appreciated! Traceback (most recent call last): (.venv) C:\Users\zz\Documents\2020\py-projects\amodem.venv\Scripts>amodem send --calibrate Audio OFDM MODEM v1.15.0: 48.0 kb/s (64-QAM x 8 carriers) Fs=32.0 kHz Traceback (most recent call last): File "C:\Users\zz\AppData\Local\Programs\Python\Python36\lib\runpy.py", line 193, in _run_module_as_main "main", mod_spec) File "C:\Users\zz\AppData\Local\Programs\Python\Python36\lib\runpy.py", line 85, in _run_code exec(code, run_globals) File "C:\Users\zz\Documents\2020\py-projects\amodem.venv\Scripts\amodem.exemain.py", line 7, in File "c:\users\zz\documents\2020\py-projects\amodem.venv\lib\site-packages\amodemmain.py", line 250, in _main interface.load(args.audio_library) File "c:\users\zz\documents\2020\py-projects\amodem.venv\lib\site-packages\amodem\audio.py", line 18, in load self.lib = ctypes.CDLL(name) File "C:\Users\zz\AppData\Local\Programs\Python\Python36\lib\ctypesinit.py", line 348, in init self._handle = _dlopen(self._name, mode) OSError: [WinError 126] The specified module could not be found

It seems you run the command without specifying DLL explicitly.

As I've mentioned, on Windows you should mention it as part of the command, as follows: amodem send -c -l <path-to-portaudio-dll>

Thank you so much - it started calibration!

romanz commented 4 years ago

Thanks @RonAmihai and @zack77789 for opening and helping to resolve this issue!

nycki93 commented 9 months ago

Can you please add in the readme that the path should look like /bin/libportaudio.dll? I was using /lib/libportaudio.dll.a and confused as to why it didn't work.