【问题标题】:ALSA: Playing and Outputting to multiple Bluetooth Devices simultaneously?ALSA:同时播放和输出到多个蓝牙设备?
【发布时间】:2021-10-04 18:08:13
【问题描述】:

如何配置 ALSA 的 asoundrc 文件以向两个蓝牙设备输入和输出音频数据?我尝试使用 dmix 和 dsnoop 插件来执行此操作,类似于以下帖子中显示的内容:ALSA Api: How to play two wave files simultaneously?。并查看了以下来源:https://www.alsa-project.org/main/index.php/Asoundrc#Software_mixinghttps://github.com/Arkq/bluez-alsa/wiki/Using-the-bluealsa-ALSA-pcm-plugin。我要做的就是使用 arecord 和 aplay 命令输出到这两个蓝牙设备。任何建议都将不胜感激。

我跑的时候:aplay -D mix_stream /home/pi/Desktop/noise.wav

错误:ALSA lib pcm_direct.c:1809:(_snd_pcm_direct_get_slave_ipc_offset) 从属 PCM 的“bluealsa”类型无效

aplay: main:828: audio open error: Invalid argument

编辑:我了解到 dmix 和 dsnoop 仅适用于硬件设备,因此我使用的是 multi 插件。但是,我仍然遇到以下命令的问题:arecord -D bth-multi -c 2 -r 44100 -f s16_le test.wav。它输出以下错误: ALSA lib bluealsa-pcm.c:763:(_snd_pcm_bluealsa_open) Couldn't get BlueALSA PCM: PCM not found arecord: main:828: audio open error: No such device.

这是我在 bluez-alsa github 页面上从 @Arkq 引用的当前 asoundrc 文件。这是官方链接:https://github.com/Arkq/bluez-alsa/issues/379#issuecomment-707309026

pcm.bth-1 {
    type plug
    slave.pcm {
        type bluealsa
        device "FA:D8:78:FB:57:36"
        profile "a2dp"
    }
}

pcm.bth-2 {
    type plug
    slave.pcm {
        type bluealsa
        device "5C:44:3E:54:E0:01"
        profile "a2dp"
    }
}

pcm.bth-multi {
   type plug;
   slave.pcm {
       type multi;
       slaves.a.pcm "bth-1";
       slaves.a.channels 2;
       slaves.b.pcm "bth-2";
       slaves.b.channels 2;
       bindings.0 { slave a; channel 0; }
       bindings.1 { slave a; channel 1; }
       bindings.2 { slave b; channel 0; }
       bindings.3 { slave b; channel 1; }
       master 1
   }
   ttable.0.0 1
   ttable.1.1 1
   ttable.0.2 1
   ttable.1.3 1
}

【问题讨论】:

    标签: linux audio bluetooth alsa a2dp


    【解决方案1】:

    我认为您错过了 pcm.y30slave.pcm 块的右大括号 (})。它应该是这样的:

    pcm.y30 {
        type plug
        slave.pcm {
            type bluealsa
            device "FA:D8:78:FB:57:36"
            profile "a2dp"
        }
    }
    

    【讨论】:

    • 谢谢,我确实错过了。但是,我仍然收到以下错误:ALSA lib pcm_direct.c:1809:(_snd_pcm_direct_get_slave_ipc_offset) 从属 PCM aplay 的“bluealsa”类型无效:main:828: audio open error: Invalid argument。所以我认为还有更多。
    • 试试这个配置:pastebin.com/76VmfbYq。 ALSA播放设备是pcm.final(aplay -D final ...) 来源:stackoverflow.com/questions/43939191/…
    • 每当我使用该配置文件并运行命令 aplay -D final test.wav 时。我收到以下错误:aplay: xrun:1664: read/write error, state = PREPARED.然而,我确实在网上找到了一个 alsa 配置文件,它允许我运行上面的命令并让两个蓝牙耳机同时播放声音。我会在上面发布。但是,它并没有解决我的记录问题。
    猜你喜欢
    • 2013-05-17
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-01-11
    • 1970-01-01
    • 1970-01-01
    • 2021-04-16
    相关资源
    最近更新 更多