Jump to content

Orange PI Zero + 4 USB-audio recording crackling


Recommended Posts

Hello,

 

I use Orange Pi Zero + 4 ports USB hub + CM108 USB-Audio cards with mic-in.

 

All by default.

 

Each mic is captured with sipmle commands like:

arecord -v -r 44100 -c 1 -D "hw:CARD=Device_1,DEV=0" -f S16_LE > mic1.wav

 

When 3 cards capturing simultaneous all working well. But if I start capturing with 4th card simultaneous  I get two cards with crackling recorded audio.

I even can see that arecord saves less data from these two cards (file size is less than with 3 cards). No error/warning provided anywhere (dmesg, syslog, arecord).

 

Moreover, if I stops recording from one card - it becomes normal for rest of them instantly. 

 

And this strange behavious exists in all cases I tried. SImultaneous recording start for 4 cards, start recording later for 4th card, many dirfferent 4 ports USB hubs, USB 1.1, USB 2.0, different sudio cards (CM108)....

 

Very rarely I could get normal operation for 4th cards simultaneouly, but for the same configuration it worked bad again after restart.

 

Could you please suggest how I can attack this issue? Do you need any info in addition to get better view?

 

Thank you.

 

Link to comment
Share on other sites

Sure.

 

3 cards (recording start immediately after reboot) 

orangepizero:~$ cat /proc/interrupts
           CPU0       CPU1       CPU2       CPU3
 10:        152          0          0          0  sunxi_gpio_irq_chip  xradio_irq
 29:       5980       4478       6802       4509       GIC  arch_timer
 30:          0          0          0          0       GIC  arch_timer
 32:        541          0          0          0       GIC  uart0
 38:         24          0          0          0       GIC  twi0
 39:         18          0          0          0       GIC  twi1
 43:          0          0          0          0       GIC  PA
 49:        152          0          0          0       GIC  PG
 50:          0          0          0          0       GIC  sunxi_timer0
 63:          0          0          0          0       GIC  Thermal
 72:          0          0          0          0       GIC  sunxi-rtc alarm
 77:          0          0          0          0       GIC  PL
 81:          0          0          0          0       GIC  arisc_hwmsgbox_irq
 82:          0          0          0          0       GIC  sunxi_dmac
 90:          0          0          0          0       GIC  cedar_dev
 92:       5415          0          0          0       GIC  sunxi-mmc
 93:       6634          0          0          0       GIC  sunxi-mmc
 97:          0          0          0          0       GIC  spi0
 98:          0          0          0          0       GIC  spi1
103:          1          0          0          0       GIC  sunxi_usb_udc
104:          0          0          0          0       GIC  ehci_hcd:usb1
105:          0          0          0          0       GIC  ohci_hcd:usb5
106:        164          0          0          0       GIC  ehci_hcd:usb2
107:          0          0          0          0       GIC  ohci_hcd:usb6
108:          0          0          0          0       GIC  ehci_hcd:usb3
109:          0          0          0          0       GIC  ohci_hcd:usb7
110:        585          0          0     182786       GIC  ehci_hcd:usb4
111:          0          0          0          0       GIC  ohci_hcd:usb8
114:       1411          0          0          0       GIC  gmac0
119:       8532          0          0          0       GIC  dispaly
IPI0:          0          0          0          0  CPU wakeup interrupts
IPI1:          0          0          0          0  Timer broadcast interrupts
IPI2:       5013       5285       5030       4738  Rescheduling interrupts
IPI3:        145        152         55        157  Function call interrupts
IPI4:          1          3          0          1  Single function call interrupts
IPI5:          0          0          0          0  CPU stop interrupts
IPI6:          0          0          0          0  CPU backtrace
IPI7:          0          0          0          0  completion interrupts
Err:          0

 

File sizes (capturing started the same time among all files and filename postfix is actual timestamp of that start):

-rw-r--r-- 1 root root  6205044 Dec 20 20:40 arecord.mic.2_1513802382.wav
-rw-r--r-- 1 root root  6205044 Dec 20 20:40 arecord.mic.1_1513802382.wav
-rw-r--r-- 1 root root  6205044 Dec 20 20:40 arecord.mic.0_1513802382.wav

 

4 cards (rebooted after 3 cards and fresh recording start) 

orangepizero:~$ cat /proc/interrupts
           CPU0       CPU1       CPU2       CPU3
 10:        179          0          0          0  sunxi_gpio_irq_chip  xradio_irq
 29:       7541       6781       8762       5226       GIC  arch_timer
 30:          0          0          0          0       GIC  arch_timer
 32:        558          0          0          0       GIC  uart0
 38:         24          0          0          0       GIC  twi0
 39:         18          0          0          0       GIC  twi1
 43:          0          0          0          0       GIC  PA
 49:        179          0          0          0       GIC  PG
 50:          0          0          0          0       GIC  sunxi_timer0
 63:          0          0          0          0       GIC  Thermal
 72:          0          0          0          0       GIC  sunxi-rtc alarm
 77:          0          0          0          0       GIC  PL
 81:          0          0          0          0       GIC  arisc_hwmsgbox_irq
 82:          0          0          0          0       GIC  sunxi_dmac
 90:          0          0          0          0       GIC  cedar_dev
 92:       7427          0          0          0       GIC  sunxi-mmc
 93:       7637          0          0          0       GIC  sunxi-mmc
 97:          0          0          0          0       GIC  spi0
 98:          0          0          0          0       GIC  spi1
103:          1          0          0          0       GIC  sunxi_usb_udc
104:          0          0          0          0       GIC  ehci_hcd:usb1
105:          0          0          0          0       GIC  ohci_hcd:usb5
106:        165          0          0          0       GIC  ehci_hcd:usb2
107:          0          0          0          0       GIC  ohci_hcd:usb6
108:          0          0          0          0       GIC  ehci_hcd:usb3
109:          0          0          0          0       GIC  ohci_hcd:usb7
110:        583          0          0     350720       GIC  ehci_hcd:usb4
111:          0          0          0          0       GIC  ohci_hcd:usb8
114:       1201          0          0          0       GIC  gmac0
119:      11105          0          0          0       GIC  dispaly
IPI0:          0          0          0          0  CPU wakeup interrupts
IPI1:          0          0          0          0  Timer broadcast interrupts
IPI2:       6127       6553       5499       4628  Rescheduling interrupts
IPI3:        138        167         47        163  Function call interrupts
IPI4:          3          3          0          3  Single function call interrupts
IPI5:          0          0          0          0  CPU stop interrupts
IPI6:          0          0          0          0  CPU backtrace
IPI7:          0          0          0          0  completion interrupts
Err:          0

 

File sizes (you can see that two have less size while they started the same time and with absolutely same arecord and card parameters)

-rw-r--r-- 1 root root 12240044 Dec 20 20:35 arecord.mic.2_1513801965.wav
-rw-r--r-- 1 root root 12240044 Dec 20 20:35 arecord.mic.3_1513801965.wav
-rw-r--r-- 1 root root 14195044 Dec 20 20:35 arecord.mic.0_1513801965.wav
-rw-r--r-- 1 root root 14195044 Dec 20 20:35 arecord.mic.1_1513801965.wav

 

arecord command used for all cards (only CARD name is different among the cards):

arecord -v -r 48000 -c 1 -D plughw:CARD=Device,DEV=0 -f S16_LE -d 1800 --buffer-size=170000 --fatal-errors

 

kernel:

orangepizero:~$ uname -a
Linux orangepizero 3.4.113-sun8i #16 SMP PREEMPT Tue Jun 13 14:15:57 CEST 2017 armv7l armv7l armv7l GNU/Linux

 

SD card speed. It is  fast. I tested it with simultaneous recording of 10  streams with 2Mbps bitrate each with no issue. DD test:

orangepizero:~$ dd if=/dev/zero of=testfile bs=1M count=1000 oflag=direct
1000+0 records in
1000+0 records out
1048576000 bytes (1.0 GB, 1000 MiB) copied, 49.8259 s, 21.0 MB/s

And mount options:

/dev/mmcblk0p1 on /var/log.hdd type ext4 (rw,noatime,nodiratime,errors=remount-ro,commit=600)

 

 

If you want me to perform any test or try a specific configuration I am ready to make it.  

 

 

Link to comment
Share on other sites

This is very weird. I would not expect this behaviour. The only suggestions I can think of are: try the mainline linux version, try a real time kernel, or try some different usb audio recorders.  Maybe a USB device with stereo mic in, so you'd only need 2 of them? I have used these before: https://www.ebay.com/itm/361502397040 and they work without any special drivers. I'm using alsa and the throughput is fine. 

 

The real problem here is that it should work. I'm sort of confused about it. I think the mainline kernel is your best option, followed by a realtime mainline kernel.  I'm sorry I couldn't be of more help. 

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
×
×
  • Create New...

Important Information

Terms of Use - Privacy Policy - Guidelines