• Not Answered

am3517 mic

Hello, everyone

I am in debugging mic recording function. The platform is am3517evm. The system is TI-Android-GingerBread-2.3.4-DevKit-2.1.

In the Linux file system, use the following command to test, it is easy to use.
[root@ContecARM /]# amixer -c 0 sset 'Mic Input',0 100%,100% unmute cap

[root@ContecARM /]#arecord -d 10 -f cd -t wav 1.wav
[root@ContecARM /]#aplay foobar.wav

But in the Android file system, i use the SoundRecorder UI application to test, I can't record the sound.
The log is:0334.log.txt

11 Replies

  • Hi,

    From the log, I could see

    permission denied for "/etc/dbus.conf"

    Kindly give proper permission to this file

    chmod 777 /etc/dbus.conf ( one can add this line to init.rc file to make the change permanent)




  • In reply to Satish Patel:


    Thank you very much for your reply

    Now I can use the SoundRecorder application for recording sound.  But there is a new problem, When I play back the recorded files, sound is very small.

    # alsa_amixer contents
    numid=3,iface=MIXER,name='Line Input Switch'
      ; type=BOOLEAN,access=rw------,values=2
      : values=on,on
    numid=4,iface=MIXER,name='Line Input Volume'
      ; type=INTEGER,access=rw---R--,values=2,min=0,max=31,step=0
      : values=23,23
      | dBscale-min=-17.25dB,step=0.75dB,mute=0
    numid=6,iface=MIXER,name='Mic Booster Switch'
      ; type=BOOLEAN,access=rw------,values=1
      : values=off
    numid=5,iface=MIXER,name='Mic Input Switch'
      ; type=BOOLEAN,access=rw------,values=1
      : values=on
    numid=12,iface=MIXER,name='Capture Source'
      ; type=ENUMERATED,access=rw------,values=1,items=2
      ; Item #0 'Line'
      ; Item #1 'Mic'
      : values=1
    numid=8,iface=MIXER,name='Playback De-emphasis'
      ; type=ENUMERATED,access=rw------,values=1,items=4
      ; Item #0 'None'
      ; Item #1 '32Khz'
      ; Item #2 '44.1Khz'
      ; Item #3 '48Khz'
      : values=2
    numid=2,iface=MIXER,name='Digital Playback Switch'
      ; type=BOOLEAN,access=rw------,values=1
      : values=off
    numid=1,iface=MIXER,name='Digital Playback Volume'
      ; type=INTEGER,access=rw---R--,values=2,min=0,max=127,step=0
      : values=0,111
      | dBscale-min=-121.00dB,step=1.00dB,mute=0
    numid=9,iface=MIXER,name='Output Mixer Line Bypass Switch'
      ; type=BOOLEAN,access=rw------,values=1
      : values=off
    numid=10,iface=MIXER,name='Output Mixer Mic Sidetone Switch'
      ; type=BOOLEAN,access=rw------,values=1
      : values=off
    numid=11,iface=MIXER,name='Output Mixer Playback Switch'
      ; type=BOOLEAN,access=rw------,values=1
      : values=on
    numid=7,iface=MIXER,name='Sidetone Volume'
      ; type=INTEGER,access=rw---R--,values=1,min=0,max=4,step=0
      : values=3
      | dBscale-min=-18.00dB,step=3.00dB,mute=0

  • In reply to yanhong wu:


    Kindly look for alsa-mixer settings, which can increase recording amplitude. I do not have much idea on that.

    Also, see if media volumme is proper. Play some media from music player and check the volumme.




  • In reply to Satish Patel:


        I think my problem is due to the sampling frequency and the number of channels is not set correctly.

    I try to modify the alsa_module.cpp, set the sampling frequency of 44100Hz, channel number is 2, but it failed.
    Log is 0511.log.txt

    I want to know how to modify them in the Android file system ?

  • In reply to Vishveshwar Bhat:


       Thank you very much for your reply.

       I have checked that porting guide.

       1.I have tested it using ALSA utilities. It worked well.
       # ln -s /system/bin/alsa_aplay /system/bin/alsa_arecord
       # alsa_amixer -c 0 sset 'Mic Input',0 100%,100% unmute cap
         Simple mixer control 'Mic Input',0
         Capabilities: pswitch pswitch-joined
         Playback channels: Mono
         Mono: Playback [on]
      # alsa_arecord -f cd | alsa_aplay
        Recording WAVE 'stdin' : Signed 16 bit Little Endian, Rate 44100 Hz, Stereo
        Playing WAVE 'stdin' : Signed 16 bit Little Endian, Rate 44100 Hz, Stereo
       ^CAborted by signal Interrupt...
       Aborted by signal Interrupt...

       2.Alsa_module.cpp file is modified as follows:
         447 void setDefaultControls(uint32_t devices, int mode)
    448 {
    449 LOGV("%s", __FUNCTION__);
    450     ALSAControl control("hw:00");
    452     /* check whether the devices is input or not */
    453     /* for output devices */
    454     if (devices & 0x0000FFFF){
    455         if (devices & AudioSystem::DEVICE_OUT_SPEAKER) {
    456             //control.set("HeadsetR Mixer AudioR1", 1); // on
    457             //control.set("HeadsetL Mixer AudioL1", 1); // on
    458             //control.set("Headset Playback Volume", 1); //Headset Volume
    459             control.set("Output Mixer Playback Switch", 1); // on
    460             control.set("Digital Playback Switch", 1); // on
    461             control.set("Digital Playback Volume", 127); // Volume
    462             LOGE("*******output mixer playback switcaaaaabbbbbb*******");
    463         } else {
    464             //control.set("HeadsetR Mixer AudioR1", (unsigned int)0); // off
    465             //control.set("HeadsetL Mixer AudioL1", (unsigned int)0); // off
    466             control.set("Digital Playback Switch", (unsigned int)0); // off
    467             control.set("Output Mixer Playback Switch", (unsigned int)0); // off
    469         }
    470     }
    472     /* for input devices */
    473     if (devices >> 16) {
    474         if (devices & AudioSystem::DEVICE_IN_BUILTIN_MIC) {
    475         //change wu
    476         //control.set("Analog Left AUXL Capture Switch", 1); //on
    477         //control.set("Analog Right AUXR Capture Switch", 1); //on
    478         //control.set("Analog Capture Volume", (unsigned int)0); //Capture volume '0' to capture less noice
    479         control.set("Mic Input Switch", 1); //on
    480         control.set("Mic Booster Switch", 1); //on
    481         LOGE("*******output mixer playback switcccccccddddddddd*********");
    482         //change wu end
    483         } else {
    484         //control.set("Analog Left AUXL Capture Switch", (unsigned int)0); //off
    485         //control.set("Analog Right AUXR Capture Switch", (unsigned int)0); //off
    486         control.set("Mic Booster Switch", (unsigned int)0); //on
    487         control.set("Mic Input Switch", (unsigned int)0); //off
    488         }
    489     }
    490 }
          In this case I can record, but the sound is very small, and there is noise.
          In addition, Sometimes mclk = 12000000, sample_rate_adc = 8000, sample_rate_dac = 44100
          When this happens,Recording time for 10s ,Play time for 30s or longer,and there is no sound.I don't know why this happens.

         3.Now, I want to put the sampling frequency to 44100Hz.I modify the following files:
            11 #add
            12 ALSA_DEFAULT_SAMPLE_RATE := 44100
            41 //change
            42     //static const int DEFAULT_SAMPLE_RATE = 8000;
            43     static const int DEFAULT_SAMPLE_RATE = 44100;
         After modification, phenomenon is still the same,I don't known how to put the sampling frequency to 44100Hz.

  • In reply to yanhong wu:

    AFAIK the stock AOSP code (from which TI Android DevKit is derived) supports only 8kHz sampling rate for recording. You may need some changes in frameworks to support 44.1kHz sampling rate for mic input.

    Suggest you to look at omapzoom Android for this.

  • In reply to Vishveshwar Bhat:

    So in the Android-GingerBread-2.3.4-Devkit-2.1 which is the latest version for AM3517, the sampling rate is 8kHz? Could you give us some guideline for framework changing for adding 44.1kHz support, such as which file we should modify, or provide the git path for omapzoom Android .

  • In reply to Jian Zhou:

    The omapzoom android sources are available at: http://git.omapzoom.org/

    You should probably look at the p-gingerbread branches in frameworks/base, hardware/ti/omap3 etc

    If you need any further help on this you can refer their wiki pages at: http://www.omappedia.com/wiki/OMAP_Android_Main

  • In reply to Vishveshwar Bhat:

    Hi Vishveshwar,

    Thanks a lot for your great help!