How to create a virtual sound device in Linux?

4

1

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.

rkrv.

Posted 2011-02-23T08:59:21.723

Reputation: 63

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. – jwernerny – 2011-02-24T17:59:48.643

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. – rkrv. – 2011-02-25T08:45:20.363

please uncheck the definitive answer, it is now void of content - the link there is dead. – None – 2014-05-11T18:28:23.227

Answers

2

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
}

Malvineous

Posted 2011-02-23T08:59:21.723

Reputation: 1 881

Maybe you know if Ubuntu Desktop Edition 10.10 64bit comes with ALSA already installed? – rkrv. – 2011-03-21T11:59:22.663

@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 :-) – Malvineous – 2011-03-22T10:21:34.747

please add details to your answer, which was marked as definitive. as it is, it is void, because the link is dead – None – 2014-05-11T18:21:42.570

@cipricus: I have updated the external link and included the relevant content in my answer too. Hope this helps. – Malvineous – 2014-06-06T09:39:48.453