Re: [linux-audio-user] .asoundrc for dummies

From: Novensiles divi Flamen <noven@email-addr-hidden>
Date: Thu Oct 19 2006 - 13:50:48 EEST

On Thursday 19 October 2006 17:34, Mathias Friman wrote:
>
> I wonder if anyone got easy-to-understand links for this, except the
> ALSA-wiki and the Gentoo ALSA-howto? These both round up an endless number
> of examples, but does leave out (IMHO) important parts that is needed for a
> thourough understanding if you're a moron like me. ;)
>
No howto on hand, but maybe I can answer some questions

> For example:
>
> pcm.!default {
> type asym
> playback.pcm {
> type plug
> slave.pcm "hw:0,0"
> }
> capture.pcm {
> type plug
> slave.pcm "hw:1,0"
> }
> }
>
> This overrides the default setting,
> uses type asym (which is what exactly? asymmetrical, yes, but what does
> that mean?) sets a playback.pcm (which is defined where originally?)
>
asym means the control is used for both play and record.

> Why does it say 'slave.pcm "hw:0,0"' and nothing like:
>
> pcm_slave.sltest {
> pcm ens1371
> }
>
> and what is the difference?
>
hw:0,0 is a syntax for the first alsa device, regardless of *what* device it
actually is. So the config will work regardless of what card you have.

> So, anyone got tips, links, an hour to spare or whatever? All is welcome.
>
A while ago I did some research and tweaking to make a .asoundrc with
program-specific controls. The theory is taken from a website which I really
should reference but can't recall. Maybe the file will be of use to you? It
creates a number of useable controls, and then you tell the actual program to
use the named control.

It should show a logical chain of events. Feel free to ask questions about it.

# ALSA controls to enable software mixers
# PCM output devices
pcm.output_main
{
        type dmix
        ipc_key 1024
        ipc_perm 0666

        slave
        {
                pcm "hw:0,0"
                period_time 0
                period_size 1024
                buffer_size 8192
        }
}

bindings
{
        0 0
        1 1
}
# PCM input devices
pcm.input_mic
{
        type dsnoop
        ipc_key 2048
        slave.pcm "hw:0,0"
}
# Asym devices
# use input and output at the same time

pcm.asym_main_mic
{
        type asym
        playback.pcm "output_main_control"
        capture.pcm "input_mic"
}
# Hardware control devices

ctl.mixer0
{
        type hw
        card 0
}

# Volume controls

pcm.output_main_control
{
        type softvol
        slave.pcm "output_main"

        control
        {
                name "All"
                card 0
        }
}
pcm.default_control
{
        type softvol
        slave.pcm "asym_main_mic"

        control
        {
                name "Unassigned"
                card 0
        }
}

pcm.xmms_control
{
        type softvol
        slave.pcm "output_main_control"

        control
        {
                name "XMMS"
                card 0
        }
}
pcm.film_control
{
        type softvol
        slave.pcm "output_main_control"

        control
        {
                name "Film"
                card 0
        }
}

pcm.psi_control
{
        type softvol
        slave.pcm "output_main_control"

        control
        {
                name "Psi"
                card 0
        }
}

pcm.skype_control
{
        type softvol
        slave.pcm "asym_main_mic"

        control
        {
                name "Skype"
                card 0
        }
}

pcm.system_control
{
        type softvol
        slave.pcm "asym_main_mic"
        control
        {
                name "System"
                card 0
        }
}

# OSS devices (Audacity) - doesn't quite work as expected. Fix sometime.

pcm.output_oss
{
        type softvol
        slave.pcm "asym_main_mic"

        control
        {
                name "OSS"
                card 0
        }
}

pcm.dsp0
{
        type plug
        slave.pcm "output_oss"
}

# Default ALSA devices

pcm.!default
{
        type plug
        slave.pcm "default_control"
}

pcm.default
{
        type plug
        slave.pcm "default_control"
}

# Custom app plug devices

pcm.xmms
{
        type plug
        slave.pcm "xmms_control"
}

pcm.film
{
        type plug
        slave.pcm "film_control"
}

pcm.psi
{
        type plug
        slave.pcm "psi_control"
}

pcm.skype
{
        type plug
        slave.pcm "skype_control"
}

pcm.system
{
        type plug
        slave.pcm "system_control"
}

# To make the mixer devices available you need to run the following commands
# aplay /path/to/a.wav -D film
# aplay /path/to/a.wav -D psim
# aplay /path/to/a.wav -D system
# aplay /path/to/a.wav -D xmms
# aplay /path/to/a.wav -D skype
# aplay /path/to/a.wav

- Noven

-- 
>-- Novensiles divi Flamen --<
>---- Miles Militis Fons ----<

Received on Fri Oct 20 00:15:01 2006

This archive was generated by hypermail 2.1.8 : Fri Oct 20 2006 - 00:15:02 EEST