How to create a virtual sound device in Linux?

9,299

You will have to edit ALSA configuration files in order to achieve this, which unfortunately involves a significant amount of black magic.

Here's an example taken from the ALSA wiki showing how to split a card's front and rear stereo outputs into two independent audio devices:

pcm.dshare {
    type dmix
    ipc_key 2048
    slave {
        pcm "hw:0"
        rate 44100
        period_time 0
        period_size 1024
        buffer_size 8192
        channels 4
    }
    bindings {
        0 0
        1 1
        2 2
        3 3
    }
}
pcm.frontx {
    type plug
    slave {
        pcm "dshare"
        channels 4
    }
    ttable.0.0 1
    ttable.1.1 1
}
pcm.rearx {
    type plug
    slave {
        pcm "dshare"
        channels 4
    }
    ttable.0.2 1
    ttable.1.3 1
}
Share:
9,299

Related videos on Youtube

rkrv.
Author by

rkrv.

Updated on September 17, 2022

Comments

  • rkrv.
    rkrv. over 1 year

    I am looking for a way to create a virtual sound device in Linux, which would use channel outputs of my sound card.

    I have no experience in Linux and therefore am asking more experienced users for help. I have latest Ubuntu Desktop 10.10 installed on my VirtualBox machine. What I want to do is to be able to create multiple virtual audio devices and then configure them to use different output channels of my M-Audio ProFire 610 sound card. The reason I want to do it is that I will use these devices in Java afterwards, and Java doesn't support directly selecting channels in the sound card, therefore I need to do it outside of Java.

    In OS X I can do this by messing arround with Audio MIDI Setup utility, maybe there is something ready made for Linux, too? This is how it looks on OS X:

    enter image description here

    enter image description here

    I am looking for any help, hints, tips - well anything that will help me achieve this.

    • jwernerny
      jwernerny about 13 years
      How you do it depends a lot on which version of Ubuntu (9.xx, 10.xx) you are running. Could you clarify? I am assuming you are just interested in audio devices, not MIDI.
    • rkrv.
      rkrv. about 13 years
      Thank you for your comment. I installed Ubuntu Desktop Edition 10.10 64bit, which I downloaded from the official website. After installation it went online and downloaded nearly 600mb of updates, too.
    • Admin
      Admin about 10 years
      please uncheck the definitive answer, it is now void of content - the link there is dead.
  • rkrv.
    rkrv. about 13 years
    Maybe you know if Ubuntu Desktop Edition 10.10 64bit comes with ALSA already installed?
  • Malvineous
    Malvineous about 13 years
    @rkrv.: These days ALSA is the only method for playing audio under Linux. There are other alternative access methods (OSS, JACK, etc.) but they all sit on top of ALSA. So yes, it's already installed :-)
  • Admin
    Admin about 10 years
    please add details to your answer, which was marked as definitive. as it is, it is void, because the link is dead
  • Malvineous
    Malvineous almost 10 years
    @cipricus: I have updated the external link and included the relevant content in my answer too. Hope this helps.