Lag when using module-loopback

Bug #566381 reported by Matthew Woerly on 2010-04-19
This bug affects 29 people
Affects Status Importance Assigned to Milestone
pulseaudio (Ubuntu)

Bug Description

Binary package hint: pulseaudio

pactl load-module module-loopback
I can route the mic input through output. However, the audio that comes out is about half a second behind the audio coming in. This is okay for some things, but for others, like musical instruments, game consoles, etc., the lag makes it pretty much unusable for these uses.
Back in alsa this used to work fine without lag.

ProblemType: Bug
DistroRelease: Ubuntu 10.04
Package: pulseaudio 1:0.9.22~0.9.21+stable-queue-32-g8478-0ubuntu14
ProcVersionSignature: Ubuntu 2.6.32-19.28-generic
Uname: Linux 2.6.32-19-generic x86_64
NonfreeKernelModules: nls_iso8859_1 nls_cp437 btrfs zlib_deflate crc32c libcrc32c ufs qnx4 hfsplus hfs minix ntfs vfat msdos fat jfs xfs exportfs reiserfs pata_jmicron acpiphp michael_mic arc4 hidp rfcomm binfmt_misc sco bridge stp bnep l2cap vboxnetadp vboxnetflt dm_crypt snd_hda_codec_idt snd_hda_codec_intelhdmi snd_hda_intel snd_hda_codec snd_hwdep snd_pcm_oss snd_mixer_oss snd_pcm snd_seq_dummy snd_seq_oss snd_seq_midi vboxdrv snd_rawmidi joydev snd_seq_midi_event lp snd_seq snd_timer snd_seq_device lib80211_crypt_tkip snd parport soundcore wl dell_wmi btusb psmouse dell_laptop dcdbas ricoh_mmc snd_page_alloc lib80211 sdhci_pci sdhci led_class serio_raw bluetooth dm_raid45 xor fbcon tileblit font bitblit softcursor vga16fb vgastate usbhid hid i915 drm_kms_helper ohci1394 drm i2c_algo_bit ieee1394 sky2 intel_agp ahci video output
AlsaVersion: Advanced Linux Sound Architecture Driver Version 1.0.21.
Architecture: amd64
 **** List of CAPTURE Hardware Devices ****
 card 0: Intel [HDA Intel], device 0: STAC92xx Analog [STAC92xx Analog]
   Subdevices: 0/1
   Subdevice #0: subdevice #0
 /dev/snd/controlC0: matthew 10508 F.... pulseaudio
 /dev/snd/pcmC0D0c: matthew 10508 F...m pulseaudio
 /dev/snd/pcmC0D0p: matthew 10508 F...m pulseaudio
 Card hw:0 'Intel'/'HDA Intel at 0xfe9fc000 irq 21'
   Mixer name : 'SigmaTel STAC9228'
   Components : 'HDA:14f12c06,14f1000f,00100000 HDA:10951392,1028022f,00100000 HDA:83847616,1028022f,00100402'
   Controls : 23
   Simple ctrls : 12
Date: Sun Apr 18 21:42:33 2010
InstallationMedia: Ubuntu 10.04 "Lucid Lynx" - Beta amd64 (20100318)
SourcePackage: pulseaudio 03/10/2008
dmi.bios.vendor: Dell Inc.
dmi.bios.version: A11 0U990C
dmi.board.vendor: Dell Inc.
dmi.chassis.type: 8
dmi.chassis.vendor: Dell Inc.
dmi.modalias: dmi:bvnDellInc.:bvrA11:bd03/10/2008:svnDellInc.:pnInspiron1525:pvr:rvnDellInc.:rn0U990C:rvr:cvnDellInc.:ct8:cvr: Inspiron 1525
dmi.sys.vendor: Dell Inc.

Matthew Woerly (nattgew) wrote :

AlsaVersion: Advanced Linux Sound Architecture Driver Version 1.0.21.
Architecture: i386
 /dev/snd/controlC1: jack 1260 F.... pulseaudio
 /dev/snd/controlC0: jack 1260 F.... pulseaudio
 Card hw:0 'Intel'/'HDA Intel at 0xf2000000 irq 16'
   Mixer name : 'Realtek ALC880'
   Components : 'HDA:10ec0880,08800000,00090500'
   Controls : 38
   Simple ctrls : 21
 Card hw:1 'SAA7134'/'saa7133[0] at 0xf1004000 irq 19'
   Mixer name : 'SAA7134 Mixer'
   Components : ''
   Controls : 6
   Simple ctrls : 3
DistroRelease: Ubuntu 10.04
InstallationMedia: Ubuntu 10.04 LTS "Lucid Lynx" - Release i386 (20100429)
NonfreeKernelModules: nvidia
Package: pulseaudio 1:0.9.22~0.9.21+stable-queue-32-g8478-0ubuntu14
PackageArchitecture: i386
 PATH=(custom, user)
ProcVersionSignature: Ubuntu 2.6.32-22.33-generic
Tags: lucid
Uname: Linux 2.6.32-22-generic i686
UserGroups: adm admin cdrom dialout lpadmin plugdev sambashare 09/02/2004
dmi.bios.vendor: Award Software International, Inc.
dmi.bios.version: F4 8I915GMF
dmi.board.vendor: Gigabyte Technology Co., Ltd.
dmi.board.version: x.x
dmi.chassis.type: 3
dmi.modalias: dmi:bvnAwardSoftwareInternational,Inc.:bvrF4:bd09/02/2004:svn:pn:pvr:rvnGigabyteTechnologyCo.,Ltd.:rn8I915GMF:rvrx.x:cvn:ct3:cvr:

tags: added: apport-collected

apport information

apport information

apport information

apport information

apport information

apport information

apport information

apport information

apport information

apport information

apport information

Tamás Kiss (tkiss80) wrote :

Ugh, sorry. I didn't know this apport-collect thing would automatically insert 11 distinct entries instead of one.

Anyway, same problem here, except that I tried to connect my SAA7134-based TV tuner's source to the default pulse sink with module-loopback. The result was ~0.5 sec time delay of the audio compared to the TV application's video signal (I use xawtv). Then I tried the following:

$ pactl load-module module-loopback latency_msec=1

the lag was still there, although it went down to ~ 0.1-0.2 sec. It is still too much, so I still have to wire the card to the motherboard's CD-in connector, and get the sound from ALSA's CD input channel.

On the other hand, the cable and the connectors pick up electric noise so easy, that I can imitate the sound effects of the Star Wars laser swords with mouse movements. :)

amadaden (amadaden) wrote :

Several people are having this issue.

I also saw a post that said something about a buffer being to large but I can not find it again so it may have been for a different issue.

ttbek (ttbek) wrote :

Same problem here, worked fine back in 9.10, also if you install the other packages (paprefs) and go to System>Preferences>PulseAudio Preferences and then to the Multicast/RTP tab and enable both the sender and receiver, then check "loop audio to local speakers" then the audio is not delayed, but is very choppy, chops incessantly, I don't know if this is related to the delay problem using the loopback module, so it might work as a workaround for some people, but is not for me. Audacity offers a playthrough option that works perfectly for me, no delay, no choppiness, except that I have to be recording in order to use it. Hopefully this problem is fixed soon, I can run any commands anyone provides to gather more data on the problem.

amadaden (amadaden) wrote :

That's an interesting alternate way of doing this. FYI Multicast/RTP is for network shared audio. So your method works by having the computer send an audio stream to it self over the network. The sound is so choppy because an audio stream up and down is to much data for a network card to handle. Even if the sound was not choppy all the new network traffic would still be a problem.

ttbek (ttbek) wrote :

Network traffic just for audio shouldn't really be a problem, even really high quality audio is typically <1MB a second. I'm pretty sure your typical network card should handle that just fine, I mean we've done likewise with video on our home network without a problem, high quality mkvs at that. So I feel like it is some problem in the implementation of routing it back, or this might all be related to jackd? I don't really know anything about it though, so I could be entirely wrong.

wirespot (wirespot) wrote :

The Multicast/RTP workaround is having the same kind of delay for me.

Russ Tndall (bobbysmith007) wrote :

In the mean time you can:
 * go the terminal
 * Type "alsamixer" and hit enter
 * go right a bunch till you find the input you are looking for ( you may have to go past the end of the screen)
 * make sure you turn the volume up and press m to unmute (if necessary)
 * you should hear your guitar / tv / game console etc

ℵ (zeta-function) wrote :

This is a critical bug generating endless reports from Ubuntu users.
Note that even with 'pactl load-module module-loopback latency_msec=1', there is still some lag.

I myself cannot believe why this important feature affecting so many people is still left unfixed.
Loopback used to work on Ubuntu, but now it doesn't because of the introduction of pulseaudio.

What's stopping you from working on this?
Why is it taking so long?

No, it does not work on most systems.

Changed in pulseaudio (Ubuntu):
status: New → Confirmed
Ibrahim M. Ghazal (imgx64) wrote :

I'm having the same problem. I timed the delay using a stopwatch, it's about 1.1 seconds! The delay is the same using module-loopback and Multicast/RTP.

Paul Crawford (psc-sat) wrote :

Same problem here with 10.04 LTS.
Come on, a *second* delay on a GHz machine is appalling! And the inability to get that down to an acceptable delay for acceptable human reception, in particular when it apparently worked fine with the alsa module, is just pathetic. Why is nothing being done? There are complaints about this going back over a year to 9.10!

Paul Crawford (psc-sat) wrote :

Just to add, the alsa suggestion of comment 20 is not appearing to work on this laptop (Intel Corporation N10/ICH 7 Family High Definition Audio Controller), and it also is bizarre that you need to specially load the loop-back module from the command line to allow mic mixing in to the audio stream.
Why is that? Due to it not working well enough? It should be a tick-box or similar in the "Sound Preferences..." GUI so non-technical users can do what should be simple & straightforward.

Brian (rephorm) wrote :

I am also affected by this latency issue with the loopback module. However, while playing around with pavucontrol I noticed it go away (for the most part, still a slight lag, but seems to be under 10 ms (instead of the 500 ms - 1 s I had before). Unfortunately, the latency issue returned later.

Then I stumbled across post #11 of

For some reason, if you open up pavucontrol, go to the "Recording" tab and switch "Show" to "All Streams", then the latency gets much better. Close pavucontrol and it returns.

So, whatever pavucontrol does when you switch to monitoring all recording streams should be the answer to this problem.

Brian (rephorm) wrote :

Another method, which seems to give even less lag is to *not* load the loopback module, but instead use parec and pacat. e.g.

parec --latency-msec=1 | pacat --latency-msec=1

You can probably lengthen these to a few msec.

ix (gecekle) wrote :

This is about the support of a fundamental functionality any soundcard provides and 99% of the "not only playbacking" users do. Any sound system should support this out of the box and without any need to have a deeper understanding, browse faqs, forums and without the need to do special things on command line. I dont give a S... for networked audio if I cant do the most basic things that I could do with soundblaster on linux slackware 15 years ago. I have no understanding whatsoever why this is an issue at all.

Tyler Burton (tylerburtonca) wrote :

I can confirm that this still exists in 11.04.

I did find a work around for it though. Similar to what Brian wrote above I ran:

pacat -r --latency-msec=1 -d [input] | pacat -p --latency-msec=1 -d [output]

where [input] and [output] where the names of the audio devices shown in paman. In my case it looked like:

pacat -r --latency-msec=1 -d alsa_input.pci-0000_05_02.0.analog-stereo | pacat -p --latency-msec=1 -d alsa_output.pci-0000_05_02.0.analog-surround-51

Amran (amx109) wrote :

can confirm this problem exists in 13.10

tried the workarounds with pacat but to no avail, but there is some strange but consistent behaviour:

initially the latency is around the sub 50ms mark, but every 10secs it increases exponentially until you get a >1sec delay

Raymond (superquad-vortex2) wrote :

>> so I still have to wire the card to the motherboard's CD-in connector, and get the sound from ALSA's CD input channel.


options snd-hda-intel model=6stack-digout

use line in instead of CD


use hdajackretask or early patching to set node 0x1c to CD to get CD playback volume/switch at node 0x0b

Node 0x0b [Audio Mixer] wcaps 0x20010b: Stereo Amp-In
  Amp-In caps: ofs=0x23, nsteps=0x41, stepsize=0x03, mute=1
  Amp-In vals: [0x80 0x80] [0x80 0x80] [0x80 0x80] [0x80 0x80] [0xaa 0xaa] [0xa3 0xa3] [0x80 0x80] [0x80 0x80]
  Connection: 8
     0x18 0x19 0x1a 0x1b 0x1c 0x1d 0x14 0x15

Node 0x1c [Pin Complex] wcaps 0x400001: Stereo
  Pincap 0x00000020: IN
  Pin Default 0x00000000: [Jack] Line Out at Ext N/A
    Conn = Unknown, Color = Unknown
    DefAssociation = 0x0, Sequence = 0x0
  Pin-ctls: 0x00:

Raymond (superquad-vortex2) wrote :
Changed in pulseaudio (Ubuntu):
status: Confirmed → Incomplete
Launchpad Janitor (janitor) wrote :

[Expired for pulseaudio (Ubuntu) because there has been no activity for 60 days.]

Changed in pulseaudio (Ubuntu):
status: Incomplete → Expired
ekin (ekin) wrote :

I'm using Ubuntu 14.04 and there is a lag when using module-loopback. Are there any plans to fix this bug?

Changed in pulseaudio (Ubuntu):
status: Expired → Confirmed
Jason Robinson (jaywink) wrote :

Also on 14.04 and affected by this.

Jason Robinson (jaywink) wrote :

Sorry, meant to say on 15.04, not 14.04.

tags: added: vivid
Daniel van Vugt (vanvugt) wrote :

Ubuntu 15.04 (vivid) reached end-of-life on February 4, 2016. But 14.04 is still supported for about two more years...

Michel-Ekimia (michel.ekimia) wrote :

Same on 16.04 ...

To post a comment you must log in.