Menu

Configuration

Thomas Sparber

Configuration

It is very important to have a clean configuration so that every sound channel works properly.
Here are just some examples on how to configure /etc/asound.conf. For more information on how to configure ALSA to work properly please visit their wiki.

/etc/asound.conf

First, let's look at a very simple example:

pcm_slave.stereo {
        pcm "hw:0,0"            # or "hw:1,0" for the second card
        channels 2
}
pcm.mono1 {
        type plug
        slave.pcm {
                type dshare
                ipc_key 87882222
                slave stereo
                bindings [ 0 ]  # bind the first channel of the physical audiodevice to this virtual one
        }
}
pcm.mono2 {
        type plug
        slave.pcm {
                type dshare
                ipc_key 87882222
                slave stereo
                bindings [ 1 ]  # bind the second channel of the physical audiodevice to this virtual one
        }
}

First we define our slave that uses hw:0,0. This means we use the first audio device. And we use 2 channels. Then we create two mono devices (called mono1 and mono2) and bind one channel to each.

The next example configuration shows how to configure a dolby sorround 7.1 card:

pcm_slave.eightchannels {
   pcm "hw:0,0"            # or "hw:1,0" for the second card
        channels 8
}
pcm.mono1 {
        type plug
        slave.pcm {
                type dshare
                ipc_key 87882222
                slave eightchannels
                bindings [ 0 ]
        }
}
pcm.mono2 {
        type plug
        slave.pcm {
                type dshare
                ipc_key 87882222
                slave eightchannels
                bindings [ 1 ]
        }
}
...

It is more ore less the same with the exception that we just use 8 instead of 2 channels.

The next configuration now is very complex and you should read through the ALSA manual pages:

pcm.!default {
    type asym
    playback.pcm "dshare"
    capture.pcm "dsnooper"
}

pcm.dsnooper {
    type dsnoop
    ipc_key 2048
    ipc_perm 0666 
    slave {
        period_time 0
        period_size 1024
        buffer_size 4096
        rate 44100
        format S32_LE
        pcm "hw:1,0"
        channels 2
    }
    bindings {
        0 0
        1 1
    }
}

pcm.dshare {
    type dmix
    ipc_key 2048
    ipc_key_add_uid false # let multiple users share
    ipc_perm 0660 # IPC permissions (octal, default 0600)
    ipc_gid audio
    slave {
        pcm "hw:1,0"
        channels 8
    }
}

pcm.mono1 {
    type plug
    slave {
        pcm "dshare"
        channels 8
    }
    ttable.0.0 1
}

pcm.mono2{
    type plug
    slave {
        pcm "dshare"
        channels 8
    }
    ttable.0.1 1
}
...

The basic idea here is that we create an audio device which is able to capture and playback. From that device we create some subdevices (mono1, mono2...)

These lines here are just some exampples and I don't guarantee that this works for you. Please read the ALSA manuals for more information

sound.conf

In this file should be placed either in /usr/share/soundserver/sound.conf or in the same folder as the server executable. In this file you have to put your SoundServer specific configuration. This means devices and playlists.
Every Device definition starts with "DEVICE START" and ends with "DEVICE END". In between you have to specify the ALSA-device name you configured in /etc/asound.conf, the sample rate and the amount of channels. Please note that the channels don't work the right way at the moment and you should set it to 2.
Every playlist starts with "PLAYLIST START" and ends with "PLAYLIST END". In between you have to specify the name and the type of the device.
type="Folder" means that this playlist consists of audiofiles (ogg). The folder of the files must be specified with the path-tag.
type="Device" means that this playlist is "the output of an input device" like line-in or microphone. You have to specify the input-device name with the device-tag.

Here an example configuration:

DEVICE START
    name = "mono1"
    sampleRate = "44100"
    channels = "2"
DEVICE END

DEVICE START
    name = "mono2"
    sampleRate = "44100"
    channels = "2"
DEVICE END

PLAYLIST START
    name = "P1"
    type="Folder"
    path = "/home/user/Music/P1"
PLAYLIST END

PLAYLIST START
    name = "P2"
    type="Folder"
    path = "/home/user/Music/P2"
PLAYLIST END

PLAYLIST START
    name = "Radio"
    type="Device"
    device = "default"
PLAYLIST END

Related

Wiki: Home

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.