Re: [aucat] Playback is sped up (pitch becomes higher, too) when input from stdin

From: Alexandre Ratchov <alex_at_caoua.org>
Date: Fri, 2 Jul 2021 18:24:05 +0200
On Fri, Jul 02, 2021 at 09:06:21PM +0530, Subhaditya Nath wrote:
> When running
>     aucat -i -
> the playback gets sped up, and the pitch goes higher.
> 
> For example, when I run
>     aucat -i file.wav
> Then the file sounds correct. But if I run
>     cat file.wav | aucat -i -
> then the file sounds wrong. The playback speed increases, and the pitch gets
> higher.
> 
> Why is this happening?
> 
> (I have tested it using multiple files, and on both OpenBSD and Artix Linux.)
> 
> 

Hi,

When "-i -" is used, aucat doesn't "see" the file name so it can't
guess its format and assumes raw audio. In turn it doesn't decode
correctly the samples and basically plays junk.

You could force file type with the -h option, but it's not usable with
pipes as pipes are not seekable (.wav files require the lseek
operation):

	aucat -h wav -i - < file.wav		# works
	cat file.wav | aucat -h wav -i - 	# will fail

To read .wav files, just use "-i file.wav". If you need aucat to play
output of another program without storing it make it output raw
samples, and set aucat input format to match programs output format,
example:

	mpg321 -s file.mp3 | aucat -dd -e s16 -c 0:1 -r 441000 -i -

HTH,

-- Alexandre
Received on Fri Jul 02 2021 - 18:24:05 CEST

This archive was generated by hypermail 2.3.0 : Sat Jul 03 2021 - 01:34:18 CEST