Record android system audio

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Record android system audio

Jump to solution
3,847 Views
MustafaMunir
Contributor II

Hi,

I want to record android system audio output on file. On Linux, I have configure a .asoundrc file in my home directory to achieve this. That allows me to record system audio as a wave file on disk.

Is the same mechanism possible with android for i.MX53 ? Does alsa in android reads configuration from /system/etc/asound.conf ? or its configuration is simply hard coded in alsa source.

Thanks

Mustafa

Labels (3)
1 Solution
2,087 Views
RafaelThomasGoz
Contributor III

Here it is:

state.imx3stack {

    control.1 {

        comment.access 'read write'

        comment.type ENUMERATED

        comment.count 1

        comment.item.0 '0dB'

        comment.item.1 '20dB'

        comment.item.2 '30dB'

        comment.item.3 '40dB'

        iface MIXER

        name 'MIC GAIN'

        value '0dB'

    }

    control.2 {

        comment.access 'read write'

        comment.type INTEGER

        comment.count 2

        comment.range '0 - 15'

        iface MIXER

        name 'Capture Volume'

        value.0 15

        value.1 15

    }

    control.3 {

        comment.access 'read write'

        comment.type ENUMERATED

        comment.count 1

        comment.item.0 'No Change'

        comment.item.1 'Reduced by 6dB'

        iface MIXER

        name 'Capture Vol Reduction'

        value 'No Change'

    }

    control.4 {

        comment.access 'read write'

        comment.type INTEGER

        comment.count 2

        comment.range '0 - 192'

        iface MIXER

        name 'Playback Volume'

        value.0 192

        value.1 192

    }

    control.5 {

        comment.access 'read write'

        comment.type INTEGER

        comment.count 2

        comment.range '0 - 127'

        iface MIXER

        name 'Headphone Volume'

        value.0 127

        value.1 127

    }

    control.6 {

        comment.access 'read write'

        comment.type ENUMERATED

        comment.count 1

        comment.item.0 DAC

        comment.item.1 LINE_IN

        iface MIXER

        name 'DAC Mux'

        value DAC

    }

    control.7 {

        comment.access 'read write'

        comment.type ENUMERATED

        comment.count 1

        comment.item.0 MIC_IN

        comment.item.1 LINE_IN

        iface MIXER

        name 'ADC Mux'

        value LINE_IN

    }

    control.8 {

        comment.access 'read write'

        comment.type ENUMERATED

        comment.count 1

        comment.item.0 disable

        comment.item.1 '32KHz'

        comment.item.2 '44.1KHz'

        comment.item.3 '48KHz'

        comment.item.4 '96KHz'

        iface MIXER

        name ASRC

        value disable

    }

    control.9 {

        comment.access 'read write'

        comment.type ENUMERATED

        comment.count 1

        comment.item.0 off

        comment.item.1 on

        iface MIXER

        name 'Jack Function'

        value on

    }

    control.10 {

        comment.access 'read write'

        comment.type ENUMERATED

        comment.count 1

        comment.item.0 off

        comment.item.1 on

        iface MIXER

        name 'Speaker Function'

        value on

    }

    control.11 {

        comment.access 'read write'

        comment.type ENUMERATED

        comment.count 1

        comment.item.0 off

        comment.item.1 on

        iface MIXER

        name 'Line In Function'

        value on

    }

}

state.imx3stackspdif {

    control.1 {

        comment.access 'read write'

        comment.type ENUMERATED

        comment.count 1

        comment.item.0 off

        comment.item.1 on

        iface MIXER

        name 'Speaker Function'

        value on

    }

}


View solution in original post

6 Replies
2,087 Views
RafaelThomasGoz
Contributor III

Well i have tested with an asound.conf and it seems to change the alsa configurations. However for some reason it doesn't get effective until android plays any audio once.

0 Kudos
Reply
2,087 Views
MustafaMunir
Contributor II

If that’s the case, I might be making some mistake in asound.conf. It would be great if you can share your asound.conf and I can test that on my Platform.

Thanks

0 Kudos
Reply
2,088 Views
RafaelThomasGoz
Contributor III

Here it is:

state.imx3stack {

    control.1 {

        comment.access 'read write'

        comment.type ENUMERATED

        comment.count 1

        comment.item.0 '0dB'

        comment.item.1 '20dB'

        comment.item.2 '30dB'

        comment.item.3 '40dB'

        iface MIXER

        name 'MIC GAIN'

        value '0dB'

    }

    control.2 {

        comment.access 'read write'

        comment.type INTEGER

        comment.count 2

        comment.range '0 - 15'

        iface MIXER

        name 'Capture Volume'

        value.0 15

        value.1 15

    }

    control.3 {

        comment.access 'read write'

        comment.type ENUMERATED

        comment.count 1

        comment.item.0 'No Change'

        comment.item.1 'Reduced by 6dB'

        iface MIXER

        name 'Capture Vol Reduction'

        value 'No Change'

    }

    control.4 {

        comment.access 'read write'

        comment.type INTEGER

        comment.count 2

        comment.range '0 - 192'

        iface MIXER

        name 'Playback Volume'

        value.0 192

        value.1 192

    }

    control.5 {

        comment.access 'read write'

        comment.type INTEGER

        comment.count 2

        comment.range '0 - 127'

        iface MIXER

        name 'Headphone Volume'

        value.0 127

        value.1 127

    }

    control.6 {

        comment.access 'read write'

        comment.type ENUMERATED

        comment.count 1

        comment.item.0 DAC

        comment.item.1 LINE_IN

        iface MIXER

        name 'DAC Mux'

        value DAC

    }

    control.7 {

        comment.access 'read write'

        comment.type ENUMERATED

        comment.count 1

        comment.item.0 MIC_IN

        comment.item.1 LINE_IN

        iface MIXER

        name 'ADC Mux'

        value LINE_IN

    }

    control.8 {

        comment.access 'read write'

        comment.type ENUMERATED

        comment.count 1

        comment.item.0 disable

        comment.item.1 '32KHz'

        comment.item.2 '44.1KHz'

        comment.item.3 '48KHz'

        comment.item.4 '96KHz'

        iface MIXER

        name ASRC

        value disable

    }

    control.9 {

        comment.access 'read write'

        comment.type ENUMERATED

        comment.count 1

        comment.item.0 off

        comment.item.1 on

        iface MIXER

        name 'Jack Function'

        value on

    }

    control.10 {

        comment.access 'read write'

        comment.type ENUMERATED

        comment.count 1

        comment.item.0 off

        comment.item.1 on

        iface MIXER

        name 'Speaker Function'

        value on

    }

    control.11 {

        comment.access 'read write'

        comment.type ENUMERATED

        comment.count 1

        comment.item.0 off

        comment.item.1 on

        iface MIXER

        name 'Line In Function'

        value on

    }

}

state.imx3stackspdif {

    control.1 {

        comment.access 'read write'

        comment.type ENUMERATED

        comment.count 1

        comment.item.0 off

        comment.item.1 on

        iface MIXER

        name 'Speaker Function'

        value on

    }

}


2,087 Views
li-chen
Contributor II

Hi, we also would like to capture the Android system audio on i.MX6. Is there an asound.conf available for i.MX6 platform so that we can use it to capture the Android system audio? Many thanks.

0 Kudos
Reply
2,087 Views
RafaelThomasGoz
Contributor III

I have not used mx6 yet, but will. However the alsa-ctl would give you the config options (then you need to transalte them to the asound.conf)

0 Kudos
Reply
2,087 Views
li-chen
Contributor II

Hi Rafael,

By alsa-ctl, do you mean tinymix? We have limited experience in setting up the asound.conf. Could you recommend a few links where we should read in order to configure asound.conf properly for capturing the sound on i.MX6? We found this link, http://permalink.gmane.org/gmane.linux.embedded.yocto.meta-freescale/5124, but we don't know exactly what parameters should be changed in order to capture system audio on i.MX6. Any pointer is greatly appreciated. Thanks again!

0 Kudos
Reply