xiongyihui / notes

Notes
https://xiongyihui.github.io/notes/
3 stars 0 forks source link

Configure ALSA #6

Open xiongyihui opened 7 years ago

xiongyihui commented 7 years ago
  1. Use plug plugin to support any sample rate and any channel number.
pcm.!default {
    type plug
    slave {
        format S16_LE
        rate 48000
        channels 2
        pcm "hw:0,0"
    }
}
  1. Use dmix plugin to mix multiple streams, which allows multiple applications play simultaneously.
pcm.!default {
    type plug
    slave.pcm "dm"
}

pcm.dm {
    type dmix
    ipc_key 1024
    slave {
        pcm "hw:0,0"
    }
}
  1. Use dsnoop plugin to enable several applications to record from the same device simutaneously.
pcm.dsnooped {
    type dsnoop
    slave {
        pcm "hw:0,0" 
        channels 2 
    }
}
  1. Use asym plugin to separate capture and playback.
pcm.!default {
    type plug
    slave.pcm {
        type asym
        playback.pcm {
            type hw
            card 1
            rate 64000
            format S16_LE
        }
        capture.pcm {
            type hw
            card 1
            rate 48000
            format S16_LE
        }
    }
}