Linux Drive-To-Digest series: Tinyalsa (tinymix/tinycap/tinyplay/tinypcminfo) Audio subsystem "Turn"

Source: Internet
Author: User



This article was reproduced from: http://blog.csdn.net/radianceblau/article/details/64125411



Currently, the mainstream audio architecture in Linux is Alsa (Advanced Linux sound Architecture), ALSA provides alsa-driver in the kernel driver layer, alsa-lib in the application layer, The application only needs to invoke the API provided by Alsa-lib to complete the operation of the underlying hardware. That's good, but Android doesn't use the standard ALSA, but a ALSA lite version called Tinyalsa. Using Tinyalsa control to manage all modes of audio channels in Android, we can also use the tools provided by Tinyalsa for viewing and debugging.



Four gadgets are generated after compiling a tinyalsa:





[OBJC]View PlainCopy
    1. Tinymix
    2. Tinyplay
    3. Tinycap
    4. Tinypcminfo





Compile command:


[OBJC]View PlainCopy
    1. Mmm external/tinyalsa/





The following is a demonstration of the use of four gadgets: (The following uses the LC1860 platform with the LC1160 Power + audio chip, and the demonstration results are from the M7301P5 test machine)



1, Tinypcminfo



Tinypcminfo to view information about the PCM channel



Input:





[OBJC]View PlainCopy
    1. Tinypcminfo-d/proc/asound/cards





The results are as follows:






The information obtained from the above can be used to know the sample rate of PCM, number of channels, sampling points and so on.



Where –D followed by the parameters of the sound card file, generally located in/proc/asound/cards. can use





[OBJC]View PlainCopy
    1. Cat/proc/asound/cards


View current sound card









2, Tinymix



As shown, the direct input tinymix can be used to obtain the audio path related configuration parameters. You can also modify the configuration by adding parameters, such as you want to increase the ADC1 gain value to 110, enter Tinymix 12 110.









Viewing the above information separately is difficult to comb, with the audio path map will be more clear.









The red font indicates the connection between the LC1160 and the hardware devices such as microphones and headphones. (Note: m73xx project due to internal CLASSD does not meet the requirements, the speaker is connected to the AUX channel)



The gain adjustment section on each path uses a green font to mark the corresponding relationship with the Tinymix options.



The Plus and MUX diagrams are channel selector switches that correspond to the other options in the Tinymix for switching audio channels in various modes. This part of the comparison is not shown in the diagram, but according to the known path name is relatively easy to correspond.



The yellow arrow in the figure shows the downlink audio data stream from the PCM interface to the LC1160, which is then transferred to the handset after MONODAC for digital-to-analog conversion.



The purple arrows in the figure show the uplink audio data stream on the call, after the sound is collected from the main mic, after the analog-to-digital conversion by the ADC1, the PMC do line is sent out



3, Tinyplay






Tinyplay is a simple music player that is typically used for playback testing. Tinyplay can only play WAV original format music, can not be decoded Mp3 and other formats, support 44.1khz,48khz sampling rate of WAV music.



Before calling Tinyplay to play music, you need to switch the audio path with Tinymix first:





[OBJC]View PlainCopy

tinymix 0 I2SR // Select Stereo DACR as i2s
tinymix 1 I2SL // Select Stereo DACL as i2s
tinymix 2 0 0 // Mute the left and right channels of Stereo DAC off
tinymix 24 1 // Turn on the external PA chip of the speaker
tinymix 40 1 // Route the sound of Stereo DACR to the AUX port output (because the experimental machine speaker is mounted on the AUX interface)
tinymix 41 1 // Route the sound of Stereo DACR to the AUX port output (because the experimental machine speaker is mounted on the AUX interface)
tinyplay z.wav







4, Tinycap



Tinycap is a simple recording software, generally used for recording testing.



Before calling Tinycap recording, you need to adjust the audio path first:





[OBJC]View PlainCopy

tinymix 14 30 // mic1 volume
tinymix 19 1 // mic1 boost on
tinymix 26 1 // adc1-> mic1
tinymix 50 ADC1 // i2sR out-> adc1
tinymix 51 ADC1 // i2sL out-> adc2
echo "0xfb 0x01"> / sys / devices / platform / comip_codec / lc1160_reg // bias poweron
echo "0xad 0x08"> / sys / devices / platform / comip_codec / lc1160_reg // adc1 enable
echo "0xac 0x01"> / sys / devices / platform / comip_codec / lc1160_reg // mic1 pga enable
echo "0x3b 0xcc"> / sys / devices / platform / comip_codec / lc1160_reg // ldo
echo 2> / sys / bus / i2c / drivers / fm2018 / 0-0060 / mode // bypass external echo cancellation audio chip (specific to M730x project)
  
tinycap /sdcard/Music/l.wav





The recording ends by forcing the exit by CTRL + C and then viewing the L.wav audio file under the/sdcard/music/path






Use ADB pull to the local computer and use Goldwave to play, view.


[OBJC]View PlainCopy
    1. ADB pull/sdcard/music/l. wav d:\





Other than that:



LC1160 registers are paged, that is, there are two different meanings of registers on the same address, switching to the second function page by controlling the value in the 0xFC register





[OBJC]View PlainCopy
      1. echo "0xFC 0x01" >/SYS/DEVICES/PLATFORM/COMIP_CODEC/LC1160_reg
      2. CAT/SYS/DEVICES/PLATFORM/COMIP_CODEC/LC1160_reg
      3. echo "0xFC 0x00" >/SYS/DEVICES/PLATFORM/COMIP_CODEC/LC1160_reg


Linux Drive-To-Digest series: Tinyalsa (tinymix/tinycap/tinyplay/tinypcminfo) Audio subsystem "Turn"


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