AskOverflow.Dev

AskOverflow.Dev Logo AskOverflow.Dev Logo

AskOverflow.Dev Navigation

  • 主页
  • 系统&网络
  • Ubuntu
  • Unix
  • DBA
  • Computer
  • Coding
  • LangChain

Mobile menu

Close
  • 主页
  • 系统&网络
    • 最新
    • 热门
    • 标签
  • Ubuntu
    • 最新
    • 热门
    • 标签
  • Unix
    • 最新
    • 标签
  • DBA
    • 最新
    • 标签
  • Computer
    • 最新
    • 标签
  • Coding
    • 最新
    • 标签
主页 / unix / 问题 / 763529
Accepted
kr37
kr37
Asked: 2023-12-11 13:19:27 +0800 CST2023-12-11 13:19:27 +0800 CST 2023-12-11 13:19:27 +0800 CST

如何为8通道Zoom R16设置ices2配置文件

  • 772

我是ices2和icecast2的新手,但确实设法建立了一个流,使我可以在耳塞中听到自己的声音。所以,该系统取得了一些基本的成功。现在,真正的目标:

我们希望使用 Zoom R16 录音机的音频接口功能流式传输 8 种不同的语言。通过arecord --dump-hw-params hw1,0在 R16 上执行,它返回:

Recording WAVE 'hw1,0' : Unsigned 8 bit, Rate 8000 Hz, Mono
HW Params of device "default":
--------------------
ACCESS:  RW_INTERLEAVED
FORMAT:  U8 S16_LE S16_BE S24_LE S24_BE S32_LE S32_BE FLOAT_LE FLOAT_BE MU_LAW A_LAW S24_3LE S24_3BE
SUBFORMAT:  STD
SAMPLE_BITS: [8 32]
FRAME_BITS: [8 1024]
CHANNELS: [1 32]
RATE: [1 384000]
PERIOD_TIME: (2 4294967295)
PERIOD_SIZE: [1 1398102)
PERIOD_BYTES: [128 1398102)
PERIODS: [3 1024]
BUFFER_TIME: (7 4294967295]
BUFFER_SIZE: [3 4194304]
BUFFER_BYTES: [384 4194304]
TICK_TIME: ALL
--------------------

问题1:中间有空格的数字是什么意思SAMPLE_BITS: [8 32]?这是否意味着样本位可以是 8、16 或 32?

问题2:如何解决“EROR input-alsa/alsa_open_module Sample format not available: Invalid argument”

当我尝试启动ices2时,它就退出了,日志显示:

[2023-12-10  20:48:46] INFO ices-core/main IceS 2.0.3 started...
[2023-12-10  20:48:46] EROR input-alsa/alsa_open_module Sample format not available: Invalid argument
[2023-12-10  20:48:46] EROR input/input_loop Couldn't initialise input module "alsa"
[2023-12-10  20:48:46] INFO ices-core/main Shutdown complete

我用于ices2的配置文件是:

<?xml version="1.0"?>
<ices>

    <!-- run in background  -->                     <background>0</background>

    <!-- where logs go. -->                            <logpath>/var/log/ices2</logpath>
                                                       <logfile>ices.log</logfile> 
    <!-- size in kilobytes -->                         <logsize>2048</logsize>
    <!-- 1=error, 2=warn, 3=infoa ,4=debug -->        <loglevel>4</loglevel>
    <!-- logfile is ignored if this is set to 1 --> <consolelog>0</consolelog>

    <!-- optional filename to write process id to -->  <pidfile>/var/log/ices2/ices.pid</pidfile> 

    <stream>
        <!-- metadata used for stream listing -->
        <metadata>
            <name>8 Languages</name>
            <genre>Dharma Teaching</genre>
            <description>Translation of 2024 International Spring Festival</description>
            <url>http://localhost/</url>
        </metadata>

        <!--    Input module.

            This example uses the 'alsa' module. It takes input from the
            ALSA audio device (e.g. line-in), and processes it for live
            encoding.  -->
        <input>
            <module>alsa</module>
            <param name="rate">48000</param>
            <param name="channels">8</param>
            <param name="device">hw:1,0</param>
            <param name="periods">2</param>
            <!-- Read metadata (from stdin by default, or -->
            <!-- filename defined below (if the latter, only on SIGUSR1) -->
            <param name="metadata">1</param>
            <param name="metadatafilename">testES</param>
        </input>

        <!--    Stream instance.

            You may have one or more instances here.  This allows you to
            send the same input data to one or more servers (or to different
            mountpoints on the same server). Each of them can have different
            parameters. This is primarily useful for a) relaying to multiple
            independent servers, and b) encoding/reencoding to multiple
            bitrates.

            If one instance fails (for example, the associated server goes
            down, etc), the others will continue to function correctly.
            This example defines a single instance doing live encoding at
            low bitrate.  -->

        <instance>
            <!--    Server details.

                You define hostname and port for the server here, along
                with the source password and mountpoint.  -->

            <hostname>localhost</hostname>
            <port>8000</port>
            <password>hackme</password>
            <mount>/spanish.ogg</mount>
            <yp>1</yp>   <!-- allow stream to be advertised on YP, default 0 -->

            <!--    Live encoding/reencoding:

                channels and samplerate currently MUST match the channels
                and samplerate given in the parameters to the alsa input
                module above or the remsaple/downmix section below.  -->

            <encode>  
                <quality>0</quality>
                <samplerate>24000</samplerate>
                <channels>8</channels>
            </encode>

            <!-- stereo->mono downmixing, enabled by setting this to 1 -->
            <downmix>0</downmix>

            <!-- resampling.
            
                Set to the frequency (in Hz) you wish to resample to, -->
             
            <resample>
                <in-rate>48000</in-rate>
                <out-rate>24000</out-rate>
            </resample>
        </instance>

    </stream>
</ices>

但总的来说,我想知道的是:

问题 3:需要在配置文件中添加哪些内容,以便记录器的通道 1 可以作为西班牙语进行流式传输,通道 2 作为法语进行流式传输,通道 3 作为德语进行流式传输,...通道 8。我假设我实际上需要 8 个不同的配置文件并运行ices2的8个实例,但如何选择正确的通道?

编辑:我还可以说这适用于录制 8 通道 wav 文件:

arecord -D hw:1,0 -f S32_LE -r 48000 -c 8 testr16.wav
alsa
  • 1 1 个回答
  • 25 Views

1 个回答

  • Voted
  1. Best Answer
    kr37
    2023-12-13T16:12:30+08:002023-12-13T16:12:30+08:00

    好的,已经开始工作了,主要有以下几个关键领域:

    • 在 ALSA 级别拆分流~/.asoundrc
      -- 用于dsnoop拆分
      -- 来自一个硬件设备的所有流都需要使用相同的 ipc_key。
    • 在ices2配置文件中
      --设备是plug:{name from .asoundrc}
      --获取正确的通道。我将其设置为 8 个通道,尽管 alsa 现在提供单通道 pcm,但这会导致流式传输时发出刺耳的噪音!
    • 必须/etc/icecast2/icecast.xml增加<sources>8</sources>

    这是决赛~/.asoundrc。请注意,由于所有 dsnoop 通道都来自同一硬件设备,因此它们需要具有相同的ipc_key。否则,一旦您从一个通道开始录制,其余通道就会报告为“设备正忙”。

    pcm_slave.r16 { pcm "hw:1,0"; rate 48000; channels 8 }
    pcm.ch1 { type dsnoop; ipc_key 3700; slave r16; bindings.0 0; }
    pcm.ch2 { type dsnoop; ipc_key 3700; slave r16; bindings.0 1; }
    pcm.ch3 { type dsnoop; ipc_key 3700; slave r16; bindings.0 2; }
    pcm.ch4 { type dsnoop; ipc_key 3700; slave r16; bindings.0 3; }
    pcm.ch5 { type dsnoop; ipc_key 3700; slave r16; bindings.0 4; }
    pcm.ch6 { type dsnoop; ipc_key 3700; slave r16; bindings.0 5; }
    pcm.ch7 { type dsnoop; ipc_key 3700; slave r16; bindings.0 6; }
    pcm.ch8 { type dsnoop; ipc_key 3700; slave r16; bindings.0 7; }
    

    不要忘记重新启动 ALSA:sudo /etc/init.d/alsa-utils restart

    然后我制作了8个独立的ices2配置文件,

    ices-alsa-r16.1.xml 
    ices-alsa-r16.2.xml 
    ...
    ices-alsa-r16.8.xml
    

    这是配置文件。改变的三件事是设备、挂载和 pid:

    设备:plug:ch1挂载plug:ch8
    : PID 文件:ch1.ogg到ch8.ogg
    r16.1.pidr16.8.pid

    <?xml version="1.0"?>
    <ices>
    
        <!-- run in background  -->                     
        <background>1</background>
        <logpath>/var/log/ices2</logpath>
        <logfile>ices.log</logfile> 
        <logsize>2048</logsize>
        <loglevel>4</loglevel>
        <consolelog>0</consolelog>
        <pidfile>/var/log/ices2/r16.8.pid</pidfile> 
    
        <stream>
            <metadata>
                <name>8 Languages</name>
                <genre>Dharma Teaching</genre>
                <description>Translation of 2024 International Spring Festival</description>
                <url>http://localhost/</url>
            </metadata>
    
            <input>
                <module>alsa</module>
                <param name="rate">48000</param>
                <param name="channels">1</param>
                <param name="device">plug:ch8</param>
                <param name="periods">3</param>
                <param name="buffer-time">500</param>
            </input>
    
            <instance>
                <hostname>localhost</hostname>
                <port>8000</port>
                <password>hackme</password>
                <mount>/ch8.ogg</mount>
    
                <encode>  
                    <quality>0</quality>
                    <samplerate>24000</samplerate>
                    <channels>1</channels>
                </encode>
                 
                <resample>
                    <in-rate>48000</in-rate>
                    <out-rate>24000</out-rate>
                </resample>
            </instance>
    
        </stream>
    </ices>
    

    这里有一些很好的信息:
    https://alsa.opensrc.org/Asoundrc https://bootlin.com/blog/audio-multi-channel-routing-and-mixing-using-alsalib/

    • 0

相关问题

  • 打开笔记本电脑后 alsamixer 出现多个问题(在其他操作系统中没有问题)

  • PulseAudio ALSA模块中的fragments和fragment_size是什么意思?

  • 在 .asoundrc 中为 ALSA 设置新的默认音频播放设备

  • 使记录忽略播放

  • FreeBSD 上的 alsa-utils 似乎不起作用

Sidebar

Stats

  • 问题 205573
  • 回答 270741
  • 最佳答案 135370
  • 用户 68524
  • 热门
  • 回答
  • Marko Smith

    模块 i915 可能缺少固件 /lib/firmware/i915/*

    • 3 个回答
  • Marko Smith

    无法获取 jessie backports 存储库

    • 4 个回答
  • Marko Smith

    如何将 GPG 私钥和公钥导出到文件

    • 4 个回答
  • Marko Smith

    我们如何运行存储在变量中的命令?

    • 5 个回答
  • Marko Smith

    如何配置 systemd-resolved 和 systemd-networkd 以使用本地 DNS 服务器来解析本地域和远程 DNS 服务器来解析远程域?

    • 3 个回答
  • Marko Smith

    dist-upgrade 后 Kali Linux 中的 apt-get update 错误 [重复]

    • 2 个回答
  • Marko Smith

    如何从 systemctl 服务日志中查看最新的 x 行

    • 5 个回答
  • Marko Smith

    Nano - 跳转到文件末尾

    • 8 个回答
  • Marko Smith

    grub 错误:你需要先加载内核

    • 4 个回答
  • Marko Smith

    如何下载软件包而不是使用 apt-get 命令安装它?

    • 7 个回答
  • Martin Hope
    user12345 无法获取 jessie backports 存储库 2019-03-27 04:39:28 +0800 CST
  • Martin Hope
    Carl 为什么大多数 systemd 示例都包含 WantedBy=multi-user.target? 2019-03-15 11:49:25 +0800 CST
  • Martin Hope
    rocky 如何将 GPG 私钥和公钥导出到文件 2018-11-16 05:36:15 +0800 CST
  • Martin Hope
    Evan Carroll systemctl 状态显示:“状态:降级” 2018-06-03 18:48:17 +0800 CST
  • Martin Hope
    Tim 我们如何运行存储在变量中的命令? 2018-05-21 04:46:29 +0800 CST
  • Martin Hope
    Ankur S 为什么 /dev/null 是一个文件?为什么它的功能不作为一个简单的程序来实现? 2018-04-17 07:28:04 +0800 CST
  • Martin Hope
    user3191334 如何从 systemctl 服务日志中查看最新的 x 行 2018-02-07 00:14:16 +0800 CST
  • Martin Hope
    Marko Pacak Nano - 跳转到文件末尾 2018-02-01 01:53:03 +0800 CST
  • Martin Hope
    Kidburla 为什么真假这么大? 2018-01-26 12:14:47 +0800 CST
  • Martin Hope
    Christos Baziotis 在一个巨大的(70GB)、一行、文本文件中替换字符串 2017-12-30 06:58:33 +0800 CST

热门标签

linux bash debian shell-script text-processing ubuntu centos shell awk ssh

Explore

  • 主页
  • 问题
    • 最新
    • 热门
  • 标签
  • 帮助

Footer

AskOverflow.Dev

关于我们

  • 关于我们
  • 联系我们

Legal Stuff

  • Privacy Policy

Language

  • Pt
  • Server
  • Unix

© 2023 AskOverflow.DEV All Rights Reserve