简体   繁体   English

将 Python 脚本从 Win10 移植到 Ubuntu(音频、网络)

[英]Porting python script from Win10 to Ubuntu (Audio, Networking)

I wrote an bit of Python that captures microphone input and send it to another machine on the same private network, then maps it to the speakers of the second machine.我写了一些 Python 来捕获麦克风输入并将其发送到同一专用网络上的另一台机器,然后将其映射到第二台机器的扬声器。 https://github.com/Bencosterton/BCAN-AoIP The app runs in two parts, Client and Receiver. https://github.com/Bencosterton/BCAN-AoIP该应用程序分两部分运行,客户端和接收器。

This was written in Windos10 and works great between Windows machines.这是在 Windows10 中编写的,在 Windows 机器之间运行良好。

I've decided to test it on linux (transmitter part) and getting a lot of ALSA and JACK related errors.我决定在 linux(发射器部分)上测试它并得到很多与 ALSA 和 JACK 相关的错误。

OS: Ubunut 22.04LTS + UbuntuStudio extras - Running on Virtualbox, bridged network adaptor.操作系统:Ubunut 22.04LTS + UbuntuStudio extras - 在 Virtualbox 上运行,桥接网络适配器。 Virtualbox has been given access to host audio in/out. Virtualbox 已被授予访问主机音频输入/输出的权限。

After installing the UbuntoStudio ALSA and JACK drivers, there is no change.安装UbuntoStudio ALSA和JACK驱动后,没有变化。 Any suggestions what to tackle first and how?有什么建议首先解决什么以及如何解决?

Output on launch of python script;启动 python 脚本时的输出;

ALSA lib pcm_dmix.c:1032:(snd_pcm_dmix_open) unable to open slave
ALSA lib pcm.c:2664:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.rear
ALSA lib pcm.c:2664:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.center_lfe
ALSA lib pcm.c:2664:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.side
ALSA lib pcm.c:2664:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.surround71
ALSA lib setup.c:547:(add_elem) Cannot obtain info for CTL elem (MIXER,'IEC958 Playback Default',0,0,0): No such file or directory
ALSA lib pcm.c:2664:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.hdmi
ALSA lib pcm.c:2664:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.hdmi
ALSA lib pcm.c:2664:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.modem
ALSA lib pcm.c:2664:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.modem
ALSA lib pcm.c:2664:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.phoneline
ALSA lib pcm.c:2664:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.phoneline
Cannot connect to server socket err = No such file or directory
Cannot connect to server request channel
jack server is not running or cannot be started
JackShmReadWritePtr::~JackShmReadWritePtr - Init not done for -1, skipping unlock
JackShmReadWritePtr::~JackShmReadWritePtr - Init not done for -1, skipping unlock
Cannot connect to server socket err = No such file or directory
Cannot connect to server request channel
jack server is not running or cannot be started
JackShmReadWritePtr::~JackShmReadWritePtr - Init not done for -1, skipping unlock
JackShmReadWritePtr::~JackShmReadWritePtr - Init not done for -1, skipping unlock
ALSA lib confmisc.c:160:(snd_config_get_card) Invalid field card
ALSA lib pcm_usb_stream.c:482:(_snd_pcm_usb_stream_open) Invalid card 'card'
ALSA lib confmisc.c:160:(snd_config_get_card) Invalid field card
ALSA lib pcm_usb_stream.c:482:(_snd_pcm_usb_stream_open) Invalid card 'card'
ALSA lib pcm_dmix.c:1032:(snd_pcm_dmix_open) unable to open slave
Cannot connect to server socket err = No such file or directory
Cannot connect to server request channel
jack server is not running or cannot be started
JackShmReadWritePtr::~JackShmReadWritePtr - Init not done for -1, skipping unlock
JackShmReadWritePtr::~JackShmReadWritePtr - Init not done for -1, skipping unlock
/home/ben/Desktop/reciever.py:42: DeprecationWarning: setDaemon() is deprecated, set the daemon attribute instead
  udpThread .setDaemon(True)
/home/ben/Desktop/reciever.py:43: DeprecationWarning: setDaemon() is deprecated, set the daemon attribute instead
  AudioThread.setDaemon(True)
^[[1;2D^CTraceback (most recent call last):
  File "/home/ben/Desktop/reciever.py", line 46, in <module>
    udpThread .join()
  File "/usr/lib/python3.10/threading.py", line 1096, in join
    self._wait_for_tstate_lock()
  File "/usr/lib/python3.10/threading.py", line 1116, in _wait_for_tstate_lock
    if lock.acquire(block, timeout):
KeyboardInterrupt

Any help will be appreciated.任何帮助将不胜感激。

Script now works on UbutuStudio 22.04;脚本现在适用于 UbutuStudio 22.04;

sudo apt install build-essential portaudio19-dev python3.10-dev

pip install pyaudio

Portaudio is needed before you can get pyaudio to run.在运行 pyaudio 之前需要 Portaudio。

It still throws the ALSA errors, but the app runs.它仍然会抛出 ALSA 错误,但应用程序会运行。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM