Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I'm developing OpenWrt device which sends audio data to network but I have issues in the early beginning.

I'm trying to find which cause delay in playing (or maybe recording, but more probably playing) real time record from microphone.

For example I run arecord | aplay on my Debian machine and the delay in playing is somewhere between 500-1000 ms.

When I run the same command on my OpenWrt box (TP LINK wr703n) I get almost the same delay (Same to cat /dev/dsp > /dev/dsp)

When I stream sound using netcat(with UDP) from OpenWrt box to Debian PC (on LAN) I get almost the same delay. I think It does not depend on sound card - on OpenWrt I use usb sound card connected via hub and on Debian machine I use integrated notebook sound card.

Which could cause this delay? Or do you know possible solutions?

Thank you and sorry my english :)

share|improve this question
    
The answer to this question is likely multi-faceted. For one, your usb-sound-card is likely making bulk-mode transfers only - which is bound to include a minimum buffer-size. Next, there's cpu-scheduling; the linux kernel running your router (especially if it's OpenWRT) is also likely to schedule network packets ahead of your bulk-USB packets - so that will add to the delay. Then the kernel has to translate your USB packets to IP and repack them according to your set MTU and the receiving machine has to do all of the same work, before processing and playing the sound stream. –  mikeserv Mar 20 at 15:49
    
Thank you for answer. I thought that it wont be perfect, but the same problem is on my laptop(Lenovo S300 running Debian) so I thought that It can be adjusted by some player buffer setting or so. –  kyckoff Mar 21 at 21:40
    
Do you think there is some solution? –  kyckoff Mar 21 at 21:40
    
I do, but i dont think youll like it. You need better audio hardware. Low-latency is high-dollar, dude. There are ways to hack at it and gain a little here or there, but youll probably lose something else. Good luck is all i can say. –  mikeserv Mar 22 at 0:15
    
You're right, I don't :D But thank you anyway. –  kyckoff Mar 24 at 15:51

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.