Android Recording Distortion specific solution

Source: Internet
Author: User

We've been in an article detailing some of the ways in which Android multimedia recording functions are implemented. This includes the implementation of the recording method. Today we can learn more about the specific Android recording distortion solution by introducing this article to help you solve the problems that arise in practical applications.

The mic in recording function was tested on 6410+WM9714 's Android platform and a bug occurred. Sound playback on the platform is completely normal, but after recording the sound of the newly recorded voice, there will be distortion, the same recording files on the computer play the same, indicating that the Android recording distortion problem. Later, by printing 9714 of registers, found that the recording frequency is 8000HZ, put the audio rate is 44100HZ, then basically can be determined by this mismatch caused.

I set the sampling rate in the Android code: functions in the AudioHardwareALSA.cpp file, as follows:

1.audiostreaminalsa::audiostreaminalsa

(Audiohardwarealsa *parent): mparent (parent)

2.{

3.static Streamdefaults _defaults = {

4. .............

5.samplerate:audiorecord::D efault_sample_rate,

6. .............

7.};

8.}

Set up:

9.static const int default_sample_rate = 44100;

However, the results of the re-burning program still has the problem of the Android recording distortion, the sampling rate is still 8000, it seems to be other places to cover the value. Then I tried to change all the sample rates by 8000 to 44100, and the result was still 8000. In the end is not the sampling rate caused by the reason?

Then use the Arecord command to record, if you can't go to Android, otherwise the audio device will be occupied. The results were still the same, and it was estimated that the problem should have little to do with the Android top. Then someone else tried to speed up the playback by one times, the normal playback sound, but the problem is still do not know where to solve the problem.

Later, after the excavation of Taiwanese colleagues, the DMA size of the recording mic in was changed to solve the problem. The changes are listed below for reasons that have yet to be analysed.

10.static struct S3c24xx_pcm_dma_params

s3c6400_ac97_mic_mono_in = {

11..client = &s3c6400_dma_client_micin,

12..channel = dmach_ac97_mic_in,

13..DMA_ADDR = s3c6400_pa_ac97 + S3c_ac97_mic_data,

14..dma_size = 2,///4

15.};

This parameter is ultimately used to modify the DMA configuration in S3c24xx_pcm_hw_params. The solution of the Android recording distortion is introduced here.

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.