IMX6 audio signal saturating and clipping at 0.5

Hello,

I am working with a Colibri iMX6 and iris carrier board, to record audio, with the latest Linux Image.
I managed to record and playback my audio recordings. However, when I checked the signal, I noticed that it was saturating at 0.5 and clipping everything above that.

I am recording via only the left line pin in the iris, and setting ALSA mixer with the following command:

amixer set 'Capture Mux' 'LINE_IN'

As specified here:
http://developer.toradex.com/knowledge-base/audio-(linux)#SGTL5000_Capture_from_Linein

Below is an image of the problem – notice the clipping at 0.5 (image taken using Audacity):

[upload|nxhJtWv/EZsmZgFiS7ICBu/0tI4=]

But what I expected was as exemplified below (recorded using a Vf61, and only the left line in pin):

[upload|VIXnY9vngTNzzFmZl51zMYj2nmg=]

Notice that there is no saturation at 0.5 and the signal is close to 1. The voltage limit of both Vf61 and iMX6 boards is 1 Vrms, according to the datasheet of the codec SGTL5000, and the input signal that I used has amplitude 0.9Vrms…

It is worth noting that I used the same command to record in both the Vf61 and iMX6:

arecord -q -r 44100 -f S16_LE -c 1 -t wav -d 30 "recording.wav"

What am I doing wrong?

Hi

I guess you a combination of two effects:

  • If you record the stereo input with -c 1 you get the average of both channels.
  • By default the Capture gain is set to 18dB and the additional attenuate switch at -6dB, resulting clipping.

Thus the average of the clipped left input with the silent right input results in a square wave with 0.5 peak amplitude.

Reducing the ‘Capture’ volume to 4.5dB and switching on the additional -6dB attenuation as follows

root@colibri-imx6:~# amixer set 'Capture' 3 
root@colibri-imx6:~# amixer set 'Capture Attenuate Switch (-6dB)' on          
root@colibri-imx6:~# arecord -q -r 44100 -f S16_LE -c 1 -t wav -d 30 "recording.wav"

leads to a sine wave in the recording with an amplitude of about 0.5 peak due to the averaging.


If you record with -c 2 you will see that one channel uses nearly fullscale amplitude while the other is silent.
If you record subdevice 0 you record the first (I think left) channel only, which gives one channel file with a nearly fullscale signal.

arecord --device=hw:0,0,0 -q -r 44100 -f S16_LE -c 1 -t wav -d 30 "recording.wav"

Max

P.S.: The Colibri VF61 uses a Wolfson codec, thus defaults and behaviour are different depending on how the respective driver’s implementation.