Android audio underlying debug-based on Tinyalsa

Source: Internet
Author: User

Since the standard ALSA is not used by default in Android, it uses Tinyalsa, so even command-line-based testing uses LIBTINYALSA. The Android system can be seen in real-time, such as audio channel switching, when the upper-level audio is ever more changeable.

1. CompilingTinyalsaCompanion Tools

$ mmm external/tinyalsa/

After compiling, it will produce Tinyplay/tinymix/tinycap and so on tools.

Tinymix: View Configuration mixer

Tinyplay: Play Audio

Tinycap: Recording

2. View the current system's sound card

[Email protected]:/# cat/proc/asound/cards 0 [RKRK616        ]: rk_rk616-rk_rk616                      rk_rk616 1 [rockchipspdif  ]: RO Ckchip-spdif-rockchip-spdif                      

3.tinymixviewing the reverb device

Tinymix Use Method a. do not add any parameters - Show Current configuration status B.tinymix [Ctrl ID] [VAR] do not add [var] can view the [Ctrl ID] Optional Options.

[Email protected]:/# Tinymixnumber of Controls:7ctltypenumname                                     value0enum1playback Path                            off1enum1capture MIC Path                         MIC off2enum1voice call path                          off3enum1voip path                                off4int2speaker Playback Volume                  0 05int2headphone Playback Volume                0 06enum1modem Input Enable                       on[email protected]:/#

Correspondence Explanation:




Playback Path

Audio output Channels

Capture MIC Path

Audio input Channels

Voice Call Pah

Call Audio Channel

The device does not have a call module and cannot be tested

Voip Pah

IP Telephony Audio channel

Scene Gtalk; value has : SPK/HP_NO_MIC/BT

Speaker Playback Volume

Speaker volume

Regardless of the upper volume value

Headphone Playback Volume

Headphone volume


Modem Input Enable

I don't know what to use.

Test does not control audio input and output

Playback Path is:





Shut down






Headset with wheat


Headset without wheat









Example: Switching the output to the speaker

[Email protected]:/# tinymix 0 SPK

About Tinymix Summary:

Observed by observation, android The system's sound volume is not adjusted directly using the tinyalsa , and is based on the upper-level software implementation, because no matter how the upper volume changes, see here is 24 tinyalsa When playing music through different channels, you can observe the channel switching in real time. See android 3 alsa Here is also confirmed, I used to think android system will permanently occupy the audio device.

When music is played through Bluetooth, it is no longer alsa . tinymix View has to deal with the shutdown state, because the Android4.2 Bluetooth protocol all implemented in the user layer, directly go to the UART channel. Such a design method 1:30 will not understand.

4. UseTinyplayPlaywavMusic

This is just one of the most basic players, so it is not supported to play MP3 , and so on compressed-format music. Did not learn to use before, the Internet is said to be very troublesome, but now it seems no trouble, directly played the 44.1khz/44.8khz wav music.

[Email protected]:/# tinyplay/sdcard/0_16.wav                                     

Note: Before playing, you must first use the tinymix to set the channel, the above has given the example set to the speaker ; Because playback is played at the maximum volume, so be careful to prevent it from being frightened. This will test the audio file upload.


[Email protected]:/# tinycap/sdcard/test.wav

can be recorded.

At present, only meet these, the first summary to this, you can at any time in depth.

Other assumptions that have been confirmed as false:

1. Need to overwrite init.rc so that the system does not start Android-related services (MediaServer)

2. It is necessary to obtain tinyalsa by other means.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.