Ticket #141 (closed defect: wontfix)

Opened 3 years ago

Last modified 3 years ago

parec/pacat produces unusable files

Reported by: hackeron Owned by: lennart
Milestone: Component: module-alsa-*
Keywords: Cc:

Description

# pacat -r --channels=1 --format=s16le --rate=22050 -d alsa_input.usb_device_471_329_01690000D6490703_if1_alsa_capture_0 >testfile # file testfile testfile: data

# arecord f S16_LE -r 22050 -D hwplug:1 testfile # file testfile testfile: RIFF (little-endian) data, WAVE audio, Microsoft PCM, 16 bit, mono 22050 Hz

The parec/pacat files are also not usable by mencoder, sox, ffmpeg, vlc and other players I've tried.

I'm willing to accept I'm doing something wrong, but the files created by pacat seem to be unusable.

I'm using pulse audio on Ubuntu and these are the packages I have installed: ii libao-pulse 0.9.3-1 ii libpulse-browse0 0.9.6-1ubuntu2 ii libpulse-mainloop-glib0 0.9.6-1ubuntu2 ii libpulse0 0.9.6-1ubuntu2 ii padevchooser 0.9.3-2 ii paman 0.9.3-1build2 ii paprefs 0.9.5-1 ii pavucontrol 0.9.4-1build2 ii pavumeter 0.9.2-1 ii pulseaudio 0.9.6-1ubuntu2 ii pulseaudio-esound-compat 0.9.6-1ubuntu2 ii pulseaudio-module-gconf 0.9.6-1ubuntu2 ii pulseaudio-module-hal 0.9.6-1ubuntu2 ii pulseaudio-module-x11 0.9.6-1ubuntu2 ii pulseaudio-module-zeroconf 0.9.6-1ubuntu2 ii pulseaudio-utils 0.9.6-1ubuntu2

I'm using the default default.pa.

Change History

Changed 3 years ago by hackeron

Sorry about the formatting, here it is with wiki syntax:

# pacat -r --channels=1 --format=s16le --rate=22050 -d alsa_input.usb_device_471_329_01690000D6490703_if1_alsa_capture_0 >testfile
# file testfile
testfile: data

# arecord f S16_LE -r 22050 -D hwplug:1 testfile
# file testfile
testfile: RIFF (little-endian) data, WAVE audio, Microsoft PCM, 16 bit, mono 22050 Hz

Changed 3 years ago by jbglaw

These tools operate on raw PCM audio, not on sound files. That is, in parec's output, there's no WAF/RIFF header, so `file' won't recognize it as audio.

You'll need to add the needed header, which can eg. be done with `sox'.

Changed 3 years ago by lennart

  • status changed from new to closed
  • resolution set to wontfix

As jbglaw correctly mentioned pacat/parec only handle raw PCM streams. If you want to play audio files like .wav use "paplay".

Changed 3 years ago by hackeron

Oh, right ok. Yes, this worked:

pacat -r --channels=1 --format=s16le --rate=22050 -d alsa_input.usb_device_471_329_01690000D6490703_if1_alsa_capture_0 | sox -t sw -r 22050 -c 1 - -t wav - > testfile.wav

Changed 3 years ago by jbglaw

I wonder why you don't use -t raw for input?

Changed 3 years ago by hackeron

Well, I've been experimenting and so far all my attempts just generate noise :(

My latest attempt is
pacat -r --channels=1 --format=s16ne --rate=44100 -d alsa_input.%s | sox -sw -t raw -r 44100 -c 1 - -t wav

but I'm just getting pure noise :( -- Any ideas?

Changed 3 years ago by hackeron

Well, actually not pure noise, but something so heavily distorted you can't make out a single word.

Can someone give an example of a parec+sox combination that works for them?

Changed 3 years ago by lennart

hackeron: is this 0.9.6 or 0.9.7-svn?

Unfortunately sox seems to be totally broken right now, I cannot teach it anymore to read raw data from stdin. However, this works fine:

$ parec > foo.wav C $ pacat foo.wav

This will record some audio data, and play it back again.

Note: See TracTickets for help on using tickets.