- android - 多次调用 OnPrimaryClipChangedListener
- android - 无法更新 RecyclerView 中的 TextView 字段
- android.database.CursorIndexOutOfBoundsException : Index 0 requested, 光标大小为 0
- android - 使用 AppCompat 时,我们是否需要明确指定其 UI 组件(Spinner、EditText)颜色
我正在尝试从 Linux (ubuntu 14.04) 中的多个麦克风读取数据。我有一个特定的限制,即麦克风的读数应该通过轮询(所以不要等到有数据,尽管数据以高频出现)。我想知道这在 Linux 中是否可行?不幸的是,音频捕获不是我的专业领域,我想知道使用 Alsa 的选择是否合适。为了更好地理解这个问题,这里是我想到的伪代码:
open_the_audio_device();
set_the_parameters_of_the_audio_device();
while (!done)
{
poll_result=poll_the_devices(); //other non-audio devices are also polled here preferably, something like using select on all different file descriptors of audio, video, socket, etc.
if(poll_success_for_audio_device)
receive_audio_from_the_device_that_has_data();
else
do_some_other_very_fast_stuff_and_start_loop_again();
}
close_the_device();
我的问题有两个:
感谢您的关注。
最佳答案
要防止 snd_pcm_read*()
调用阻塞,请使用 snd_pcm_nonblock() 启用非阻塞模式.
要获取可轮询的文件描述符,请调用 snd_pcm_poll_descriptors_count()和 snd_pcm_poll_descriptors() .可能有多个描述符,因为某些插件可能会以不同方式实现通知。要将这些描述符上的 poll()
结果转换回 POLLIN
/POLLOUT
值,请调用 snd_pcm_poll_descriptors_revents() .
关于linux - 使用 ALSA [或 V4L2] 通过轮询读取麦克风数据,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25822195/
我正在尝试在 CentOS 5.6 上构建 qt 但它失败的原因是系统没有所需的库。 我正在尝试使用 Fedora qt 源 rpm 文件中的源文件和规范文件进行构建。 $ rpmbuild -ba
如何在默认声卡上监听主 channel 的音量变化?我希望通过 dbus 或回调或其他方式收到音量已更改的通知。 我已经尝试查看 ALSA 和 PulseAudio API,它们似乎只允许您设置和获取
我在我的 RHEL 7.5 机器上配置 ALSA 时遇到问题。 我的部分解决方案是尝试更改/etc/asound.conf 中的设置。我尝试了很多排列组合,但我仍然听到我的声音(.raw 文件)中有“
我有一个在 linux 上使用 ALSA 驱动程序的音频应用程序,并且该代码在 intel linux 台式机上运行良好。但是,我也想支持 Raspberry Pi,并且我在该平台上遇到了周期性的音频
我正在尝试使用 travis-ci 构建一个 rust 二进制文件。我设法让 windows 和 osx 构建工作,但 linux 构建一直失败。 似乎“alsa-sys” crate (依赖项之一)
我正在尝试使用 linux 机器上的 alsa api 从我的应用程序内部将麦克风静音。我正在使用以下代码更改 volume=0 的音量: long min, max; snd_mixer_t *ha
我正在尝试运行包含以下内容的基本 Pygame midi 脚本: import pygame, pygame.midi pygame.midi.init() print "Midi Dev
我正在使用没有可用的 ALSA snd-dummy 模块的 docker 镜像。我需要模拟声卡。我不需要(或不想)听音频。 根据我所做的许多搜索,我相当确定我想使用 ALSA 的 snd-dummy
我注意到 pcm.c 和 speaker-test.c 中的正弦发生器循环生成一个新的正弦缓冲区。所以它不断地重新创建相同的缓冲区。我想播放缓冲区而不是每次都重新创建它以节省一些 cpu 时间。但是,
使用不断输出数据的 USB 音频设备(它是具有多个 channel 的 HID)。 我希望实现的是在设备发出信号之前忽略音频。那时我会开始监控提要。来自设备的第二个信号表明我可以重新忽略数据。我已经以
我使用的是 Ubuntu 20。我输入了 sudo nano /usr/share/alsa/alsa.conf并得到以下输出:output of the above command 我不知道它是否有
ALSA 的 snd_pcm_hw_params_set_access使用 SND_PCM_ACCESS_RW_NONINTERLEAVED access type 调用时函数失败,报告存在无效参数。
我正在尝试使用 IBM watson TTS 引擎来播放文本。播放声音时,出现以下错误: ALSA lib confmisc.c:1286:(snd_func_refer) Unable to fin
我有一个我正在做的项目,为了这个问题,可以说它们是无线扬声器。 我们现在正在使用树莓派进行开发,但我们计划转向我们自己的嵌入式解决方案。我们选择的编解码器最适合我们的需求,尽管它不是“支持 ALSA”
我正在播放带有某些C代码(如this)的wav声音文件。它使用所有API: snd_pcm_* 我想使用均衡器插件: libasound_module_ctl_equal.so, libasound_
我有一个连接了 i2s MEMS 麦克风的 Raspberry Pi。我正在使用 SOX 库从中录制音频,并尝试增加我的 ALSA buffer_size。 我的 ALSA buffer_size 目
使用 Linux Mint 17.1 和 ALSA。我有两个产生相同声音的 wav 文件:一个使用 pcm_s16le,另一个使用 pcm_s24le。每个都由图腾/视频正确播放。我设置硬件参数和使用
我继承了一段代码,它使用 ALSA 来捕获 8KHz、8 位、1 channel 的音频输入。代码看起来相当简单,它将 channel 设置为 1,速率设置为 8000,周期大小设置为 8000。该程
使用 Linux Mint 17.1 和 ALSA。我有两个产生相同声音的 wav 文件:一个使用 pcm_s16le,另一个使用 pcm_s24le。每个都由图腾/视频正确播放。我设置硬件参数和使用
我有一个 ubuntu 安装,默认安装了pulseaudio。当pulseaudio运行时,这有效: aplay -D hw:2,7/usr/share/xbmc/sounds/Bursting\Bu
我是一名优秀的程序员,十分优秀!