Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I can't seem to bend ALSA completely to my will, even after I spent a lot of time configuring it. I just do not seem to understand it well enough.

Here is my /etc/asound.conf:

pcm.dmixed {
        type asym
        playback.pcm {
                # See plugin:dmix at http://www.alsa-project.org/alsa-doc/alsa-lib/pcm_plugins.html
                type dmix

                # Don't block other users, e.g. the Timidity midi-player daemon
                # http://www.alsa-project.org/alsa-doc/alsa-lib/pcm_plugins.html
                ipc_key_add_uid true

                ipc_key 5678293
                ipc_perm 0660
                ipc_gid audio

                slave {
                        # 2 for stereo, 6 for surround51, 8 for surround71
                        channels 6
                        pcm {
                                format S32_LE
                                #format S16_LE

                                #rate 44100
                                rate 96000

                                # http://www.alsa-project.org/alsa-doc/alsa-lib/pcm_plugins.html
                                nonblock true

                                type hw
                                card 0
                                device 0
                                subdevice 0
                        }

                        period_size 1024

                        # If too large, use CONFIG_SND_HDA_PREALLOC_SIZE=2048
                        buffer_size 16384
                }
        }
        capture.pcm "hw:0"
}

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

pcm.!surround20 {
        type plug
        slave.pcm "upmix20_51"
}

pcm.!surround40 {
        type plug
        slave.pcm "dmixed"
        route_policy duplicate
}

pcm.!surround51 {
        type plug
        slave.pcm "dmixed"
}

pcm.upmix20_51 {
        slave.pcm "dmixed"
        slave.channels 6
        type route

        # Front and rear
        ttable.0.0 0.9
        ttable.1.1 0.9
        ttable.2.2 1
        ttable.3.3 1

        # Center and LFE
        ttable.4.4 1
        ttable.5.5 1

        # Front left/right to center
        ttable.0.4 0.5
        ttable.1.4 0.5

        # Front left/right to rear
        ttable.0.2 0.5
        ttable.1.3 0.5
}

What it currently achieves is:

  • Dmixing (I do not understand what this actually does, I think it ensures that the device will play sound no matter how many sources are outputting to alsa) with dmixed

  • Forces sample rate to 96Khz

  • Forces format to S32_LE (I think this works, although my media player doesn't say it works, I think it works because if I put S24_LE the sound will break.)

  • Upmix 2.0 sounds to 5.1 with "upmix20_51" which is set as a slave to the "!default" pcm which I think is the normal output for 2.0 files.

  • Upmix 4.0 to 5.1 via channel duplication (route_policy duplicate)

  • Plays 5.1 sound normally granted it uses the "!surround51" pcm as it should.

What I would like to know is:

  • What exactly is dmixing for?
  • Is the pcm.!surround20 redundant? (Should I just remove it?)
  • Can I check somehow if sample rate conversion is currently done with hardware or software?
  • Will forcing the Frequency to 96khz and format to 32-bit have any benefits for quality?
  • Will 5.1 sources ever use the "!default" pcm? And if it can happen, will the upmixing that is tied to it be problematic for that 5.1 source? Is there a better way to upmix 2.0 sources only?
  • How do I upmix Mono sound to Stereo sound and then upmix that Stereo sound to 5.1 sound
  • How do I downmix 7.1 sources (i.e. divide the side speakers between the front and rear speakers) to 5.1 in case I get one of those rare sources
  • Is there any better/higher quality method to do upmixing than what I am currently doing with alsa? Any method that allows for greater control over how the sound is mixed?
share|improve this question
1  
I can only answer to the first question, dmixing allows for multiplexion. If you don't use dmixing and you are playing music you won't be able to play a video from youtube with sound since the device is already in use. Dmixing allows to have different sources accessing the sound card at the same time therefore playing sounds from different aplications at the same time. –  YoMismo Jul 8 at 15:24
    
@YoMismo thanks! That's what I thought it did :) –  Cestarian Jul 9 at 11:05

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.