You are not logged in.

#1 2010-09-30 01:55:37

btitus
Member
Registered: 2010-09-29
Posts: 6

recorded sound too slow

Friends,
I've just installed Arch, including alsa-utils and alsa-oss and have the following odd problem with sound:
Playing a sound with aplay works fine, but when recording a sound with arecord, it comes out to be too slow. A 10 second recording comes out to be about 15 seconds, and therefore of course very low pitch.

I'm at a loss. Any ideas?

More info:
I'm running a 32 bit machine. I have Mandriva on another partition, and the sound works fine there, using aplay/arecord or other apps. Mandriva uses ALSA + Pulse Audio.
My headset uses standard 1/8 inch stereo jacks, not USB.

The lspci -v command shows this:

00:14.5 Multimedia audio controller: ATI Technologies Inc IXP150 AC'97 Audio Controller
        Subsystem: Toshiba America Info Systems Device ff01
        Control: I/O+ Mem+ BusMaster+ SpecCycle- MemWINV+ VGASnoop- ParErr- Stepping- SERR- FastB2B- DisINTx-
        Status: Cap- 66MHz+ UDF- FastB2B- ParErr- DEVSEL=slow >TAbort- <TAbort- <MAbort- >SERR- <PERR- INTx-
        Latency: 64 (500ns min), Cache Line Size: 32 bytes
        Interrupt: pin B routed to IRQ 17
        Region 0: Memory at d0004400 (32-bit, non-prefetchable) [size=256]
        Kernel driver in use: ATI IXP AC97 controller
        Kernel modules: snd-atiixp 

And lsmod:

Module                  Size  Used by
pcmcia                 32127  0
radeon                812683  1
snd_seq_dummy           1079  0
arc4                    1070  2
snd_seq_oss            25072  0
usbhid                 33564  0
ttm                    44599  1 radeon
ecb                     1589  2
snd_atiixp             10419  0
hid                    60400  1 usbhid
snd_seq_midi_event      4496  1 snd_seq_oss
snd_seq                41752  5 snd_seq_dummy,snd_seq_oss,snd_seq_midi_event
snd_seq_device          4369  3 snd_seq_dummy,snd_seq_oss,snd_seq
snd_pcm_oss            33662  0
snd_atiixp_modem        7680  0
drm_kms_helper         22043  1 radeon
snd_ac97_codec         87943  2 snd_atiixp,snd_atiixp_modem
ac97_bus                 762  1 snd_ac97_codec
drm                   134132  3 radeon,ttm,drm_kms_helper
yenta_socket           19842  0
ath5k                 124104  0 

I have looked up my card on the ALSA site and added lines suggested there to the modbprobe.conf file. Here's my modprobe.conf file.

 options snd_atiixp index=0
options snd_pcsp index=2

# ALSA portion
alias char-major-116 snd
alias snd-card-0 snd-atiixp
# module options should go here
       
# OSS/Free portion
alias char-major-14 soundcore
alias sound-slot-0 snd-card-0
       
# card #1
alias sound-service-0-0 snd-mixer-oss
alias sound-service-0-1 snd-seq-oss
alias sound-service-0-3 snd-pcm-oss
alias sound-service-0-8 snd-seq-oss
alias sound-service-0-12 snd-pcm-oss     

Thanks for any help!

Last edited by btitus (2010-09-30 09:11:25)

Offline

#2 2010-09-30 09:32:32

Army
Member
Registered: 2007-12-07
Posts: 1,784

Re: recorded sound too slow

What sample rate have you specified in arecord? You have to know that the AC'97 soundcards only support 48kHz as sample rate. This means, if you chose to record something with the "standard" 44.1kHz, the resulting file will appear to be slower than the original stream.

Offline

#3 2010-10-01 02:07:49

btitus
Member
Registered: 2010-09-29
Posts: 6

Re: recorded sound too slow

Thank you very much for your reply.

I did not specify a sampling rate, assuming it would use the default (8Khz).
Below I'm pasting in the output of the arecord -v and aplay -v commands. Not sure if I understand the output, but it appears perhaps to convert between 48000 and the default rate.

I also tried specifying a sample rate of 48Khz for play and record; the results were similar.

I should emphasize that the distortion is extreme. Editing the file in Audacity (on Mandriva), it was necessary to increase the speed by 50% to make it sound normal.

Thanks for any further insights. I use VoIP, so it's very necessary for me to make sound work, both playback and recording.

Output of arecord -v:

Recording WAVE 'test.wav' : Unsigned 8 bit, Rate 8000 Hz, Mono
Plug PCM: Rate conversion PCM (48000, sformat=U8)
Converter: linear-interpolation
Protocol version: 10002
Its setup is:
  stream       : CAPTURE
  access       : RW_INTERLEAVED
  format       : U8
  subformat    : STD
  channels     : 1
  rate         : 8000
  exact rate   : 8000 (8000/1)
  msbits       : 8
  buffer_size  : 1365
  period_size  : 170
  period_time  : 21333
  tstamp_mode  : NONE
  period_step  : 1
  avail_min    : 170
  period_event : 0
  start_threshold  : 1
  stop_threshold   : 1365
  silence_threshold: 0
  silence_size : 0
  boundary     : 178913280
Slave: Route conversion PCM (sformat=S32_LE)
  Transformation table:
    0 <- 0*0.5 + 1*0.5
Its setup is:
  stream       : CAPTURE
  access       : MMAP_INTERLEAVED
  format       : U8
  subformat    : STD
  channels     : 1
  rate         : 48000
  exact rate   : 48000 (48000/1)
  msbits       : 8
  buffer_size  : 8192
  period_size  : 1024
  period_time  : 21333
  tstamp_mode  : NONE
  period_step  : 1
  avail_min    : 1024
  period_event : 0
  start_threshold  : 6
  stop_threshold   : 8192
  silence_threshold: 0
  silence_size : 0
  boundary     : 1073741824
Slave: Direct Snoop PCM
Its setup is:
  stream       : CAPTURE
  access       : MMAP_INTERLEAVED
  format       : S32_LE
  subformat    : STD
  channels     : 2
  rate         : 48000
  exact rate   : 48000 (48000/1)
  msbits       : 32
  buffer_size  : 8192
  period_size  : 1024
  period_time  : 21333
  tstamp_mode  : NONE
  period_step  : 1
  avail_min    : 1024
  period_event : 0
  start_threshold  : 6
  stop_threshold   : 8192
  silence_threshold: 0
  silence_size : 0
  boundary     : 1073741824
Hardware PCM card 0 'ATI IXP' device 0 subdevice 0
Its setup is:
  stream       : CAPTURE
  access       : MMAP_INTERLEAVED
  format       : S32_LE
  subformat    : STD
  channels     : 2
  rate         : 48000
  exact rate   : 48000 (48000/1)
  msbits       : 32
  buffer_size  : 8192
  period_size  : 1024
  period_time  : 21333
  tstamp_mode  : ENABLE
  period_step  : 1
  avail_min    : 1024
  period_event : 0
  start_threshold  : 1
  stop_threshold   : 1073741824
  silence_threshold: 0
  silence_size : 0
  boundary     : 1073741824
  appl_ptr     : 0
  hw_ptr       : 0 

                         

Output of aplay -v:

Playing WAVE 'test.wav' : Unsigned 8 bit, Rate 8000 Hz, Mono
Plug PCM: Rate conversion PCM (48000, sformat=U8)
Converter: linear-interpolation
Protocol version: 10002
Its setup is:
  stream       : PLAYBACK
  access       : RW_INTERLEAVED
  format       : U8
  subformat    : STD
  channels     : 1
  rate         : 8000
  exact rate   : 8000 (8000/1)
  msbits       : 8
  buffer_size  : 1365
  period_size  : 170
  period_time  : 21333
  tstamp_mode  : NONE
  period_step  : 1
  avail_min    : 170
  period_event : 0
  start_threshold  : 1365
  stop_threshold   : 1365
  silence_threshold: 0
  silence_size : 0
  boundary     : 178913280
Slave: Route conversion PCM (sformat=S32_LE)
  Transformation table:
    0 <- 0
    1 <- 0
Its setup is:
  stream       : PLAYBACK
  access       : MMAP_INTERLEAVED
  format       : U8
  subformat    : STD
  channels     : 1
  rate         : 48000
  exact rate   : 48000 (48000/1)
  msbits       : 8
  buffer_size  : 8192
  period_size  : 1024
  period_time  : 21333
  tstamp_mode  : NONE
  period_step  : 1
  avail_min    : 1024
  period_event : 0
  start_threshold  : 8192
  stop_threshold   : 8192
  silence_threshold: 0
  silence_size : 0
  boundary     : 1073741824
Slave: Direct Stream Mixing PCM
Its setup is:
  stream       : PLAYBACK
  access       : MMAP_INTERLEAVED
  format       : S32_LE
  subformat    : STD
  channels     : 2
  rate         : 48000
  exact rate   : 48000 (48000/1)
  msbits       : 32
  buffer_size  : 8192
  period_size  : 1024
  period_time  : 21333
  tstamp_mode  : NONE
  period_step  : 1
  avail_min    : 1024
  period_event : 0
  start_threshold  : 8192
  stop_threshold   : 8192
  silence_threshold: 0
  silence_size : 0
  boundary     : 1073741824
Hardware PCM card 0 'ATI IXP' device 0 subdevice 0
Its setup is:
  stream       : PLAYBACK
  access       : MMAP_INTERLEAVED
  format       : S32_LE
  subformat    : STD
  channels     : 2
  rate         : 48000
  exact rate   : 48000 (48000/1)
  msbits       : 32
  buffer_size  : 8192
  period_size  : 1024
  period_time  : 21333
  tstamp_mode  : ENABLE
  period_step  : 1
  avail_min    : 1024
  period_event : 0
  start_threshold  : 1
  stop_threshold   : 1073741824
  silence_threshold: 0
  silence_size : 1073741824
  boundary     : 1073741824
  appl_ptr     : 0
  hw_ptr       : 0       

Offline

#4 2010-10-01 12:50:14

karol
Archivist
Registered: 2009-05-06
Posts: 25,440

Re: recorded sound too slow

Maybe a diff will be easier to read:

[karol@black ~]$ diff -Naur record play 
--- record    2010-10-01 12:53:33.000000000 +0000
+++ play    2010-10-01 12:53:48.000000000 +0000
@@ -1,9 +1,9 @@
-Recording WAVE 'test.wav' : Unsigned 8 bit, Rate 8000 Hz, Mono
+Playing WAVE 'test.wav' : Unsigned 8 bit, Rate 8000 Hz, Mono
 Plug PCM: Rate conversion PCM (48000, sformat=U8)
 Converter: linear-interpolation
 Protocol version: 10002
 Its setup is:
-  stream       : CAPTURE
+  stream       : PLAYBACK
   access       : RW_INTERLEAVED
   format       : U8
   subformat    : STD
@@ -18,16 +18,17 @@
   period_step  : 1
   avail_min    : 170
   period_event : 0
-  start_threshold  : 1
+  start_threshold  : 1365
   stop_threshold   : 1365
   silence_threshold: 0
   silence_size : 0
   boundary     : 178913280
 Slave: Route conversion PCM (sformat=S32_LE)
   Transformation table:
-    0 <- 0*0.5 + 1*0.5
+    0 <- 0
+    1 <- 0
 Its setup is:
-  stream       : CAPTURE
+  stream       : PLAYBACK
   access       : MMAP_INTERLEAVED
   format       : U8
   subformat    : STD
@@ -42,14 +43,14 @@
   period_step  : 1
   avail_min    : 1024
   period_event : 0
-  start_threshold  : 6
+  start_threshold  : 8192
   stop_threshold   : 8192
   silence_threshold: 0
   silence_size : 0
   boundary     : 1073741824
-Slave: Direct Snoop PCM
+Slave: Direct Stream Mixing PCM
 Its setup is:
-  stream       : CAPTURE
+  stream       : PLAYBACK
   access       : MMAP_INTERLEAVED
   format       : S32_LE
   subformat    : STD
@@ -64,14 +65,14 @@
   period_step  : 1
   avail_min    : 1024
   period_event : 0
-  start_threshold  : 6
+  start_threshold  : 8192
   stop_threshold   : 8192
   silence_threshold: 0
   silence_size : 0
   boundary     : 1073741824
 Hardware PCM card 0 'ATI IXP' device 0 subdevice 0
 Its setup is:
-  stream       : CAPTURE
+  stream       : PLAYBACK
   access       : MMAP_INTERLEAVED
   format       : S32_LE
   subformat    : STD
@@ -89,7 +90,7 @@
   start_threshold  : 1
   stop_threshold   : 1073741824
   silence_threshold: 0
-  silence_size : 0
+  silence_size : 1073741824
   boundary     : 1073741824
   appl_ptr     : 0
   hw_ptr       : 0

You can automatically post-process the file to "squeeze" it to the correct format.
A 50% increase is a conversion from 16 to 24 ... but I may be just playing a numerogist here ;P

Offline

#5 2010-10-02 02:29:11

btitus
Member
Registered: 2010-09-29
Posts: 6

Re: recorded sound too slow

Thank you, Karol. I agree, "diff" makes it easier to understand the output!

Regarding the post-processing you mention:
do you mean that there is a way to configure ALSA to convert the recorded stream *on the fly* (i.e. in real time) to speed it up? If so, where could I find more details?

For VoIP (Skype, etc.), the change would have to happen in real time, although for some other purposes it would be ok to fix the speed later.

Update:
I've just installed Pulse Audio, and the speed problem appears be fixed, though for reasons I don't understand. At least, arecord/aplay work in a console when routed through PulseAudio. Audacity is not recording yet--if that proves hard to fix, perhaps I'll start a new thread.

So thanks Karol & Army and all those who thought about this!! Your thoughts and support are much appreciated.
Birney

Last edited by btitus (2010-10-02 02:33:16)

Offline

Board footer

Powered by FluxBB