AlsaとPulseAudio(csound):接続が拒否されました。

AlsaとPulseAudio(csound):接続が拒否されました。

私は完全にパニックになる問題にぶつかった。まず、一部のシステム情報

Linux quasar-nixos-tr 4.19.87 #1-NixOS SMP Sun Dec 1 08:17:47 UTC 2019 x86_64 GNU/Linux

今はサウンド生成/音楽ライブラリで遊んでいます。奇妙な問題が見えます。

私はHaskellを介してcsoundレイヤーを使用しています。ライブラリが呼び出され、csound-expression一部のHaskellコードに基づいてcsoundファイルを生成し、csoundを介して実行します。

default私が理解したように、csoundは私のシステムからPulseAudioのデバイスを介してルーティングを試みるAlsaにオーディオをルーティングします。

今私のシステムで奇妙なことが起こっています。

  1. 再起動後にcsound固有のコードを実行すると、音が聞こえます。しかし、、そのスニペットの実行を停止すると、他のアプリケーションがPAに接続できなくなるようです。検査systemctl --user status pulseaudio.service pulsaudio.socketの結果、サービスが終了し、最大値が使い果たされたことがわかりました。いいえ。始めましょう。
  2. 新しい起動後に別のアプリケーションを実行すると、pavucontrolPAサービスに接続できるようになりましたが、私のHaskell csoundコードは接続できなくなりました。代わりに、次のように終了します。

    λ> dac . osc $ 200 
    0dBFS level = 32768.0
    --Csound version 6.13 (double samples) Jan  1 1970
    [commit: none]
    libsndfile-1.0.28
    UnifiedCSD:  tmp.csd
    STARTING FILE
    Creating options
    Creating orchestra
    closing tag
    Creating score
    rtaudio: ALSA module enabled
    rtmidi: ALSA Raw MIDI module enabled
    Elapsed time at end of orchestra compile: real: 0.001s, CPU: 0.001s
    sorting score ...
        ... done
    Elapsed time at end of score sort: real: 0.001s, CPU: 0.001s
    displays suppressed
    0dBFS level = 1.0
    orch now loaded
    audio buffered in 256 sample-frame blocks
    ALSA lib pulse.c:243:(pulse_connect) PulseAudio: Unable to connect: Connection refused
    
     *** Cannot open device 'default' for audio input: Connection refused
    Failed to initialise real time audio input
    inactive allocs returned to freespace
    end of score.          overall amps:  0.00000
           overall samples out of range:        0
    1 errors in performance
    Elapsed time at end of performance: real: 0.169s, CPU: 0.004s
    

ケース1(上記)の場合、ログにはいくつかの興味深い内容がありますが、PAの仕組み、Alsaの仕組み、および2つの連携の仕方の理解は限られています。

Dec 16 09:28:16 quasar-nixos-tr systemd[1708]: Starting Sound Service...
Dec 16 09:28:16 quasar-nixos-tr pulseaudio[2382]: E: [pulseaudio] socket-server.c: bind(): Address already in use
Dec 16 09:28:16 quasar-nixos-tr pulseaudio[2382]: E: [pulseaudio] module.c: Failed to load module "module-esound-protocol-unix" (argument: ""): initialization failed.
Dec 16 09:28:16 quasar-nixos-tr pulseaudio[2382]: E: [pulseaudio] main.c: D-Bus name org.PulseAudio1 already taken.
Dec 16 09:28:16 quasar-nixos-tr systemd[1708]: pulseaudio.service: Main process exited, code=exited, status=1/FAILURE
Dec 16 09:28:16 quasar-nixos-tr systemd[1708]: pulseaudio.service: Failed with result 'exit-code'.
Dec 16 09:28:16 quasar-nixos-tr systemd[1708]: Failed to start Sound Service.
Dec 16 09:28:16 quasar-nixos-tr systemd[1708]: pulseaudio.service: Service RestartSec=500ms expired, scheduling restart.
Dec 16 09:28:16 quasar-nixos-tr systemd[1708]: pulseaudio.service: Scheduled restart job, restart counter is at 4.
Dec 16 09:28:16 quasar-nixos-tr systemd[1708]: Stopped Sound Service.
Dec 16 09:28:16 quasar-nixos-tr systemd[1708]: Starting Sound Service...
Dec 16 09:28:17 quasar-nixos-tr pulseaudio[2390]: E: [pulseaudio] socket-server.c: bind(): Address already in use
Dec 16 09:28:17 quasar-nixos-tr pulseaudio[2390]: E: [pulseaudio] module.c: Failed to load module "module-esound-protocol-unix" (argument: ""): initialization failed.
Dec 16 09:28:17 quasar-nixos-tr pulseaudio[2390]: E: [pulseaudio] main.c: D-Bus name org.PulseAudio1 already taken.
Dec 16 09:28:17 quasar-nixos-tr systemd[1708]: pulseaudio.service: Main process exited, code=exited, status=1/FAILURE
Dec 16 09:28:17 quasar-nixos-tr systemd[1708]: pulseaudio.service: Failed with result 'exit-code'.
Dec 16 09:28:17 quasar-nixos-tr systemd[1708]: Failed to start Sound Service.
Dec 16 09:28:17 quasar-nixos-tr systemd[1708]: pulseaudio.service: Service RestartSec=500ms expired, scheduling restart.
Dec 16 09:28:17 quasar-nixos-tr systemd[1708]: pulseaudio.service: Scheduled restart job, restart counter is at 5.
Dec 16 09:28:17 quasar-nixos-tr systemd[1708]: Stopped Sound Service.
Dec 16 09:28:17 quasar-nixos-tr systemd[1708]: pulseaudio.service: Start request repeated too quickly.
Dec 16 09:28:17 quasar-nixos-tr systemd[1708]: pulseaudio.service: Failed with result 'exit-code'.

ここではユーザーaudiosoundグループに属し、私はNixOSを使用しています。これは問題とは関係ないかもしれません。

ここで何が起こっているのかを助けることができる人はいますか?


また、ケース 2 にはalsamixerすべてのデバイスが正しくリストされています。

ベストアンサー1

ついに問題が見つかりました。ここ今後他の人がこの問題を偶然発見する場合に備えています。

おすすめ記事