This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Android "Music" App Doesn't Output Audio - But alsa_aplay Does Fine

Other Parts Discussed in Thread: OMAP3530

I am working on porting GingerBread_2_3_4_DevKit_2_1 to our omap3530 board.  I have Android booting and allowing me to access the "Music" app.  I can use it to select and play some WAV files (44.1kHz stereo format) that I have put on my SD card--but I don't hear anything.

I can use the alsa_aplay and alsa_amixer commands that are in the Android filesystem to enable the "HeadsetR Mixer AudioR1" and "HeadsetL Mixer AudioL1" mixer elements and then play my WAV file, and I do hear the audio.

I noted that the deviceName() function in hardware/ti/omap3/modules/alsa/alsa_module.cpp expects the device name to be "default", so I confirmed that alsa_aplay would work with that specific device:

alsa_aplay -D default /sdcard/file.wav

I have run init.rc with a log level of 8, but there is no indication of any problem with audio or alsa.

Any suggestions on what might be wrong?

Thanks in advance,

Chris

  • Hi Chris,

    Is your audio output device is different from OMAP3 evm?

    If you are able to hear the audio when you set the controls "HeadsetR Mixer AudioR1" and "HeadsetL Mixer AudioL1",

    then modify the following code in hardware/ti/omap3/modules/alsa/alsa_module.cpp (Audio HAL)

    By default the code takes the route which sets "HeadsetR Mixer AudioR2" and "HeadsetR Mixer AudioL2".

    Modify the first portion of the if (devices & AudioSystem::DEVICE_OUT_SPEAKER) to set the controls

    "HeadsetR Mixer AudioR1" and "HeadsetL Mixer AudioL1" instead and build the file system.

    void setDefaultControls(uint32_t devices, int mode)
    {
    LOGV("%s", __FUNCTION__);
        ALSAControl control("hw:00");

        /* check whether the devices is input or not */
        /* for output devices */
        if (devices & 0x0000FFFF){
            if (devices & AudioSystem::DEVICE_OUT_SPEAKER) {
                control.set("HeadsetR Mixer AudioR2", 1); // on
                control.set("HeadsetL Mixer AudioL2", 1); // on
                control.set("Headset Playback Volume", 1); //Headset Volume
            } else {
                control.set("HeadsetR Mixer AudioR1", (unsigned int)0); // off
                control.set("HeadsetL Mixer AudioL1", (unsigned int)0); // off
            }
        }

    Please let us know if you face any further difficulties.

    Regards,

    Arun

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

  • Thanks, Arun, for your reply, but I'm confused.  The GingerBread_2_3_4_DevKit_2_1 release code that I have was already using "HeadsetR Mixer AudioR1" and "HeadsetL Mixer AudioL1", not the R2 and L2 versions you said it should have been using.  Do I have the wrong release?

    As a test, I ran alsa_aplay after turning off the L1 & R1 mixer switches and turning on the L2 & R2 mixer switches using alsa_amixer and the audio played back just fine.  So I'm not sure why both L1/R1 and L2/R2 exist.

    Any other suggestions?

    Thanks,

    Chris

  • Chris,

    I have cloned android sources from gitorious.org/rowboat with rowboat-gingerbread.xml which is the latest development manifest.

    You are using GingerBread_2_3_4_DevKit_2_1 release manifest.

    In the latest code, we have made these changes to add support for a different board based on omap3evm and TPS6595x.

    L2 & R2 paths will work for all the boards.

    So it seems, you are able with alsa_aplay but not with Music application with the current settings on Android (L1-R1 path or L2-R2 path).

    Could you please post your logcat output?

    Which is the platform you are evaluating the release? Is it a custom board?

    Regards,

    Arun

  • Thanks for your quick reply, Arun.

    > Could you please post your logcat output?

    2061.logcat.txt

    (note that this is both the boot log and the output of logcat)

    > Which is the platform you are evaluating the release? Is it a custom board?

    Yes, but there is nothing unique about the audio path--it's very much like the omap3evm.

    - Chris

  • I should add that we don't have Bluetooth on the board, so no bluetooth audio hardware.  Also,

    alsa_aplay -L

    yields

    default:CARD=omap3us
        omap3us,
        Default Audio Device
    null
        Discard all samples (playback) or generate zero samples (capture)

    and

    alsa_aplay -l

    yields

    **** List of PLAYBACK Hardware Devices ****
    card 0: omap3us [omap3us], device 0: TWL4030 twl4030-hifi-0 []
      Subdevices: 1/1
      Subdevice #0: subdevice #0
    card 0: omap3us [omap3us], device 1: WL1271BT wl1271bt-1 []
      Subdevices: 1/1
      Subdevice #0: subdevice #0

    So although we don't have any bluetooth hardware on the board, the software hooks are there.

    - Chris

  • Chris,

    The logcat shows no issues with the audio playback and Music App works fine. So it seems Audio Volume is not sufficient.

    Can you set the Volume Component to Maximum from the setDefaultControls function?

    See what is the value of the "Volume" with amixer, when you are able to hear the audio with alsa_aplay.

    Regards,

    Arun

  • If you are referring to the "Headset Playback Volume" volume, then the preferred volume is 2 when I use amixer.  I have set it to 3, but that's too loud.  The default of 1 that is in the alsa_module.cpp file is definitely audible, but not quite loud enough.

    Is that the volume you were referring to, or is there some other--since that's already getting set?

    Thanks,

    Chris

  • I still haven't figured this out, but here are some possible issues that I can think of:

    1. It's not opening the correct device (don't see any problem in the logcat output, but I don't know if there would be any).
    2. Although I'm playing a 44.1kHz stereo WAV file, perhaps the Music app isn't handling it correctly, and thus I'm not hearing anything
      1. I tried also playing an MP3 file, which seems to play just fine, but again, no audio output.
    3. If it were just an alsa_amixer setting problem, then shouldn't I be able to hear if the setting was right for alsa_aplay to be heard?

    Just FYI, I'm running on a system that...

    1. Has an Ethernet port and the root filesystem is NFS mounted over Ethernet.
    2. I'm entering the alsa_amixer and alsa_aplay commands over the debug UART (/dev/ttyO0)

    Thanks again for your assistance,

    Chris

  • Hi Chris,

    In your logcat, I find these lines

    E/AudioHardwareALSA( 1082): ALSA Module not found!!!
    W/AudioHardwareInterface( 1082): Using stubbed audio hardware. No sound will be produced.

    This means, either

    1)
    You have
    BOARD_USES_GENERIC_AUDIO set to true
    and commented
    BOARD_USES_ALSA_AUDIO, BOARD_USES_ALSA_UTILS.

    Even if you
    BOARD_USES_ALSA_AUDIO, BOARD_USES_ALSA_UTILS
    set to true, you have to perform a clean build, [ie
    make TARGET_PRODUCT=<> clean then build] to get the alsa audio back.

    2) You dont have alsa.<platform>.so present in the filesystem.

    Most likely 1) would be the issue.

    Check whether you have
    BOARD_USES_ALSA_AUDIO, BOARD_USES_ALSA_UTILS set to true and
    BOARD_USES_GENERIC_AUDIO is commented.
    Clean build is required in case of this change.

    Regards,
    Arun



  • Thanks Arun.  This tack look very promising.  I already do have this in the BoardConfig.mk file:

    #BOARD_USES_GENERIC_AUDIO := true
    BOARD_USES_ALSA_AUDIO := true
    BUILD_WITH_ALSA_UTILS := true

    And I can confirm that the the alsa.omap3suA.so file is in the root filesystem at /system/lib/hw/.  I have also done some "clean" builds to make sure things were built correctly, so I"m not sure why the .so file isn't getting loaded properly.

    Since I adapted my configuration from the omap3evm's, looking in device/ti/omap3evm/ I see that the text "omap3evm" is used in several places:

    BoardConfig.mk:   TARGET_BOOTLOADER_BOARD_NAME := omap3evm
    omap3evm.mk:      PRODUCT_NAME := omap3evm
    omap3evm.mk:      PRODUCT_DEVICE := omap3evm

    In addition it is specified as TARGET_PRODUCT when doing the build for the EVM.  For alsa on the target, it probably shows up as alsa.omap3evm.so, as well as the default device in the kernel build.  Is the library to load selected from TARGET_PRODUCT or TARGET_BOOTLOADER_BOARD_NAME or PRODUCT_NAME or PRODUCT_DEVICE or something else?

    Thanks again,

    Chris

  • Chris,

    I think you can have a check by copying alsa.omap3suA.so to alsa.omap3evm.so or alsa.default.so and having it in the rootfs.

    I guess the library to be loaded is decided by alsa.<TARGET_PRODUCT>.so



  • Arun, we're there!!!  The audio is working.

    It seemed to load when named

    alsa.default.so

    or

    alsa.omap3evm.so

    but not

    alsa.omap3suA.so

    After checking a little further, I found that on the target, system/build.prop still had ro.product.board=omap3evm.  Changing it to omap3suA allowed it to load alsa.omap3suA.so.

    It turns out that ro.product.board comes from TARGET_BOOTLOADER_BOARD_NAME in BoardConfig.mk.  I didn't get that switched over to omap3suA because I thought it applied only to u-boot.

    Thanks for your help,

    Chris

     

  • Chris,

    Glad to know that Audio works on your board.

  • Thanks Chris and Arun, for your conversations, 

    I am also faced same problem in audio and got working.

    Thanks & Regards,

    santosh vastrad