如何在 pi 上正确安装 portaudio [英] how to install portaudio on pi properly

查看:67
本文介绍了如何在 pi 上正确安装 portaudio的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在从事一个项目,该项目涉及从 raspberry pi 上的麦克风录音.现在我在程序运行时收到这个错误.

I am working on a project that involves recording from a mic on a raspberry pi. for now i am getting this error while the program is running.

python3: src/hostapi/alsa/pa_linux_alsa.c:3641:PaAlsaStreamComponent_BeginPolling:断言`ret == self->nfds'失败的.中止

python3: src/hostapi/alsa/pa_linux_alsa.c:3641: PaAlsaStreamComponent_BeginPolling: Assertion `ret == self->nfds' failed. Aborted

在寻找解决此问题的方法时,我发现文件 pa_linux_alsa.c 属于端口音频.请参考以下链接.

while searching for ways to fix this, i figured out the file pa_linux_alsa.c belongs to port audio. please refer to the following links.

我认为修改了 pa_linux_alsa.c

如何安装端口音频

下载链接

第一个链接是关于错误和修改后的修复,仍然不知道在哪里复制,最后两个是关于安装portaudio.显然没有更简单的方法可以使用命令安装它.

first link is about the error and a modified fix, still dont know where to copy and the last two are about installing portaudio. apparently there is no easier way to install this with a command.

我下载了它的 pa_snapshot 增强版.但我不知道我应该把这些文件放在哪里开始像自述文件中那样配置和制作.我将 portaudio 目录复制到 home/pi(我认为是在用户中.cd"并将其复制到那里)然后按照自述文件中的操作并重新启动系统.我没有看到程序中的错误有任何变化.我尝试在 pa_linux_alsa.c 中使用命令 whereis.该命令也不显示文件或与 portaudio 相关的任何内容.

i downloaded the pa_snapshot enhanced version of it. but i dont know where i am supposed to put these files to begin to configure and make as in the readme. I copied the portaudio directory in to home/pi (in the user i think. "cd" and copied it there) then did as in the readme and rebooted the system. i dont see any changes in the error in program. i tried using the command whereis with pa_linux_alsa.c. that command also doesn't show the file or anything related to portaudio.

推荐答案

您的第一个链接正确识别了 portaudio 中的错误,但修复不完整.我分叉了 portaudio 库并创建了一个补丁来解决这个问题.以下是删除 portaudio 包并从源代码编译修补版本的步骤:

Your first link correctly identifies a bug in portaudio, but the fix is incomplete. I forked the portaudio library and created a patch to fix this. Here are the steps to remove the portaudio package and compile the patched version from source:

sudo apt-get remove libportaudio2
sudo apt-get install libasound2-dev
git clone -b alsapatch https://github.com/gglockner/portaudio
cd portaudio
./configure && make
sudo make install
sudo ldconfig
cd ..

此时,您应该有一个基于 pa_stable_v190600_20161030 标签的修补过的 portaudio 库.最后,如果您需要 Python 的 PyAudio 包,请使用 pip 安装它:sudo pip3 install pyaudio.

At this point, you should have a patched portaudio library, based on the pa_stable_v190600_20161030 tag. Finally, if you need the PyAudio package for Python, then install it using pip: sudo pip3 install pyaudio.

这篇关于如何在 pi 上正确安装 portaudio的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆