lkml.org 
[lkml]   [2001]   [May]   [25]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectPROBLEM: USB Micropone, samples recorded at twice proper rate, distortion
[1.] One line summary of the problem:
Sample rate wrong for USB microphone - distorted noisy sampling.


[2.] Full description of the problem/report:
The Andrea NC-7100 Microphone, which works great on the Mac & Win 98,
does not work under Linux. Samples are recorded at exactly twice the proper
speed. This can be verified by recording, then playing back at double
the normal rate.

The audio driver eventually confuses itself and registers the wrong dsp device.

The code is hard to follow because structures from the USB Audio Class spec
are parsed as absolute offsets with no comments, no names, no headers.


[3.] Keywords (i.e., modules, networking, kernel):
Kernel USB audio audio.c "USB Audio Class Driver" module microphone input dsp


[4.] Kernel version (from /proc/version):
Linux version 2.4.2-2 (root@porky.devel.redhat.com) (gcc version 2.96 20000731 (
Red Hat Linux 7.1 2.96-79)) #1 Sun Apr 8 20:41:30 EDT 2001


[7.1.] Software (add the output of the ver_linux script here)
Gnu C 2.96
Gnu make 3.79.1
binutils 2.10.91.0.2
util-linux 2.10r
modutils 2.4.2
e2fsprogs 1.19
reiserfsprogs 3.x.0f
pcmcia-cs 3.1.22
PPP 2.4.0
isdn4k-utils 3.1pre1
Linux C Library 2.2.2
Dynamic linker (ldd) 2.2.2
Procps 2.0.7
Net-tools 1.57
Console-tools 0.3.3
Sh-utils 2.0
Modules Loaded audio soundcore parport_pc lp parport autofs eepro100 ipc
hains ide-scsi scsi_mod ide-cd cdrom usb-uhci usbcore


[7.2.] Processor information (from /proc/cpuinfo):
[7.3.] Module information (from /proc/modules):
[7.4.] Loaded driver and hardware information (/proc/ioports, /proc/iomem)
# cat /proc/bus/usb/devices
T: Bus=02 Lev=00 Prnt=00 Port=00 Cnt=00 Dev#= 2 Spd=12 MxCh= 2
B: Alloc= 11/900 us ( 1%), #Int= 1, #Iso= 0
D: Ver= 1.00 Cls=09(hub ) Sub=00 Prot=00 MxPS= 8 #Cfgs= 1
P: Vendor=0000 ProdID=0000 Rev= 0.00
S: Product=USB UHCI Root Hub
S: SerialNumber=d000
C:* #Ifs= 1 Cfg#= 1 Atr=40 MxPwr= 0mA
I: If#= 0 Alt= 0 #EPs= 1 Cls=09(hub ) Sub=00 Prot=00 Driver=hub
E: Ad=81(I) Atr=03(Int.) MxPS= 8 Ivl=255ms
T: Bus=02 Lev=01 Prnt=02 Port=01 Cnt=01 Dev#= 3 Spd=12 MxCh= 4
D: Ver= 1.10 Cls=09(hub ) Sub=00 Prot=00 MxPS= 8 #Cfgs= 1
P: Vendor=058f ProdID=9254 Rev= 1.00
S: Manufacturer=ALCOR
S: Product=Generic USB Hub
C:* #Ifs= 1 Cfg#= 1 Atr=e0 MxPwr=100mA
I: If#= 0 Alt= 0 #EPs= 1 Cls=09(hub ) Sub=00 Prot=00 Driver=hub
E: Ad=81(I) Atr=03(Int.) MxPS= 1 Ivl=255ms
T: Bus=01 Lev=00 Prnt=00 Port=00 Cnt=00 Dev#= 1 Spd=12 MxCh= 2
B: Alloc= 0/900 us ( 0%), #Int= 0, #Iso= 0
D: Ver= 1.00 Cls=09(hub ) Sub=00 Prot=00 MxPS= 8 #Cfgs= 1
P: Vendor=0000 ProdID=0000 Rev= 0.00
S: Product=USB UHCI Root Hub
S: SerialNumber=d400
C:* #Ifs= 1 Cfg#= 1 Atr=40 MxPwr= 0mA
I: If#= 0 Alt= 0 #EPs= 1 Cls=09(hub ) Sub=00 Prot=00 Driver=hub
E: Ad=81(I) Atr=03(Int.) MxPS= 8 Ivl=255ms
T: Bus=01 Lev=01 Prnt=01 Port=01 Cnt=01 Dev#= 4 Spd=12 MxCh= 0
D: Ver= 1.10 Cls=00(>ifc ) Sub=00 Prot=00 MxPS= 8 #Cfgs= 1
P: Vendor=0556 ProdID=0001 Rev= 0.01
S: Manufacturer=AKM
S: Product=AK5370
C:* #Ifs= 2 Cfg#= 1 Atr=80 MxPwr= 90mA
I: If#= 0 Alt= 0 #EPs= 0 Cls=01(audio) Sub=01 Prot=00 Driver=audio
I: If#= 1 Alt= 0 #EPs= 0 Cls=01(audio) Sub=02 Prot=00 Driver=audio
I: If#= 1 Alt= 1 #EPs= 1 Cls=01(audio) Sub=02 Prot=00 Driver=audio
E: Ad=81(I) Atr=01(Isoc) MxPS= 100 Ivl= 1ms

[7.5.] PCI information ('lspci -vvv' as root)
[7.6.] SCSI information (from /proc/scsi/scsi)
[7.7.] Other information that might be relevant to the problem
(please look in /proc and include all information that you
think to be relevant):


[X.] Other notes, patches, fixes, workarounds:
-----------------------------------------------------------------------
1> On boot, the USB mic takes over the normal audio. "gmix"
shows only the USB mixer device.
2> After removing and reinserting the usb mic, both the
EMU10K1 sound card and the USB microphone show in "gmix".
3> Often after plugging in and out, it will register dsp number 35!
4> audio.c debugs should indicate which dsp devices was registered!!!!!!


/var/log/messages during a record session (using sox & rec)
----------------------------------------------------------------------
May 25 11:33:50 localhost kernel: usb_audio: set_format_in: usb_set_interface 1
1
May 25 11:33:50 localhost kernel: usbaudio: set_format_in: device 2 interface 1
altsetting 1 srate req: 8000 real 8000
May 25 11:33:50 localhost kernel: usbaudio: actual sampling frequency 8000
May 25 11:33:50 localhost kernel: usbaudio: set_format_in: USB format 0x10, DMA
format 0x8 srate 8000
May 25 11:33:50 localhost kernel: usb_audio: set_format_in: usb_set_interface 1
1
May 25 11:33:50 localhost kernel: usbaudio: set_format_in: device 2 interface 1
altsetting 1 srate req: 8000 real 8000
May 25 11:33:50 localhost kernel: usbaudio: actual sampling frequency 8000
May 25 11:33:50 localhost kernel: usbaudio: set_format_in: USB format 0x10, DMA
format 0x8 srate 8000
May 25 11:33:50 localhost kernel: usb_audio: set_format_in: usb_set_interface 1
1
May 25 11:33:50 localhost kernel: usbaudio: set_format_in: device 2 interface 1
altsetting 1 srate req: 8000 real 8000
May 25 11:33:50 localhost kernel: usbaudio: actual sampling frequency 8000
May 25 11:33:50 localhost kernel: usbaudio: set_format_in: USB format 0x10, DMA
format 0x80000008 srate 8000
May 25 11:33:50 localhost kernel: usb_audio: set_format_in: usb_set_interface 1
1
May 25 11:33:50 localhost kernel: usbaudio: set_format_in: device 2 interface 1
altsetting 1 srate req: 44100 real 44100
May 25 11:33:50 localhost kernel: usbaudio: actual sampling frequency 44100
May 25 11:33:50 localhost kernel: usbaudio: set_format_in: USB format 0x10, DMA
format 0x80000008 srate 44100
May 25 11:33:50 localhost kernel: usbaudio: dmabuf_init: bytepersec 88200 bufs 1
31072 ossfragshift 0 ossmaxfrags 0 fragshift 9 fragsize 512 numfrag 256 dmasize
131072 bufsize 131072 fmt 0x80000008


Remove and reinsert microphone
---------------------------------------------------------------------------
May 25 11:35:34 localhost kernel: usbaudio: unregister dsp 3
May 25 11:35:34 localhost kernel: usbaudio: unregister mixer 0
May 25 11:35:34 localhost kernel: usb_audio_disconnect: note, called with -1

May 25 11:35:37 localhost kernel: usbaudio: device 3 audiocontrol interface 0 ha
s 1 input and 0 output AudioStreaming interfaces
May 25 11:35:37 localhost kernel: usbaudio: device 3 interface 1 altsetting 0 do
es not have an endpoint
May 23 22:38:43 localhost kernel: usbaudio: valid sample rate 48000
May 23 22:38:43 localhost kernel: usbaudio: valid sample rate 44100
May 23 22:38:43 localhost kernel: usbaudio: valid sample rate 22050
May 23 22:38:43 localhost kernel: usbaudio: valid sample rate 11025
May 23 22:38:43 localhost kernel: usbaudio: valid sample rate 8000
May 25 11:35:37 localhost kernel: usbaudio: device 3 interface 1 altsetting 1: f
ormat 0x00000010 sratelo 8000 sratehi 48000 attributes 0x01
May 25 11:35:37 localhost kernel: usbaudio: registered dsp 3
May 25 11:35:37 localhost kernel: usbaudio: constructing mixer for Terminal 2 ty
pe 0x0101
May 25 11:35:37 localhost kernel: usbaudio: workaround for broken Philips Camera
Microphone descriptor enabled
May 25 11:35:37 localhost kernel: usbaudio: register mixer 0
May 25 11:35:37 localhost kernel: usb_audio_parsecontrol: usb_audio_state at cd8
ed540


Attached sample & kernel patch for extra debugging. "audio.c" gives no clue as
to which section of the Audio Class Spec it is parsing, and uses hard-coded offets
into structures rather than the official names from the Class Spec. This is not a good thing!

Bryce Nesbitt <bryce -at the machine- obviously.com>[unhandled content-type:application/octet-stream][unhandled content-type:application/octet-stream]
\
 
 \ /
  Last update: 2005-03-22 12:53    [W:0.054 / U:0.012 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site