8

I have two speakers. The first one is connected to a PCI card and the second one via Bluetooth. Sounds are played a little bit earlier on the PCI card so I want to add some latency. I downloaded the pulse audio GUI and I have this :

enter image description here

As you can see, I added offset of 2 seconds on the "Audio Interne" (the PCI card).

I checked with the command pactl list cards and I have this for the internal card :

Card #1
        Name: alsa_card.pci-0000_00_1b.0
        Driver: module-alsa-card.c
        Owner Module: 8
        Properties:
                alsa.card = "0"
                alsa.card_name = "HDA Intel PCH"
                alsa.long_card_name = "HDA Intel PCH at 0xf7f10000 irq 27"
                alsa.driver_name = "snd_hda_intel"
                device.bus_path = "pci-0000:00:1b.0"
                sysfs.path = "/devices/pci0000:00/0000:00:1b.0/sound/card0"
                device.bus = "pci"
                device.vendor.id = "8086"
                device.vendor.name = "Intel Corporation"
                device.product.id = "1e20"
                device.product.name = "7 Series/C216 Chipset Family High Definition Audio Controller"
                device.form_factor = "internal"
                device.string = "0"
                device.description = "Audio interne"
                module-udev-detect.discovered = "1"
                device.icon_name = "audio-card-pci"
        Profiles:
                input:analog-stereo: Entrée Stéréo analogique (sinks: 0, sources: 1, priority: 65, available: yes)
                output:analog-stereo: Sortie Stéréo analogique (sinks: 1, sources: 0, priority: 6500, available: yes)
                output:analog-stereo+input:analog-stereo: Duplex stéréo analogique (sinks: 1, sources: 1, priority: 6565, available: yes)
                output:analog-surround-21: Sortie Surround analogique 2.1 (sinks: 1, sources: 0, priority: 1300, available: yes)
                output:analog-surround-21+input:analog-stereo: Sortie Surround analogique 2.1 + Entrée Stéréo analogique (sinks: 1, sources: 1, priority: 1365, available: yes)
                output:analog-surround-40: Sortie Surround analogique 4.0 (sinks: 1, sources: 0, priority: 1200, available: yes)
                output:analog-surround-40+input:analog-stereo: Sortie Surround analogique 4.0 + Entrée Stéréo analogique (sinks: 1, sources: 1, priority: 1265, available: yes)
                output:analog-surround-41: Sortie Surround analogique 4.1 (sinks: 1, sources: 0, priority: 1300, available: yes)
                output:analog-surround-41+input:analog-stereo: Sortie Surround analogique 4.1 + Entrée Stéréo analogique (sinks: 1, sources: 1, priority: 1365, available: yes)
                output:analog-surround-50: Sortie Surround analogique 5.0 (sinks: 1, sources: 0, priority: 1200, available: yes)
                output:analog-surround-50+input:analog-stereo: Sortie Surround analogique 5.0 + Entrée Stéréo analogique (sinks: 1, sources: 1, priority: 1265, available: yes)
                output:analog-surround-51: Sortie Surround analogique 5.1 (sinks: 1, sources: 0, priority: 1300, available: yes)
                output:analog-surround-51+input:analog-stereo: Sortie Surround analogique 5.1 + Entrée Stéréo analogique (sinks: 1, sources: 1, priority: 1365, available: yes)
                output:iec958-stereo: Sortie Stéréo numérique (IEC958) (sinks: 1, sources: 0, priority: 5500, available: yes)
                output:iec958-stereo+input:analog-stereo: Sortie Stéréo numérique (IEC958) + Entrée Stéréo analogique (sinks: 1, sources: 1, priority: 5565, available: yes)
                off: Éteint (sinks: 0, sources: 0, priority: 0, available: yes)
        Active Profile: output:analog-stereo
        Ports:
                analog-input-front-mic: Microphone avant (priority: 8500, latency offset: 0 usec, available)
                        Properties:
                                device.icon_name = "audio-input-microphone"
                        Part of profile(s): input:analog-stereo, output:analog-stereo+input:analog-stereo, output:analog-surround-21+input:analog-stereo, output:analog-surround-40+input:analog-stereo, output:analog-surround-41+input:analo
g-stereo, output:analog-surround-50+input:analog-stereo, output:analog-surround-51+input:analog-stereo, output:iec958-stereo+input:analog-stereo
                analog-input-rear-mic: Microphone arrière (priority: 8200, latency offset: 0 usec, not available)
                        Properties:
                                device.icon_name = "audio-input-microphone"
                        Part of profile(s): input:analog-stereo, output:analog-stereo+input:analog-stereo, output:analog-surround-21+input:analog-stereo, output:analog-surround-40+input:analog-stereo, output:analog-surround-41+input:analo
g-stereo, output:analog-surround-50+input:analog-stereo, output:analog-surround-51+input:analog-stereo, output:iec958-stereo+input:analog-stereo
                analog-input-linein: Entrée ligne (priority: 8100, latency offset: 0 usec, available)
                        Part of profile(s): input:analog-stereo, output:analog-stereo+input:analog-stereo, output:analog-surround-21+input:analog-stereo, output:analog-surround-40+input:analog-stereo, output:analog-surround-41+input:analo
g-stereo, output:analog-surround-50+input:analog-stereo, output:analog-surround-51+input:analog-stereo, output:iec958-stereo+input:analog-stereo
                analog-output-lineout: Sortie ligne (priority: 9900, latency offset: 2000000 usec, available)
                        Part of profile(s): output:analog-stereo, output:analog-stereo+input:analog-stereo, output:analog-surround-21, output:analog-surround-21+input:analog-stereo, output:analog-surround-40, output:analog-surround-40+inp
ut:analog-stereo, output:analog-surround-41, output:analog-surround-41+input:analog-stereo, output:analog-surround-50, output:analog-surround-50+input:analog-stereo, output:analog-surround-51, output:analog-surround-51+input:analog-stereo
                analog-output-headphones: Casque audio (priority: 9000, latency offset: 2000000 usec, not available)
                        Properties:
                                device.icon_name = "audio-headphones"
                        Part of profile(s): output:analog-stereo, output:analog-stereo+input:analog-stereo
                iec958-stereo-output: Sortie numérique (S/PDIF) (priority: 0, latency offset: 0 usec)
                        Part of profile(s): output:iec958-stereo, output:iec958-stereo+input:analog-stereo

And I tried to do pactl play-sample bell.ogg alsa_output.pci-0000_00_1b.0.analog-stereo. It always seems instantaneous. The latency I set doesn't seems to change anything, even when I play music.

What can I do?

EDIT

With pactl list sinks, I see this :

Latency: 2039815 usec, configured 40000 usec 

So it seems the latency is set correctly but it seems to be instantaneous when I play a sound. I suppose there should be a delay. Is there something I don't understand?

2 Answers 2

2
+50

I guess the latency offset in your screenshot is just Pulsaudio calculating time to buffer sizes with given sample frequencies and trying to arrange this parameters with ALSA. Changing the latency offset there not showing an effect might just be an ALSA driver not supporting much variety in buffer sizes.

To get an extra buffer you could add a null sink to use module-loobpack's latency_msec like so:

pactl load-module module-null-sink sink_name=delayed
pactl load-module module-loopback latency_msec=2000 source=delayed.monitor sink=alsa_output.pci-0000_00_1b.0.analog-stereo

Then you have to combine the null sink with your bluetooth audio.

I've had the expected huge delay when testing this simple setup without module-combine-sink like this:

paplay someaudio.ext --device delayed
3
  • I tried to load the second device with pactl load-module module-loopback latency_msec=2000 source=delayed.monitor sink=bluez_sink.F8_DF_15_BB_6D_F5.a2dp_sink so the paplay command send the sound to both devices but I still have the same problem. I tried with a single device but it's always instantaneous. I tried with other latency_msec but it doesn't change anything. Any idea?
    – Dougui
    Jan 20, 2019 at 21:30
  • finally it seems to works. I'm don't why it doesn't yesterday. I had to find the right accuracy with command line by doeing pactl load-module and pactl unload-module each time. Do you have a more convenient way? A graphical tool would be nice.
    – Dougui
    Jan 21, 2019 at 14:10
  • Sorry, I don't know a graphical tool for that. But for loading and unloading you could do something like index=$( pactl load-module ... ); sleep 5; pactl unload-module $index
    – thomas
    Jan 21, 2019 at 22:24
0

You need the latency on the Haut-parluer (Speaker), not the Sortei ligne (Line Out or Headphone Jack). Or, you could put the latency on both as long as the bluetooth is not a device plugged into the head phone jack, as this would further increase the latency.

  • The sound would be instantaneous, because the latency for the internal speakers is 0. Yet the head phone jacks is 2 seconds.
2
  • I tried different settings and it never take the latency. The sound is always instantaneous. I tried to set the latency as you said but it doesn't change anything.
    – Dougui
    Jan 20, 2019 at 21:34
  • Weird, wish I could be more helpful. Jan 20, 2019 at 23:25

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .