2011-03-17 09:28:54     Audio record and playback issue

Document created by Aaronwu Employee on Aug 26, 2013
Version 1Show Document
  • View in full screen mode

2011-03-17 09:28:54     Audio record and playback issue

Chandrashekhar Lavania (INDIA)

Message: 99007   

 

Hi,

 

Note: I am not sure if the issue is driver related or ALSA-LIB / ALSA-Util related. Therefore I posted it in the uClinux - dist forum.

 

I am trying to build an app to record and playback audio. I am using TLL6527M as my platform which uses the SSM2603 Audio Codec.

 

I am using 2009R1.

 

When I run my application (which is uses ALSA LIB) I get asymmetric playback on the right and left channels. I tried to find out any errors in my code but ended up blank.

 

I then decided to test this issue using vrec/vplay and arecord/aplay. This was done using the following steps.

 

1. I recorded a 1KHz stereo sine wave using vrec/arecord and played it back using vplay/aplay

 

The results when observed on the oscilloscope were again asymmetric, and the each channel had a different gain. The commands used were:

 

vrec -rS -s 48000 -b16 -t 10 sine1000_stereo.bin

 

arecord -c 2 -r 48000 -f S16_LE -t raw -d 10 sine1000_stereo.bin

 

vplay -rS -s 48000 -b16 sine1000_stereo.bin

 

aplay -c 2 -r 48000 -f S16_LE -t raw sine1000_stereo.bin

 

The file recorded using vrec was played out using vplay, whereas the one recorded using arecord was played out using aplay.

 

2. I then decided to test out vplay and aplay separately. I recorded a 1 KHz stereo sine wave using audacity as seen in Fig 1 stored it in a .wav file and played it back using aplay and vplay. This time both the channels had same gain and were symmetric.

 

3. Next step was to test vrec. I recorded a 1 KHz stereo sine wave using vrec and stored it in a file. The recorded file is as seen in Fig 2.

 

The output of simply running amixer is :

 

root:/home> amixer                                                             

 

Simple mixer control 'Master',0                                                

 

  Capabilities: pvolume                                                        

 

  Playback channels: Front Left - Front Right                                  

 

  Limits: Playback 0 - 127                                                     

 

  Mono:                                                                        

 

  Front Left: Playback 120 [94%]                                               

 

  Front Right: Playback 120 [94%]                                              

 

Simple mixer control 'Master Playback ZC',0                                    

 

  Capabilities: pswitch                                                        

 

  Playback channels: Front Left - Front Right                                  

 

  Mono:                                                                        

 

  Front Left: Playback [off]                                                   

 

  Front Right: Playback [off]                                                  

 

Simple mixer control 'Sidetone',0                                              

 

  Capabilities: pvolume pvolume-joined                                         

 

  Playback channels: Mono                                                      

 

  Limits: Playback 0 - 3                                                       

 

  Mono: Playback 3 [100%]                                                      

 

Simple mixer control 'Line',0                                                  

 

  Capabilities: cswitch cswitch-joined cswitch-exclusive                       

 

  Capture exclusive group: 0                                                   

 

  Capture channels: Mono                                                       

 

  Mono: Capture [on]                                                           

 

Simple mixer control 'Mic',0                                                   

 

  Capabilities: cswitch cswitch-joined cswitch-exclusive                       

 

  Capture exclusive group: 0                                                   

 

  Capture channels: Mono                                                       

 

  Mono: Capture [off]                                                          

 

Simple mixer control 'Mic Boost (+20dB)',0                                     

 

  Capabilities: pswitch pswitch-joined                                         

 

  Playback channels: Mono                                                      

 

  Mono: Playback [on]                                                          

 

Simple mixer control 'Playback De-emphasis',0                                  

 

  Capabilities: enum                                                           

 

  Items: 'None' '32Khz' '44.1Khz' '48Khz'                                      

 

  Item0: 'None'                                                                

 

Simple mixer control 'Capture',0                                               

 

  Capabilities: cvolume cswitch                                                

 

  Capture channels: Front Left - Front Right                                   

 

  Limits: Capture 0 - 31                                                       

 

  Front Left: Capture 23 [74%] [on]                                            

 

  Front Right: Capture 23 [74%] [on]                                           

 

Simple mixer control 'ADC High Pass Filter',0                                  

 

  Capabilities: pswitch pswitch-joined                                         

 

  Playback channels: Mono                                                      

 

  Mono: Playback [on]                                                          

 

Simple mixer control 'Input Mux',0                                             

 

  Capabilities: enum                                                           

 

  Items: 'Line' 'Mic'                                                          

 

  Item0: 'Line'                                                                

 

Simple mixer control 'Output Mixer HiFi Playback Swit',0                       

 

  Capabilities: pswitch pswitch-joined                                         

 

  Playback channels: Mono                                                      

 

  Mono: Playback [on]                                                          

 

Simple mixer control 'Output Mixer Line Bypass',0                              

 

  Capabilities: pswitch pswitch-joined                                         

 

  Playback channels: Mono                                                      

 

  Mono: Playback [off]                                                         

 

Simple mixer control 'Output Mixer Mic Sidetone Switc',0                       

 

  Capabilities: pswitch pswitch-joined                                         

 

  Playback channels: Mono                                                      

 

  Mono: Playback [off]                                                         

 

Simple mixer control 'Store DC Offset',0                                       

 

  Capabilities: pswitch pswitch-joined                                         

 

  Playback channels: Mono                                                      

 

  Mono: Playback [off]

 

 

 

Conclusion: As can be seen from  Fig 2, the output of the recording is asymmetric and has different gain for different channels.

 

What can be the solution to this?

 

 

 

There is another issue for setting playback volume for  LINEOUT.

 

Executing the commands:

 

amixer  sset 'Master' 100     ..............This does not change playback volume for LINEOUT ( I tried with 120 and 60)

 

 

 

What can be done to resolve this?

 

 

 

Regards,

 

Shekhar

 

Asymmetric_Sine.png

Symmetric_Sine.png

QuoteReplyEditDelete

 

 

2011-03-18 09:37:23     Re: Audio record and playback issue

Chandrashekhar Lavania (INDIA)

Message: 99046   

 

Hi,

 

I also checked with 2010R1, and I still get the same results when I use arecord/aplay.

 

 

 

Regards,

 

Shekhar

QuoteReplyEditDelete

 

 

2011-03-22 04:32:27     Re: Audio record and playback issue

Scott Jiang (CHINA)

Message: 99135   

 

I have tested 2010R1 on bf537 stamp board, there is no symmetric problem. I recommend you try another SPORT.

 

The line output signal levels are not adjustable at the output mixer, having a fixed gain of 0 dB. Please refer to datasheet.

Attachments

Outcomes