1

I'm using my Ubuntu 14.04 LTS Laptop toplay music at a party. I'm using Mixxx and is performs very well for that task. Now I'd like to add some light effects and plan to use Qlcplus for that. So I need to send the sound from Mixxx to the soundcard and Qlcplus.

I've managed to configure Mixxx to send sound to the ALSA loopback and recover it from there in Qlcplus. But then I have no sound output. How can I route sound from the ALSA loopback to speakers ?

  • Please bechmark between QLCplus and PortAudio , maybe you choose PortAudio.... – PersianGulf Dec 23 '14 at 23:26
  • I'm confused, portaudio is an audio library and qlcplus is a stage light control application. How can I benchmark a library against an application ? – markus_b Dec 24 '14 at 8:59
0

After lots of searching I've found the answer to my question. You need to appropriately configure ALSA and it will provide a new device which duplicates sound sent to it to two or more devices like soundcards and the loopback device.

Here the .asoundrc file I use:

# 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
  }
}

This file will provide a new ALSA sound device 'CardAndLoop'. If you choose this device in your sound application the sound will be sent to the 'PCH' sound card and the loopback device. You can start a second application and use the loopback device as input and it will obtain the sound played by the 1st application.

I used names to denominate the sound devices. These names can be taken from the /proc/asound/cards file:

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

Have fun !

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.