Re: [Alsa-user] Bower's & Wilkins PX headphone - snd-usb-audio error

2018-08-30 Thread Ralf Mardorf
On Thu, 30 Aug 2018 21:36:42 +0200, Philipp Ludwig wrote:
>On 08/29/2018 07:20 AM, Takashi Iwai wrote:
>Searching on the net for viable test files was without success, but
>if you might have some files handy, I'm happy to test everything.
>At least 48kHz seem to work.
>>   aplay -v -Dplughw:1 some-44100hz-samples.wav

To get 44.1 KHz wavs e.g. use K3b to rip an audio CD. Use e.g. ffmpeg to
convert a wav to 48 KHz.

ffmpeg -i input.wav -ar 48000 output.wav

--
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] Bower's & Wilkins PX headphone - snd-usb-audio error

2018-08-30 Thread Ralf Mardorf
On Fri, 31 Aug 2018 03:48:55 +0200, Ralf Mardorf wrote:
>On Thu, 30 Aug 2018 21:36:42 +0200, Philipp Ludwig wrote:
>>On 08/29/2018 07:20 AM, Takashi Iwai wrote:
>>Searching on the net for viable test files was without success, but
>>if you might have some files handy, I'm happy to test everything.
>>At least 48kHz seem to work.  
>>>   aplay -v -Dplughw:1 some-44100hz-samples.wav  
>
>To get 44.1 KHz wavs e.g. use K3b to rip an audio CD. Use e.g. ffmpeg
>to convert a wav to 48 KHz.
>
>ffmpeg -i input.wav -ar 48000 output.wav

Oops:

On Thu, 30 Aug 2018 21:36:42 +0200, Philipp Ludwig wrote:
>Regarding playback, it seems that I got only 48kHz samples in
>/usr/share/sounds/alsa

So it's even more simple:

ffmpeg -i /usr/share/sounds/alsa/Noise.wav -ar 44100 /tmp/Noise_44100.wav

--
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 weirdness

2018-08-30 Thread Philip Rhoades

Jay,


On 2018-08-31 01:42, Jay Foster wrote:

What version of aplay?



alsa-utils-1.1.6-1.fc28.x86_64



If it is version 1.1.6, you might be running
into this issue:
From: Takashi Iwai 
Subject: [PATCH] aplay: Fix invalid file size check for non-regular
files



Looks like you nailed it - so I will have to build my own I guess . .

Thanks!

P.



aplay tries to check the file size via fstat() at parsing the format
headers and avoids parsing when the size is shorter than the given
size.  This works fine for regular files, but when a special file like
pipe is passed, it fails, eventually leading to the fallback mode
wrongly.

A proper fix is to do this sanity check only for a regular file.

Reported-by: Jay Foster 
Signed-off-by: Takashi Iwai 
---
 aplay/aplay.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/aplay/aplay.c b/aplay/aplay.c
index bbd7fffa04fc..63ec9efbebc1 100644
--- a/aplay/aplay.c
+++ b/aplay/aplay.c
@@ -2821,7 +2821,8 @@ static int read_header(int *loaded, int
header_size)

 /* don't be adventurous, get out if file size is smaller than
  * requested header size */
-if (buf.st_size < header_size)
+if ((buf.st_mode & S_IFMT) == S_IFREG &&
+buf.st_size < header_size)
 return -1;

 if (*loaded < header_size) {

Jay

On 8/30/2018 2:50 AM, Philip Rhoades wrote:


People,

This produces a crashing static sound:

espeak --stdout 'words to speak' | aplay

but this works as expected:

espeak --stdout 'words to speak' > ./t
aplay ./t

What is wrong with the first command?

Thanks,

Phil.

--
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


--
Philip Rhoades

PO Box 896
Cowra  NSW  2794
Australia
E-mail:  p...@pricom.com.au

--
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 weirdness

2018-08-30 Thread Jay Foster
What version of aplay?  If it is version 1.1.6, you might be running 
into this issue:

From: Takashi Iwai 
Subject: [PATCH] aplay: Fix invalid file size check for non-regular files

aplay tries to check the file size via fstat() at parsing the format
headers and avoids parsing when the size is shorter than the given
size.  This works fine for regular files, but when a special file like
pipe is passed, it fails, eventually leading to the fallback mode
wrongly.

A proper fix is to do this sanity check only for a regular file.

Reported-by: Jay Foster 
Signed-off-by: Takashi Iwai 
---
 aplay/aplay.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/aplay/aplay.c b/aplay/aplay.c
index bbd7fffa04fc..63ec9efbebc1 100644
--- a/aplay/aplay.c
+++ b/aplay/aplay.c
@@ -2821,7 +2821,8 @@ static int read_header(int *loaded, int header_size)

 /* don't be adventurous, get out if file size is smaller than
  * requested header size */
-    if (buf.st_size < header_size)
+    if ((buf.st_mode & S_IFMT) == S_IFREG &&
+        buf.st_size < header_size)
     return -1;

 if (*loaded < header_size) {

Jay

On 8/30/2018 2:50 AM, Philip Rhoades wrote:

People,

This produces a crashing static sound:

  espeak --stdout 'words to speak' | aplay

but this works as expected:

  espeak --stdout 'words to speak' > ./t
  aplay ./t

What is wrong with the first command?

Thanks,

Phil.


--
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 weirdness

2018-08-30 Thread Philip Rhoades

Clemens,


On 2018-08-30 20:29, Clemens Ladisch via Alsa-user wrote:

Philip Rhoades wrote:

This produces a crashing static sound:

  espeak --stdout 'words to speak' | aplay

but this works as expected:

  espeak --stdout 'words to speak' > ./t
  aplay ./t


Is there a difference in the output of "hexdump -C -n48 ./t" and
"espeak --stdout 'words to speak' | hexdump -C -n48"?



hexdump -C -n48 ./t
  52 49 46 46 24 f0 ff 7f  57 41 56 45 66 6d 74 20  
|RIFF$...WAVEfmt |
0010  10 00 00 00 01 00 01 00  22 56 00 00 44 ac 00 00  
|"V..D...|
0020  02 00 10 00 64 61 74 61  00 f0 ff 7f 00 00 00 00  
|data|

0030

espeak --stdout 'words to speak' | hexdump -C -n48
  52 49 46 46 24 f0 ff 7f  57 41 56 45 66 6d 74 20  
|RIFF$...WAVEfmt |
0010  10 00 00 00 01 00 01 00  22 56 00 00 44 ac 00 00  
|"V..D...|
0020  02 00 10 00 64 61 74 61  00 f0 ff 7f e7 ff cd ff  
|data|

0030

Hmm . . four bytes at the end . .

P.



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


--
Philip Rhoades

PO Box 896
Cowra  NSW  2794
Australia
E-mail:  p...@pricom.com.au

--
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 weirdness

2018-08-30 Thread Clemens Ladisch via Alsa-user
Philip Rhoades wrote:
> This produces a crashing static sound:
>
>   espeak --stdout 'words to speak' | aplay
>
> but this works as expected:
>
>   espeak --stdout 'words to speak' > ./t
>   aplay ./t

Is there a difference in the output of "hexdump -C -n48 ./t" and
"espeak --stdout 'words to speak' | hexdump -C -n48"?


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 weirdness

2018-08-30 Thread Philip Rhoades

People,

This produces a crashing static sound:

  espeak --stdout 'words to speak' | aplay

but this works as expected:

  espeak --stdout 'words to speak' > ./t
  aplay ./t

What is wrong with the first command?

Thanks,

Phil.
--
Philip Rhoades

PO Box 896
Cowra  NSW  2794
Australia
E-mail:  p...@pricom.com.au

--
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