Friday, December 30, 2011

How to redirect the ALSA output to a file? | Software View

How to redirect the ALSA output to a file? | Software View: "Have the following code in your ~/.asoundrc file:

pcm.!default {
    type plug
    slave {
        pcm rate48000Hz # Direct default output to the below converter
    }
}
pcm.rate48000Hz {
    type rate
    slave {
        pcm writeFile # Direct to the plugin which will write to a file
        format S16_LE
    #    channels 2
        rate 48000
    }
    #route_policy copy
}

pcm.writeFile {
    type file
    slave {
        pcm card0 # Now write to the actual sound card
    }
    file "aplay-D_card0-t_raw-f_S16_LE-r48000-c_2.raw"
    format "raw"
}

pcm.card0 {
    type hw
    card 0
}

ctl.card0 {
    type hw
    card 0
}"

'via Blog this'