애플리케이션 및 스피커로 사운드 출력 보내기

애플리케이션 및 스피커로 사운드 출력 보내기

저는 파티에서 음악을 재생하기 위해 Ubuntu 14.04 LTS 노트북을 사용하고 있습니다. 저는 Mixxx를 사용하고 있으며 이 작업에 매우 효과적입니다. 이제 조명 효과를 추가하고 Qlcplus를 사용할 계획입니다. 그래서 Mixxx의 사운드를 사운드 카드와 Qlcplus로 보내야 합니다.

ALSA 루프백으로 사운드를 보내고 Qlcplus에서 복구하도록 Mixxx를 성공적으로 구성했습니다. 그런데 소리가 출력되지 않습니다. ALSA 루프백의 사운드를 스피커로 어떻게 라우팅합니까?

답변1

많은 검색 끝에 내 질문에 대한 답을 찾았습니다. ALSA를 올바르게 구성해야 합니다. ALSA는 전송된 사운드를 사운드 카드 및 루프백 장치와 같은 두 개 이상의 장치에 복사하는 새 장치를 제공합니다.

내가 사용하는 .asoundrc 파일은 다음과 같습니다.

# If you want this to be the default, then you
# need to override the default device and provide
# a playback path to the CardAndLoop and a capture
# path to whatever soundcard you have (here the 1st card)
#pcm.!default {
#  type asym
#  playback.pcm "CardAndLoop"
#  capture.pcm "hw:0,0"
#}

# This is the interface you use for sound output
# It will send the output to the soundcard and loopback device
pcm.CardAndLoop {
  type plug
  slave.pcm MultiCh
  route_policy "duplicate"
}

# Virtual multichannel device with four channels
# two the for the soundcard, two for the loopback
pcm.MultiCh {
  type multi
  slaves.a.pcm pcm.MixCard
  slaves.a.channels 2
  slaves.b.pcm pcm.MixLoopback
  slaves.b.channels 2
  bindings.0.slave a
  bindings.0.channel 0
  bindings.1.slave a
  bindings.1.channel 1
  bindings.2.slave b
  bindings.2.channel 0
  bindings.3.slave b
  bindings.3.channel 1
}

# Mixer for the soundcard
pcm.MixCard {
  type dmix
  ipc_key 1024
  slave {
#    pcm "hw:Conectiv,0"
    pcm "hw:PCH,0"
#    rate 48000
    rate 44100
    periods 128
    period_time 0
    period_size 1024 # must be power of 2
    buffer_size 8192
  }
}

# Mixer for the loopback
pcm.MixLoopback {
  type dmix
  ipc_key 1025
  slave {
    pcm "hw:Loopback,0"
#    rate 48000
    rate 44100
    periods 128
    period_time 0
    period_size 1024 # must be power of 2
    buffer_size 8192
  }
}

이 파일은 새로운 ALSA 사운드 장치 "CardAndLoop"를 제공합니다. 사운드 응용 프로그램에서 이 장치를 선택하면 사운드가 "PCH" 사운드 카드와 루프백 장치로 전송됩니다. 두 번째 애플리케이션을 실행하고 루프백 장치를 입력으로 사용하면 첫 번째 애플리케이션에서 사운드가 재생됩니다.

나는 사운드 장치의 이름을 이름으로 지정합니다. 이러한 이름은 /proc/asound/cards 파일에서 얻을 수 있습니다:

$ cat /proc/asound/cards
0 [PCH            ]: HDA-Intel - HDA Intel PCH
                     HDA Intel PCH at 0xf5330000 irq 44
2 [Loopback       ]: Loopback - Loopback
                     Loopback 1

재미있게 보내세요!

관련 정보