Re: [Alsa-user] Aplay Underruns

2016-10-19 Thread Jay Foster
On 10/18/2016 11:52 PM, Clemens Ladisch wrote:
> Jay Foster wrote:
>> Looks like aplay is using libspeex (builtin) for conversion.  How can
>> I select linear as you suggested?
> Add the following line to /etc/asound.conf:
>
> defaults.pcm.rate_converter "linear"
>
>
> Regards,
> Clemens
>
Thanks.  That seems to have been helpful.  No xrun errors.

Playing WAVE 'test.wav' : Signed 16 bit Little Endian, Rate 22050 Hz, Mono
Plug PCM: Rate conversion PCM (44100, sformat=S16_LE)
Converter: linear-interpolation
Protocol version: 10002
Its setup is:
   stream   : PLAYBACK
   access   : RW_INTERLEAVED
   format   : S16_LE
   subformat: STD
   channels : 1
   rate : 22050
   exact rate   : 22050 (22050/1)
   msbits   : 16
   buffer_size  : 11025
   period_size  : 2756
   period_time  : 125011
   tstamp_mode  : NONE
   tstamp_type  : MONOTONIC
   period_step  : 1
   avail_min: 2756
   period_event : 0
   start_threshold  : 11025
   stop_threshold   : 11025
   silence_threshold: 0
   silence_size : 0
   boundary : 722534400
Slave: Route conversion PCM (sformat=S16_LE)
   Transformation table:
 0 <- 0
 1 <- 0
Its setup is:
   stream   : PLAYBACK
   access   : MMAP_INTERLEAVED
   format   : S16_LE
   subformat: STD
   channels : 1
   rate : 44100
   exact rate   : 44100 (44100/1)
   msbits   : 16
   buffer_size  : 22052
   period_size  : 5513
   period_time  : 125011
   tstamp_mode  : NONE
   tstamp_type  : MONOTONIC
   period_step  : 1
   avail_min: 5513
   period_event : 0
   start_threshold  : 22052
   stop_threshold   : 22052
   silence_threshold: 0
   silence_size : 0
   boundary : 1445199872
Slave: Hardware PCM card 0 'USB Audio Device' device 0 subdevice 0
Its setup is:
   stream   : PLAYBACK
   access   : MMAP_INTERLEAVED
   format   : S16_LE
   subformat: STD
   channels : 2
   rate : 44100
   exact rate   : 44100 (44100/1)
   msbits   : 16
   buffer_size  : 22052
   period_size  : 5513
   period_time  : 125011
   tstamp_mode  : NONE
   tstamp_type  : MONOTONIC
   period_step  : 1
   avail_min: 5513
   period_event : 0
   start_threshold  : 22052
   stop_threshold   : 22052
   silence_threshold: 0
   silence_size : 0
   boundary : 1445199872
   appl_ptr : 0
   hw_ptr   : 0



--
Check out the vibrant tech community on one of the world's most 
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
___
Alsa-user mailing list
Alsa-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/alsa-user


Re: [Alsa-user] Aplay Underruns

2016-10-19 Thread Clemens Ladisch
Jay Foster wrote:
> Looks like aplay is using libspeex (builtin) for conversion.  How can
> I select linear as you suggested?

Add the following line to /etc/asound.conf:

defaults.pcm.rate_converter "linear"


Regards,
Clemens

--
Check out the vibrant tech community on one of the world's most 
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
___
Alsa-user mailing list
Alsa-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/alsa-user


Re: [Alsa-user] Aplay Underruns

2016-10-18 Thread Jay Foster


On 10/18/2016 12:04 AM, Clemens Ladisch wrote:
> Jay Foster wrote:
>> On 10/16/2016 11:47 PM, Clemens Ladisch wrote:
>>> Jay Foster wrote:
 The sound comes out in short bursts with pauses in between.  Each pause
 is accompanied with an underrun error
 [...]
 This makes me think the problem I am having is with the pcm plugin that
 does the resampling.
>>> Apparently, it uses too much of your CPU (whatever it is).  [...]
>> 'aplay -D plughw:0 test.wav" did not make any difference.
>> [...]
>> would I have any better luck telling aplay to select the 44100 Hz output
>> rate and resample 220500 to 44100 instead?
> The exact target rate does not matter for CPU usage, and it's probably
> using 44100 already.
>
> Which resampling algorithm are you using? ("aplay -v -D plughw:0 test.wav")
> (The fastest one would be "linear".)
>
>> 400MHz armv5te
> This CPU might be too weak to do real-time resampling without special
> assembler optimizations.
>
>
> Regards,
> Clemens
>
The output from 'aplay -v -D plughw:0 test.wav'
Playing WAVE 'test.wav' : Signed 16 bit Little Endian, Rate 22050 Hz, Mono
Plug PCM: Rate conversion PCM (44100, sformat=S16_LE)
Converter: libspeex (builtin)
Protocol version: 10002
Its setup is:
   stream   : PLAYBACK
   access   : RW_INTERLEAVED
   format   : S16_LE
   subformat: STD
   channels : 1
   rate : 22050
   exact rate   : 22050 (22050/1)
   msbits   : 16
   buffer_size  : 11025
   period_size  : 2756
   period_time  : 125011
   tstamp_mode  : NONE
   tstamp_type  : MONOTONIC
   period_step  : 1
   avail_min: 2756
   period_event : 0
   start_threshold  : 11025
   stop_threshold   : 11025
   silence_threshold: 0
   silence_size : 0
   boundary : 722534400
Slave: Route conversion PCM (sformat=S16_LE)
   Transformation table:
 0 <- 0
 1 <- 0
Its setup is:
   stream   : PLAYBACK
   access   : MMAP_INTERLEAVED
   format   : S16_LE
   subformat: STD
   channels : 1
   rate : 44100
   exact rate   : 44100 (44100/1)
   msbits   : 16
   buffer_size  : 22052
   period_size  : 5513
   period_time  : 125011
   tstamp_mode  : NONE
   tstamp_type  : MONOTONIC
   period_step  : 1
   avail_min: 5513
   period_event : 0
   start_threshold  : 22052
   stop_threshold   : 22052
   silence_threshold: 0
   silence_size : 0
   boundary : 1445199872
Slave: Hardware PCM card 0 'USB Audio Device' device 0 subdevice 0
Its setup is:
   stream   : PLAYBACK
   access   : MMAP_INTERLEAVED
   format   : S16_LE
   subformat: STD
   channels : 2
   rate : 44100
   exact rate   : 44100 (44100/1)
   msbits   : 16
   buffer_size  : 22052
   period_size  : 5513
   period_time  : 125011
   tstamp_mode  : NONE
   tstamp_type  : MONOTONIC
   period_step  : 1
   avail_min: 5513
   period_event : 0
   start_threshold  : 22052
   stop_threshold   : 22052
   silence_threshold: 0
   silence_size : 0
   boundary : 1445199872
   appl_ptr : 0
   hw_ptr   : 0
underrun!!! (at least 562.873 ms long)
Status:
   state   : XRUN
   trigger_time: 66491.687393162
   tstamp  : 66492.250212039
   delay   : -20
   avail   : 11045
   avail_max   : 11045
underrun!!! (at least 566.130 ms long)
Status:
   state   : XRUN
   trigger_time: 66494.2985491
   tstamp  : 66494.569089846
   delay   : 2734
   avail   : 8291
   avail_max   : 11045
underrun!!! (at least 551.742 ms long)
Status:
   state   : XRUN
   trigger_time: 66496.265264033
   tstamp  : 66496.816978168
   delay   : -20
   avail   : 11045
   avail_max   : 11045
underrun!!! (at least 518.706 ms long)
Status:
   state   : XRUN
   trigger_time: 66498.535974737
   tstamp  : 66499.54651071
   delay   : 2734
   avail   : 8291
   avail_max   : 11045
underrun!!! (at least 512.702 ms long)
Status:
   state   : XRUN
   trigger_time: 66500.843756142
   tstamp  : 66501.356430555
   delay   : -20
   avail   : 11045
   avail_max   : 11045

Looks like aplay is using libspeex (builtin) for conversion.  How can I 
select linear as you suggested?

Jay


--
Check out the vibrant tech community on one of the world's most 
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
___
Alsa-user mailing list
Alsa-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/alsa-user


Re: [Alsa-user] Aplay Underruns

2016-10-17 Thread Jay Foster


On 10/16/2016 11:47 PM, Clemens Ladisch wrote:
> Jay Foster wrote:
>> I am using aplay version 1.1.2 on an arm based system, but cannot get it
>> to play audio properly.  The sound card is a C-Media USB Audio Device.
>>
>> The sound comes out in short bursts with pauses in between.  Each pause
>> is accompanied with an underrun error
>> [...]
>> This makes me think the problem I am having is with the pcm plugin that
>> does the resampling.
> Apparently, it uses too much of your CPU (whatever it is).
>
>> Is there a way to fix this?.  Can I avoid the resampling somehow by
>> configuring the sound device for 22050 Hz?
> Try without dmix: "aplay -D plughw:0 test.wav".
>
>
> Regards,
> Clemens
>
Thanks.  'aplay -D plughw:0 test.wav" did not make any difference. This 
is on a 400MHz armv5te processor.
cat /proc/asound/card0/stream0 shows the following for the sound card:

Playback:
   Status: Stop
   Interface 1
 Altset 1
 Format: S16_LE
 Channels: 2
 Endpoint: 1 OUT (ADAPTIVE)
 Rates: 48000, 44100

Capture:
   Status: Stop
   Interface 2
 Altset 1
 Format: S16_LE
 Channels: 1
 Endpoint: 2 IN (SYNC)
 Rates: 48000, 44100

In my naivety, would I have any better luck telling aplay to select the 
44100 Hz output rate and resample 220500 to 44100 instead?  How would I 
even do that?

Jay



--
Check out the vibrant tech community on one of the world's most 
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
___
Alsa-user mailing list
Alsa-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/alsa-user


Re: [Alsa-user] Aplay Underruns

2016-10-17 Thread Clemens Ladisch
Jay Foster wrote:
> I am using aplay version 1.1.2 on an arm based system, but cannot get it
> to play audio properly.  The sound card is a C-Media USB Audio Device.
>
> The sound comes out in short bursts with pauses in between.  Each pause
> is accompanied with an underrun error
> [...]
> This makes me think the problem I am having is with the pcm plugin that
> does the resampling.

Apparently, it uses too much of your CPU (whatever it is).

> Is there a way to fix this?.  Can I avoid the resampling somehow by
> configuring the sound device for 22050 Hz?

Try without dmix: "aplay -D plughw:0 test.wav".


Regards,
Clemens

--
Check out the vibrant tech community on one of the world's most 
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
___
Alsa-user mailing list
Alsa-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/alsa-user


[Alsa-user] Aplay Underruns

2016-10-14 Thread Jay Foster
I am using aplay version 1.1.2 on an arm based system, but cannot get it 
to play audio properly.  The sound card is a C-Media USB Audio Device.

The sound comes out in short bursts with pauses in between.  Each pause 
is accompanied with an underrun error like so:

aplay test.wav
Playing WAVE 'test.wav' : Signed 16 bit Little Endian, Rate 22050 Hz, Mono
underrun!!! (at least 481.117 ms long)
underrun!!! (at least 505.789 ms long)
underrun!!! (at least 453.072 ms long)
underrun!!! (at least 475.359 ms long)
underrun!!! (at least 425.028 ms long)
underrun!!! (at least 447.205 ms long)

If I add the '--disable-resample' option, then the pauses and errors go 
away, but it does sound sped up.  Aplay reports Warning: rate is not 
accurate (requested = 22050Hz, got = 48000Hz)

So I used the sox application to pre convert my test.wav file from 20500 
Hz to 48000 Hz and used aplay to play that.  This played with no pauses, 
errors or warnings.  The resampling quality from sox was not that good.

This makes me think the problem I am having is with the pcm plugin that 
does the resampling.  Is there a way to fix this?.  Can I avoid the 
resampling somehow by configuring the sound device for 22050 Hz?

Jay


--
Check out the vibrant tech community on one of the world's most 
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
___
Alsa-user mailing list
Alsa-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/alsa-user