<div class="gmail_quote"><div class="gmail_quote"><div class="gmail_quote"><span style="font-family:arial, sans-serif;font-size:13px;border-collapse:collapse"><div><font face="Arial"><span style="font-size:small">Hi,</span></font></div>
<div><font face="Arial"><span style="font-size:small"><br></span></font></div><div><font face="Arial"><span style="font-size:small">I am facing audio clipping issues when dmix is used for playback. For the test we used a full scale sine wave tone generated using software and encoded as "Signed 16 bit Little Endian, Rate 44100 Hz, Mono".<font face="arial, helvetica, sans-serif"> </font><span style="font-family:Calibri, Verdana, Helvetica, Arial;font-size:15px;color:rgb(80, 0, 80)"><font color="#000000"><span style="font-size:small"><font face="arial, helvetica, sans-serif">The audio is getting cut out at a 2-3 second interval during playback. This happens only for a fraction of second but it is consistent. This does not happen when audio is played back on the device directly but only when going through dmix. </font></span></font><span style="color:rgb(0, 0, 0);font-family:Arial;font-size:small">We have observed that there were differences in audio cutting off when the sampling rate was set to 8000Hz and 32000 Hz in asound.conf.</span></span></span></font></div>
<div><font face="Arial"><span style="font-size:small"><br></span></font></div><div><font face="Arial"><span style="font-size:small">The contents of asound.conf is pasted below for your reference:</span></font></div>
<div><font face="Arial"><span style="font-size:small"><div><br></div><div>pcm.dmixer {</div><div> type dmix</div><div> ipc_key 2048</div><div> ipc_key_add_uid true</div>
<div><br></div><div> slave {</div><div> pcm hw:0</div><div> rate 8000</div><div> channels 2</div><div> }</div><div>}</div><div><br></div><div>pcm.asymed {</div><div> type asym</div><div> playback.pcm "dmixer"</div>
<div> capture.pcm "hw:0,0"</div><div>}</div><div><br></div><div>pcm.rateConvert {</div><div> type plug</div><div> slave.pcm "asymed"</div><div>}</div><div><br></div><div>The configuration given above works fine with dmix in 2.6.29 kernel, I am using kernel 2.6.22.18.</div>
<div><br></div><div>I have compared the configuration differences (buffers and periods) with and without using dmix. I tried applying some parameters (like buffer_size, period_time and period_size) which was in use when audio was played directly to the hardware device by aplay using the following command:</div>
<div><br></div><div><span style="font-family:arial, sans-serif;font-size:13px">aplay -D rateConvert --period-time=92879 --buffer-size=65536 --period-size=4096 /mnt/test.wav -vvv -d 5</span></div>
</span></font></div><div><br></div><div><span style="font-family:Arial;font-size:small">There was come improvement in the audio cutting off issue but it was not eliminated completely.</span></div>
<div><font face="Arial"><span style="font-size:small"><br></span></font></div><div><font face="Arial" size="2">Given below are the logs for aplay (-vvv) with and without using dmix (with audio cutoff issue on kernel 2.6.22):</font></div>
<div><span style="font-family:Arial;font-size:small">Without using dmix:</span></div><div><font face="Arial"><span style="font-size:small"><br>
</span></font></div><div><font face="Arial"><span style="font-size:small"><div>[root@OMAP3 tests]# aplay /mnt/test.wav -vvv -d 5 5</div><div>Playing WAVE '/mnt/test.wav' : Signed 16 bit Little Endian, Rate 44100 Hz, Mono</div>
<div>Plug PCM: Hardware PCM card 0 'TWL4030' device 0 subdevice 0</div><div>Its setup is:</div><div> stream : PLAYBACK</div><div> access : RW_INTERLEAVED</div><div> format : S16_LE</div><div>
subformat : STD</div>
<div> channels : 1</div><div> rate : 44100</div><div> exact rate : 44100 (44100/1)</div><div> msbits : 16</div><div> buffer_size : 65536</div><div> period_size : 4096</div><div> period_time : 92879</div>
<div> tick_time : 7812</div><div> tstamp_mode : NONE</div><div> period_step : 1</div><div> sleep_min : 0</div><div> avail_min : 4096</div><div> xfer_align : 4096</div><div> start_threshold : 65536</div>
<div> stop_threshold : 65536</div><div> silence_threshold: 0</div><div> silence_size : 0</div><div> boundary : 1073741824</div><div>Max peak (4096 samples): 0x00006665 ################ 79%</div><div>Max peak (4096 samples): 0x00006665 ################ 79%</div>
<div><span style="font-family:arial, sans-serif;font-size:13px">...Same text repeats 50 times...</span></div><div>Max peak (4096 samples): 0x00006665 ################ 79%</div><div>Max peak (4096 samples): 0x00006665 ################ 79%</div>
<div><br></div><div>Using dmix:</div><div><br></div><div>[root@OMAP3 tests]# aplay -D rateConvert /mnt/test.wav -vvv -d 5</div><div>Playing WAVE '/mnt/test.wav' : Signed 16 bit Little Endian, Rate 44100 Hz, Mono</div>
<div>Plug PCM: Rate conversion PCM (8000, sformat=S16_LE)</div><div>Its setup is:</div><div> stream : PLAYBACK</div><div> access : RW_INTERLEAVED</div><div> format : S16_LE</div><div> subformat : STD</div>
<div> channels : 1</div><div> rate : 44100</div><div> exact rate : 44100 (44100/1)</div><div> msbits : 16</div><div> buffer_size : 22050</div><div> period_size : 5512</div><div> period_time : 125000</div>
<div> tick_time : 0</div><div> tstamp_mode : NONE</div><div> period_step : 1</div><div> sleep_min : 0</div><div> avail_min : 5512</div><div> xfer_align : 5512</div><div> start_threshold : 22048</div>
<div>
stop_threshold : 22050</div><div> silence_threshold: 0</div><div> silence_size : 0</div><div> boundary : 1445068800</div><div>Slave: Route conversion PCM (sformat=S16_LE)</div><div> Transformation table:</div>
<div> 0 <- 0</div><div> 1 <- 0</div><div>Its setup is:</div><div> stream : PLAYBACK</div><div> access : MMAP_INTERLEAVED</div><div> format : S16_LE</div><div> subformat : STD</div><div>
channels : 1</div><div> rate : 8000</div><div> exact rate : 8000 (8000/1)</div><div> msbits : 16</div><div> buffer_size : 4000</div><div> period_size : 1000</div><div> period_time : 125000</div>
<div> tick_time : 0</div><div> tstamp_mode : NONE</div><div> period_step : 1</div><div> sleep_min : 0</div><div> avail_min : 1000</div><div> xfer_align : 1000</div><div> start_threshold : 4000</div><div>
stop_threshold : 4000</div><div> silence_threshold: 0</div><div> silence_size : 0</div><div> boundary : 2097152000</div><div>Slave: Direct Stream Mixing PCM</div><div>Its setup is:</div><div> stream : PLAYBACK</div>
<div> access : MMAP_INTERLEAVED</div><div> format : S16_LE</div><div> subformat : STD</div><div> channels : 2</div><div> rate : 8000</div><div> exact rate : 8000 (8000/1)</div><div> msbits : 16</div>
<div> buffer_size : 4000</div><div> period_size : 1000</div><div> period_time : 125000</div><div> tick_time : 0</div><div> tstamp_mode : NONE</div><div> period_step : 1</div><div> sleep_min : 0</div><div>
avail_min : 1000</div><div> xfer_align : 1000</div><div> start_threshold : 4000</div><div> stop_threshold : 4000</div><div> silence_threshold: 0</div><div> silence_size : 0</div><div> boundary : 2097152000</div>
<div>Hardware PCM card 0 'TWL4030' device 0 subdevice 0</div><div>Its setup is:</div><div> stream : PLAYBACK</div><div> access : MMAP_INTERLEAVED</div><div> format : S16_LE</div><div> subformat : STD</div>
<div> channels : 2</div><div> rate : 8000</div><div> exact rate : 8000 (8000/1)</div><div> msbits : 16</div><div> buffer_size : 16000</div><div> period_size : 1000</div><div> period_time : 125000</div>
<div> tick_time : 7812</div><div> tstamp_mode : NONE</div><div> period_step : 1</div><div> sleep_min : 0</div><div> avail_min : 1000</div><div> xfer_align : 1000</div><div> start_threshold : 1</div><div>
stop_threshold : 2097152000</div><div> silence_threshold: 0</div><div> silence_size : 2097152000</div><div> boundary : 2097152000</div><div>Max peak (5512 samples): 0x00006665 ################ 79%</div><div>
Max peak (5512 samples): 0x00006665 ################ 79%</div><div><span style="font-family:arial, sans-serif;font-size:13px">...Same text repeats 36 times...</span></div><div>Max peak (5512 samples): 0x00006665 ################ 79%</div>
<div>Max peak (5512 samples): 0x00006665 ################ 79%</div><div>Max peak (5512 samples): 0x00005f1a ############### 74%</div></span></font></div><div><font face="Arial"><span style="font-size:small"><br>
</span></font></div><div>Please help me fix this issue. Does this occur due to non-optimal settings of the parameters (buffers, periods) in the configuration or is it some other issue with the ALSA library or the kernel? Please ask if any more setup/configuration settings are required for reference.</div>
<div><br></div><div>Thanks and Regards,</div><div><br></div><font color="#888888"><div>Ruchi Sirauthiya</div></font></span></div></div>
</div><br>