Concurrent audio playback streams via asound

Just wondering if anyone has run into the issue where you can only playback one device at a time on the nano through the default asound configuration file that is included with L4T. We are using mpg123 to play audio files in our application, and this limitation was causing problems as the app would crash if the audio device was in use. We were able to work around it using a custom asound / dmixer setup below (replaced the default asound.conf with thisfile) but wondering if anyone else has had got it working through another means?

# Custom asound configuration to allow for multiple concurrent audio streams playing
pcm.dmixed {
    type dmix
    ipc_key 1024
    ipc_key_add_uid 0
    slave {
            pcm "hw:tegrahda,3"
            channels 2
            rate 48000
    }
}

pcm.dsnooped {
    type dsnoop
    ipc_key 1025
    slave {
            pcm "hw:tegrahda,3"
            channels 2
            rate 48000
    }
}

pcm.duplex {
    type asym
    playback.pcm "dmixed"
    capture.pcm "dsnooped"
}

# Instruct ALSA to use pcm.duplex as the default device
pcm.!default {
    type plug
    slave.pcm "duplex"
}

ctl.!default {
    type hw
    card Tegra
}

Hello!

Thanks for the feedback. Yes by default it will only allow you to have one instance of play/capture to a given interface at once. I am not aware of any particular reason for that, other than it is legacy default setting. That said you can playback to different interfaces (HDMI, I2S, DSPK, etc) at the same time.

Another alternative to your solution would be to use pulseaudio as the default playback device …

pcm.!default {
    type pulse
    hint {
        show on
        description "Playback/recording through the PulseAudio sound server"
    }
}

ctl.!default {
    type pulse
}

You may need to ensure that the default sink is set correctly in the Sound Settings menu under the Ubuntu desktop settings.

Regards,
Jon