The Alsa tool in Linux and the Tinyalsa tool in Android "Go"

Source: Internet
Author: User

This article was reproduced from: http://blog.csdn.net/luckywang1103/article/details/48053015

Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.

Directory (?) [+]

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. Compiling Tinyalsa Companion 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

[Python]View PlainCopy
    1. [Email protected]:/ # cat/proc/asound/cards
    2. 0 [RKRK616]: rk_rk616-rk_rk616
    3. rk_rk616
    4. 1 [rockchipspdif]: Rockchip-spdif-rockchip-spdif
    5. Rockchip-spdif
    6. [Email protected]:/ #   

3.tinymix Viewing Reverb

Tinymix how to use a. No parameters-Displays the current configuration B.tinymix [Ctrl ID] [VAR] do not add [var] to view the [Ctrl ID] Optional option.

[Python]View PlainCopy
  1. [Email protected]:/ # Tinymix
  2. Number of controls: 7
  3. CTL Type num Name value
  4. 0 ENUM 1 Playback Path OFF
  5. 1 ENUM 1 Capture mic Path mic OFF
  6. 2 ENUM 1 Voice call Path OFF
  7. 3 ENUM 1 Voip Path OFF
  8. 4 INT 2 Speaker Playback Volume 0 0
  9. 5 INT 2 headphone Playback Volume 0 0
  10. 6 ENUM 1 Modem Input Enable on
  11. [Email protected]:/ #  

Correspondence Explanation:

English

Chinese

Note

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; values are: SPK/HP_NO_MIC/BT

Speaker Playback Volume

Speaker volume

Regardless of the upper volume value

Headphone Playback Volume

Headphone volume

Ditto

Modem Input Enable

I don't know what to use.

Test does not control audio input and output

Playback path is:

English

Chinese

Note

OFF

Shut down

RCV

SPK

Speaker

Common

Hp

Headset with wheat

Hp_no_mic

Headset without wheat

Common

Bt

Bluetooth

Spk_hp

Ring_spk

Ring_hp

Ring_hp_no_mic

Ring_spk_hp

Example: Switching the output to the speaker

[Email protected]:/# tinymix 0 SPK

About Tinymix Summary:

It was observed that the sound volume adjustment of the Android system did not directly use the Tinyalsa, but was based on the upper-level software, because no matter how the volume of the upper layer changed, the view here is 24 (take the device I use as an example). Channel switching is the real use of Tinyalsa, when playing music through different channels can be observed in real-time channel switching. Seeing Android on a website for about Alsa after 3 seconds of no sound playback has been confirmed, and I used to think that the Android system would 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. Use Tinyplay to play WAV music

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.

[Python]View PlainCopy
    1. [Email protected]:/ # tinyplay/sdcard/0_16.wav
    2. Playing Sample: 2 ch, 44100 Hz, + bit
    3. [Email protected]:/ #   

Note: Before playing, you must first use the Tinymix to set the channel, the above has given the example set to the speaker, because the playback of the maximum volume used to play, so be careful to avoid being frightened. This will test the audio file upload.

5.tinycap use

[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.

20141014 Update:

1. The original Tinyalsa the original source code here Tinyalsa_github.

2. Fork a copy yourself, add a static compilation method, and busybox the Tinymix/tinyplay/tinycap/tinypcminfo integration into a tinyalsa.

Tinyalsa-utils contains the Tinymix/tinyplay/tinycap/tinypcminfo use method is Tinyalsa + tool name. For example, to run Tinymix, execute Tinyalsa Mix or Tinyalsa tinymix.

[Email protected]:/# Tinyalsa Mix

Mixer name: ' rk_rk616 '

Number of Controls:7

CTL Type num Name value

0 ENUM 1 Playback Path OFF

1 ENUM 1 Capture mic Path Main Mic

2 ENUM 1 Voice call Path OFF

3 ENUM 1 Voip Path OFF

4 INT 2 Speaker Playback Volume 0 0

5 INT 2 Headphone Playback Volume 0 0

6 ENUM 1 Modem Input Enable on

[Email protected]:/#

3. According to this [PATCH] tinyalsa:new package information, later Tinyalsa will also be integrated into the busybox.

4. If a failed to open mixer error occurs, your Android device is not ALSA audio driver, but legacy OSS device.

Make a static library reference: build and use static libraries and dynamic libraries in Linux


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.

Top

Alsa tools in Linux and Tinyalsa tools in Android "Go"

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: info-contact@alibabacloud.com 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.