8チャンネルZoom R16のices2プロファイルを設定する方法

8チャンネルZoom R16のices2プロファイルを設定する方法

私は初めてices2とicecast2を使いましたが、イヤホンで私の声を聞くことができるストリームを設定しました。したがって、システムはいくつかの基本的な成功を収めました。今、実際の目標は次のとおりです。

Zoom R16レコーダーのオーディオインターフェース機能を使用して8つの言語をストリーミングしようとしています。arecord --dump-hw-params hw1,0R16で実行すると、次のものが返されます。

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:"alsa/alsa_open_module サンプル形式の入力中にエラーが発生しました。使用できません: 無効な引数" 回避策

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つの異なるプロファイルが必要で、8つのices2インスタンスを実行しているとします。しかし、適切なチャンネルをどのように選択しますか?

編集:この方法は、8チャンネルのwavファイルを録音するのにも効果的であると言えます。

arecord -D hw:1,0 -f S32_LE -r 48000 -c 8 testr16.wav

ベストアンサー1

いいですね。私たちは主に次のような重要な分野を含む作業を始めました。

  • ALSAレベルでのストリーム分割(分割の~/.asoundrc
    ため)ハードウェアデバイス上のすべてのストリームは同じipc_keyを使用する必要があります。dsnoop
  • ices2設定ファイルでは、--
    deviceは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

これが設定ファイルです。変更された3つのことは、デバイス、マウント、PIDです。

デバイス:plug:ch1マウントplug:ch8
: ch1.oggPID ファイル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/

おすすめ記事