element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • About Us
  • Community Hub
    Community Hub
    • What's New on element14
    • Feedback and Support
    • Benefits of Membership
    • Personal Blogs
    • Members Area
    • Achievement Levels
  • Learn
    Learn
    • Ask an Expert
    • eBooks
    • element14 presents
    • Learning Center
    • Tech Spotlight
    • STEM Academy
    • Webinars, Training and Events
    • Learning Groups
  • Technologies
    Technologies
    • 3D Printing
    • FPGA
    • Industrial Automation
    • Internet of Things
    • Power & Energy
    • Sensors
    • Technology Groups
  • Challenges & Projects
    Challenges & Projects
    • Design Challenges
    • element14 presents Projects
    • Project14
    • Arduino Projects
    • Raspberry Pi Projects
    • Project Groups
  • Products
    Products
    • Arduino
    • Avnet Boards Community
    • Dev Tools
    • Manufacturers
    • Multicomp Pro
    • Product Groups
    • Raspberry Pi
    • RoadTests & Reviews
  • Store
    Store
    • Visit Your Store
    • Choose another store...
      • Europe
      •  Austria (German)
      •  Belgium (Dutch, French)
      •  Bulgaria (Bulgarian)
      •  Czech Republic (Czech)
      •  Denmark (Danish)
      •  Estonia (Estonian)
      •  Finland (Finnish)
      •  France (French)
      •  Germany (German)
      •  Hungary (Hungarian)
      •  Ireland
      •  Israel
      •  Italy (Italian)
      •  Latvia (Latvian)
      •  
      •  Lithuania (Lithuanian)
      •  Netherlands (Dutch)
      •  Norway (Norwegian)
      •  Poland (Polish)
      •  Portugal (Portuguese)
      •  Romania (Romanian)
      •  Russia (Russian)
      •  Slovakia (Slovak)
      •  Slovenia (Slovenian)
      •  Spain (Spanish)
      •  Sweden (Swedish)
      •  Switzerland(German, French)
      •  Turkey (Turkish)
      •  United Kingdom
      • Asia Pacific
      •  Australia
      •  China
      •  Hong Kong
      •  India
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      • Americas
      •  Brazil (Portuguese)
      •  Canada
      •  Mexico (Spanish)
      •  United States
      Can't find the country/region you're looking for? Visit our export site or find a local distributor.
  • Translate
  • Profile
  • Settings
Moto Mods
  • Products
  • Manufacturers
  • Moto Mods
  • More
  • Cancel
Moto Mods
Forum Help with volume and supported use cases using Audio/Speaker sample
  • Blog
  • Forum
  • Documents
  • Events
  • Polls
  • Files
  • Members
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
Join Moto Mods to participate - click to join for free!
Actions
  • Share
  • More
  • Cancel
Forum Thread Details
  • Replies 4 replies
  • Subscribers 57 subscribers
  • Views 358 views
  • Users 0 members are here
Related

Help with volume and supported use cases using Audio/Speaker sample

leo.andrade
leo.andrade over 8 years ago

I am trying to execute some tests using the speaker sample code and the Audio Personality Card. After following the instructions in Motorola Developer site, the Speaker is working as expected.

 

However,  I was trying to do some changes in the firmware and check the behaviour. To guarantee that my changes were built and MuC is calling them, I added several logs in the stm32_audio_tfa9890.c and in tfa9890.c files.

 

1) I had noticed that tfa9890_aud_dev_set_sys_volume is called when an audio is being played and I change the Android Audio Volume. As the Mod volume is changed according to Android volume,  I understood that this is the function that configures its volume. To confirm that, I had executed the following changes:

a) Firstly, I had hardcoded the sys_volume to -1200 (one of the values returned by Android);

b) Secondly, I had removed the whole code in the function;

 

Tested... For my surprise, after each of the changes, the Mod Speaker continues playing the audio according to the Android Audio Volume. How?

 

2) I don't want to have all the use cases being played by the Mod. I would like to play only music by it. By checking the code I found the tfa9890_aud_dev_get_supported_use_cases function in the stm32_audio_tfa9890.c. I thought that this function is called by the Moto Z in order to allow Moto Z to route the audio correcty. I had changed the TFA9890_SUPPORTED_PLAYBACK_USE_CASES to set just the DEV_AUDIO_PLAYBACK_MUSIC_USE_CASE.

 

Tested... No lucky! The ringtones continue being played by the Moto Mod Speaker

 

I am not familiar with the I2S. Am I missing something? How the Mod is aware about the volume set in the Moto Z? Why the ringtones continue being played by the Moto Mod even if the Ringtone cases was removed from the supported use cases?

 

Thanks

  • Sign in to reply
  • Cancel

Top Replies

  • lgamini
    lgamini over 8 years ago +2
    Android Audio framework will apply volume changes on data[Audio samples] itself. Mod is receiving tfa9890_aud_dev_set_sys_volume such commands, only if you have any specific settings for your codec you…
  • motomodsdev
    motomodsdev over 8 years ago in reply to leo.andrade +1
    From talking with our experts, Android handles volume settings internally and the audio stream to the Mod is a single stream post mixing. The current "dominant" volume setting (derived from all the active…
Parents
  • lgamini
    lgamini over 8 years ago

    Android Audio framework will apply volume changes on data[Audio samples] itself. Mod is receiving tfa9890_aud_dev_set_sys_volume such commands, only if you have any specific settings for your codec you can apply them. Applying volume settings in your mod i2s driver is not mandatory since, android will take of that.

    Though i am not sure, This is what my understanding.

    • Cancel
    • Vote Up +2 Vote Down
    • Sign in to reply
    • Cancel
Reply
  • lgamini
    lgamini over 8 years ago

    Android Audio framework will apply volume changes on data[Audio samples] itself. Mod is receiving tfa9890_aud_dev_set_sys_volume such commands, only if you have any specific settings for your codec you can apply them. Applying volume settings in your mod i2s driver is not mandatory since, android will take of that.

    Though i am not sure, This is what my understanding.

    • Cancel
    • Vote Up +2 Vote Down
    • Sign in to reply
    • Cancel
Children
  • leo.andrade
    leo.andrade over 8 years ago in reply to lgamini

    G Lucky, based on the current behaviour, your answer makes sense. Thanks.

    I had checked the I2S specs, but I had not found references for volume. I am going to check it again.

     

    I still do not understand why the audio profiles (use cases) reported by Moto Mod to Moto Z are not being respected by Moto Z. By adding logs, I confirmed that the use case for Notification is still being played by Moto Mod, even after it was removed for the supported playback use cases. I am still checking.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
  • motomodsdev
    motomodsdev over 8 years ago in reply to leo.andrade

    From talking with our experts, Android handles volume settings internally and the audio stream to the Mod is a single stream post mixing.  The current "dominant" volume setting (derived from all the active streams) is passed to the Mod.  The Mod may adjust their gain or other non-linear processing based on this value, but the stream itself will have adjustments for volume already applied.

     

    As far as audio profiles go, those are not currently used by the Moto Z.  However, the Moto Z will report that profile of the current stream, which would allow you to take actions (like reducing volume or muting output).  In general, audio will be dual routed to the Moto Z and the Moto Mod under the following conditions:

    Moto Mod is a headset, headphones, or line-out.

    Ringtone is playing

    Notifications ONLY playing (not mixed with Music)

    These are the only cases that will use both the Moto Z speaker and Moto Mod speaker simultaneously.  Since you're notified of the Mode, you can choose to take action (mute/lower your volume).

    • Cancel
    • Vote Up +1 Vote Down
    • Sign in to reply
    • Cancel
  • leo.andrade
    leo.andrade over 8 years ago in reply to motomodsdev

    Thanks very much for the detailed information.

    It is clearer for me now.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
element14 Community

element14 is the first online community specifically for engineers. Connect with your peers and get expert answers to your questions.

  • Members
  • Learn
  • Technologies
  • Challenges & Projects
  • Products
  • Store
  • About Us
  • Feedback & Support
  • FAQs
  • Terms of Use
  • Privacy Policy
  • Legal and Copyright Notices
  • Sitemap
  • Cookies

An Avnet Company © 2025 Premier Farnell Limited. All Rights Reserved.

Premier Farnell Ltd, registered in England and Wales (no 00876412), registered office: Farnell House, Forge Lane, Leeds LS12 2NE.

ICP 备案号 10220084.

Follow element14

  • X
  • Facebook
  • linkedin
  • YouTube