• Join
  • Sign In with my.TI Login
Texas Instruments
  • Products
  • Applications
  • Tools & Software
  • Support & Community
  • Sample & Buy
  • About TI
Sample & Purchase Cart Sample & Purchase Cart
  • Search
  • Advanced
TI E2E™ Community
  • Support Forums
  • Blogs
  • Groups
  • Videos
  • 简体中文
  • More ...
TI Home » TI E2E Community » Support Forums » Embedded Software » Android » Android forum » am3517 mic
Share
Android
  • Forum
Options
  • Subscribe via RSS

Forums

am3517 mic

This question is not answered
yanhong wu
Posted by yanhong wu
on Mar 23 2012 02:12 AM
Intellectual350 points

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

Report Abuse
  • Reply
You have posted to a forum that requires a moderator to approve posts before they are publicly available.
All Replies
  • Satish Patel
    Posted by Satish Patel
    on Mar 26 2012 23:05 PM
    Expert4350 points

    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)

    BR,

    Satish

     

    Kindly click the verify answer button on this post if it answer your question.

    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
  • yanhong wu
    Posted by yanhong wu
    on Mar 27 2012 01:00 AM
    Intellectual350 points

    Hi,Satish

    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
    #





    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
  • Satish Patel
    Posted by Satish Patel
    on Mar 27 2012 06:08 AM
    Expert4350 points

    Hi,

    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.

     

    BR,

    satish

    Kindly click the verify answer button on this post if it answer your question.

    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
  • yanhong wu
    Posted by yanhong wu
    on Mar 29 2012 00:49 AM
    Intellectual350 points

    Hi,

        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 ?

    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
  • Vishveshwar Bhat
    Posted by Vishveshwar Bhat
    on Mar 29 2012 02:27 AM
    Genius9580 points

    Have you checked the porting guide?

    http://processors.wiki.ti.com/index.php/TI-Android-GingerBread-2.3.4-DevKit-2.1_PortingGuides#Android_Audio_HAL_Configuration

    ---------------------------------------------------------------------------------------------------------

    Please click the Verify Answer button on this post if it answers your question.
    ---------------------------------------------------------------------------------------------------------

    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
  • yanhong wu
    Posted by yanhong wu
    on Mar 29 2012 03:54 AM
    Intellectual350 points

    Hi,Vishveshwar


       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");
    451
    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
    468
    469         }
    470     }
    471
    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:
          1)TI_Android_GingerBread_2_3_4Sources/device/ti/am3517evm/BoardConfig.mk
            11 #add
            12 ALSA_DEFAULT_SAMPLE_RATE := 44100
          2)TI_Android_GingerBread_2_3_4Sources/frameworks/base/include/media/AudioRecord.h
            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.

    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
  • Vishveshwar Bhat
    Posted by Vishveshwar Bhat
    on Mar 30 2012 01:00 AM
    Genius9580 points

    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.

    ---------------------------------------------------------------------------------------------------------

    Please click the Verify Answer button on this post if it answers your question.
    ---------------------------------------------------------------------------------------------------------

    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
  • Jian Zhou
    Posted by Jian Zhou
    on Apr 01 2012 00:56 AM
    Prodigy460 points

    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 .

    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
  • Vishveshwar Bhat
    Posted by Vishveshwar Bhat
    on Apr 02 2012 01:12 AM
    Genius9580 points

    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

    ---------------------------------------------------------------------------------------------------------

    Please click the Verify Answer button on this post if it answers your question.
    ---------------------------------------------------------------------------------------------------------

    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
  • Jian Zhou
    Posted by Jian Zhou
    on Apr 02 2012 08:28 AM
    Prodigy460 points

    Hi Vishveshwar,

    Thanks a lot for your great help!

    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
  • yanhong wu
    Posted by yanhong wu
    on Apr 03 2012 22:01 PM
    Intellectual350 points

    Thanks for all your help.

    Now I have another urgent task. Later I will debug it refer to the links you provided, and explain the result.

    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
TI E2E™ Community
  • Support Forums
  • Blogs
  • Videos
  • Groups
  • Site Support & Feedback
  • Settings
TI E2E™ Community Groups
  • TI University Program
  • Make the Switch
  • Microcontroller Projects
  • Motor Drive & Control
Other Communities
  • Deyisupport
  • Designsomething.org
  • beagleboard.org
  • TI on Element 14
  • TI on TechXchangeSM
Other Technical & Support Resources
  • WEBENCH® Design Center
  • Product Information Centers
  • Technical Documents
  • TI Design Network
  • TI Technical Articles
  • TI Training

All content and materials on this site are provided "as is". TI and its respective suppliers and providers of content make no representations about the suitability of these materials for any purpose and disclaim all warranties and conditions with regard to these materials, including but not limited to all implied warranties and conditions of merchantability, fitness for a particular purpose, title and non-infringement of any third party intellectual property right. TI and its respective suppliers and providers of content make no representations about the suitability of these materials for any purpose and disclaim all warranties and conditions with respect to these materials. No license, either express or implied, by estoppel or otherwise, is granted by TI. Use of the information on this site may require a license from a third party, or a license from TI.

Content on this site may contain or be subject to specific guidelines or limitations on use. All postings and use of the content on this site are subject to the Terms of Use of the site; third parties using this content agree to abide by any limitations or guidelines and to comply with the Terms of Use of this site. TI, its suppliers and providers of content reserve the right to make corrections, deletions, modifications, enhancements, improvements and other changes to the content and materials, its products, programs and services at any time or to move or discontinue any content, products, programs, or services without notice.

Follow Us Texas Instruments on Facebook Texas Instruments on Twitter Texas Instruments on LinkedIn Texas Instruments on Google+
TI Worldwide | Contact Us | my.TI Login | Site Map | Corporate Citizenship | mobile m.ti.com (Mobile Version)

TI is a global semiconductor design and manufacturing company. Innovate with 100,000+ analog ICs and
embedded processors, along with software, tools and the industry’s largest sales/support staff.

© Copyright 1995-2013 Texas Instruments Incorporated. All rights reserved.
Trademarks | Privacy Policy | Terms of Use