PulseAudio Loopback Latency












3














I am using pulseaudio loopback's to link together my system sounds and my microphone. The problem is that my system sounds have a delay of a second or even more sometimes. I have changed ticked simultaneous in paprefs but that has not fixed it. I am using this script to do so.



STREAM_MODULE=$(pactl load-module module-null-sink sink_name=StreamAudio sink_properties=device.description="StreamAudio")

pactl load-module module-loopback source=alsa_output.pci-0000_00_1b.0.analog-stereo.monitor sink=StreamAudio latency_msec=1 >> /dev/null
pactl load-module module-loopback source=alsa_input.usb-AKM_AK5370-00-AK5370.analog-mono sink=StreamAudio latency_msec=1 >> /dev/null

pactl load-module module-device-manager >> /dev/null

read -p "Loaded! Press enter to unload!"

pactl unload-module $STREAM_MODULE
pactl unload-module module-device-manager
pactl unload-module module-null-sink
pactl unload-module module-loopback


I have gone through pages of google, but nothing seems to fix it. Is there something obvious I am missing?



alsa_output.pci-0000_00_1b.0.analog-stereo.monitor are all my system sounds.



alsa_input.usb-AKM_AK5370-00-AK5370.analog-mono is my microphone



Here is an example where the delay becomes 3.4 seconds: http://screencloud.net/v/tNAQ while the other loopback has a lot less http://screencloud.net/v/suIF



From what I can tell, for some reason the buffer fills up. Any way I can flush it or something?










share|improve this question





























    3














    I am using pulseaudio loopback's to link together my system sounds and my microphone. The problem is that my system sounds have a delay of a second or even more sometimes. I have changed ticked simultaneous in paprefs but that has not fixed it. I am using this script to do so.



    STREAM_MODULE=$(pactl load-module module-null-sink sink_name=StreamAudio sink_properties=device.description="StreamAudio")

    pactl load-module module-loopback source=alsa_output.pci-0000_00_1b.0.analog-stereo.monitor sink=StreamAudio latency_msec=1 >> /dev/null
    pactl load-module module-loopback source=alsa_input.usb-AKM_AK5370-00-AK5370.analog-mono sink=StreamAudio latency_msec=1 >> /dev/null

    pactl load-module module-device-manager >> /dev/null

    read -p "Loaded! Press enter to unload!"

    pactl unload-module $STREAM_MODULE
    pactl unload-module module-device-manager
    pactl unload-module module-null-sink
    pactl unload-module module-loopback


    I have gone through pages of google, but nothing seems to fix it. Is there something obvious I am missing?



    alsa_output.pci-0000_00_1b.0.analog-stereo.monitor are all my system sounds.



    alsa_input.usb-AKM_AK5370-00-AK5370.analog-mono is my microphone



    Here is an example where the delay becomes 3.4 seconds: http://screencloud.net/v/tNAQ while the other loopback has a lot less http://screencloud.net/v/suIF



    From what I can tell, for some reason the buffer fills up. Any way I can flush it or something?










    share|improve this question



























      3












      3








      3


      2





      I am using pulseaudio loopback's to link together my system sounds and my microphone. The problem is that my system sounds have a delay of a second or even more sometimes. I have changed ticked simultaneous in paprefs but that has not fixed it. I am using this script to do so.



      STREAM_MODULE=$(pactl load-module module-null-sink sink_name=StreamAudio sink_properties=device.description="StreamAudio")

      pactl load-module module-loopback source=alsa_output.pci-0000_00_1b.0.analog-stereo.monitor sink=StreamAudio latency_msec=1 >> /dev/null
      pactl load-module module-loopback source=alsa_input.usb-AKM_AK5370-00-AK5370.analog-mono sink=StreamAudio latency_msec=1 >> /dev/null

      pactl load-module module-device-manager >> /dev/null

      read -p "Loaded! Press enter to unload!"

      pactl unload-module $STREAM_MODULE
      pactl unload-module module-device-manager
      pactl unload-module module-null-sink
      pactl unload-module module-loopback


      I have gone through pages of google, but nothing seems to fix it. Is there something obvious I am missing?



      alsa_output.pci-0000_00_1b.0.analog-stereo.monitor are all my system sounds.



      alsa_input.usb-AKM_AK5370-00-AK5370.analog-mono is my microphone



      Here is an example where the delay becomes 3.4 seconds: http://screencloud.net/v/tNAQ while the other loopback has a lot less http://screencloud.net/v/suIF



      From what I can tell, for some reason the buffer fills up. Any way I can flush it or something?










      share|improve this question















      I am using pulseaudio loopback's to link together my system sounds and my microphone. The problem is that my system sounds have a delay of a second or even more sometimes. I have changed ticked simultaneous in paprefs but that has not fixed it. I am using this script to do so.



      STREAM_MODULE=$(pactl load-module module-null-sink sink_name=StreamAudio sink_properties=device.description="StreamAudio")

      pactl load-module module-loopback source=alsa_output.pci-0000_00_1b.0.analog-stereo.monitor sink=StreamAudio latency_msec=1 >> /dev/null
      pactl load-module module-loopback source=alsa_input.usb-AKM_AK5370-00-AK5370.analog-mono sink=StreamAudio latency_msec=1 >> /dev/null

      pactl load-module module-device-manager >> /dev/null

      read -p "Loaded! Press enter to unload!"

      pactl unload-module $STREAM_MODULE
      pactl unload-module module-device-manager
      pactl unload-module module-null-sink
      pactl unload-module module-loopback


      I have gone through pages of google, but nothing seems to fix it. Is there something obvious I am missing?



      alsa_output.pci-0000_00_1b.0.analog-stereo.monitor are all my system sounds.



      alsa_input.usb-AKM_AK5370-00-AK5370.analog-mono is my microphone



      Here is an example where the delay becomes 3.4 seconds: http://screencloud.net/v/tNAQ while the other loopback has a lot less http://screencloud.net/v/suIF



      From what I can tell, for some reason the buffer fills up. Any way I can flush it or something?







      sound pulseaudio






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Jul 5 '14 at 0:07

























      asked Jul 4 '14 at 23:13









      Vilsol

      75212




      75212






















          3 Answers
          3






          active

          oldest

          votes


















          2














          I have found a temporary way out, but this still confuses me. I have made a combined module, and after that I link every sound source I want to the combined one, which then routes to my system sounds and to the Streaming sink.



          STREAM_MODULE=$(pactl load-module module-null-sink sink_name=StreamAudio sink_properties=device.description="StreamAudio")
          COMBINE_MODULE=$(pactl load-module module-combine-sink sink_name=Combined sink_properties=device.description="Combined" slaves=StreamAudio,alsa_output.pci-0000_00_1b.0.analog-stereo)

          pactl load-module module-loopback rate=44000 adjust_time=0 source=alsa_input.usb-AKM_AK5370-00-AK5370.analog-mono sink=StreamAudio latency_msec=1 >> /dev/null

          pactl load-module module-device-manager >> /dev/null

          read -p "Loaded! Press enter to unload!"

          pactl unload-module $COMBINE_MODULE
          pactl unload-module $STREAM_MODULE
          pactl unload-module module-device-manager
          pactl unload-module module-loopback


          There is probably a way I can grep the results of pacmd list-clients and then clean out only valid sources, change their output to the combined sink, but that would take too long and complex to do.



          Though now a new problem arises, and I even tested it by running the command through terminal. For some reason I can't change the output sink of Java. Here is what I tried and what it returned:



          vilsol@skynet:~$ pacmd move-sink-input 6421 124
          Welcome to PulseAudio! Use "help" for usage information.
          >>> Moved failed.


          I tried with others as well and they all worked. 6421 is the Java index, and 124 is the sink index.






          share|improve this answer































            0














            Bit late but for those who still need help:

            Install the 'PulseAudio Loopback Device' GNOME Shell Extension (just search the bit in quotes in Ubuntu Software).



            PA Loopback Device Extension Screenshot



            It has hardly any noticable latency and was a perfect solution for me after quite a bit of searching!
            Hope this is useful to somebody!






            share|improve this answer































              -1














              Sometime ago I was able to loopback my guitar to the speakers without noticeable delay, so pulseaudio supports that, but I remember having trouble with delays less than 10ms. My suggestions are




              1. to review the command parameters

              2. use a bigger delay

              3. test each loopback separately and

              4. ask directly pulseaudio developers for instructions.






              share|improve this answer























              • I have already tried testing each one separately even then the system audio makes a massive buffer, the actual arguments are fine as well. I have also tried increasing the latency, that doesn't help either. I will probably have to ask in the PulseAudio community.
                – Vilsol
                Jul 5 '14 at 17:28











              Your Answer








              StackExchange.ready(function() {
              var channelOptions = {
              tags: "".split(" "),
              id: "89"
              };
              initTagRenderer("".split(" "), "".split(" "), channelOptions);

              StackExchange.using("externalEditor", function() {
              // Have to fire editor after snippets, if snippets enabled
              if (StackExchange.settings.snippets.snippetsEnabled) {
              StackExchange.using("snippets", function() {
              createEditor();
              });
              }
              else {
              createEditor();
              }
              });

              function createEditor() {
              StackExchange.prepareEditor({
              heartbeatType: 'answer',
              autoActivateHeartbeat: false,
              convertImagesToLinks: true,
              noModals: true,
              showLowRepImageUploadWarning: true,
              reputationToPostImages: 10,
              bindNavPrevention: true,
              postfix: "",
              imageUploader: {
              brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
              contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
              allowUrls: true
              },
              onDemand: true,
              discardSelector: ".discard-answer"
              ,immediatelyShowMarkdownHelp:true
              });


              }
              });














              draft saved

              draft discarded


















              StackExchange.ready(
              function () {
              StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f491825%2fpulseaudio-loopback-latency%23new-answer', 'question_page');
              }
              );

              Post as a guest















              Required, but never shown

























              3 Answers
              3






              active

              oldest

              votes








              3 Answers
              3






              active

              oldest

              votes









              active

              oldest

              votes






              active

              oldest

              votes









              2














              I have found a temporary way out, but this still confuses me. I have made a combined module, and after that I link every sound source I want to the combined one, which then routes to my system sounds and to the Streaming sink.



              STREAM_MODULE=$(pactl load-module module-null-sink sink_name=StreamAudio sink_properties=device.description="StreamAudio")
              COMBINE_MODULE=$(pactl load-module module-combine-sink sink_name=Combined sink_properties=device.description="Combined" slaves=StreamAudio,alsa_output.pci-0000_00_1b.0.analog-stereo)

              pactl load-module module-loopback rate=44000 adjust_time=0 source=alsa_input.usb-AKM_AK5370-00-AK5370.analog-mono sink=StreamAudio latency_msec=1 >> /dev/null

              pactl load-module module-device-manager >> /dev/null

              read -p "Loaded! Press enter to unload!"

              pactl unload-module $COMBINE_MODULE
              pactl unload-module $STREAM_MODULE
              pactl unload-module module-device-manager
              pactl unload-module module-loopback


              There is probably a way I can grep the results of pacmd list-clients and then clean out only valid sources, change their output to the combined sink, but that would take too long and complex to do.



              Though now a new problem arises, and I even tested it by running the command through terminal. For some reason I can't change the output sink of Java. Here is what I tried and what it returned:



              vilsol@skynet:~$ pacmd move-sink-input 6421 124
              Welcome to PulseAudio! Use "help" for usage information.
              >>> Moved failed.


              I tried with others as well and they all worked. 6421 is the Java index, and 124 is the sink index.






              share|improve this answer




























                2














                I have found a temporary way out, but this still confuses me. I have made a combined module, and after that I link every sound source I want to the combined one, which then routes to my system sounds and to the Streaming sink.



                STREAM_MODULE=$(pactl load-module module-null-sink sink_name=StreamAudio sink_properties=device.description="StreamAudio")
                COMBINE_MODULE=$(pactl load-module module-combine-sink sink_name=Combined sink_properties=device.description="Combined" slaves=StreamAudio,alsa_output.pci-0000_00_1b.0.analog-stereo)

                pactl load-module module-loopback rate=44000 adjust_time=0 source=alsa_input.usb-AKM_AK5370-00-AK5370.analog-mono sink=StreamAudio latency_msec=1 >> /dev/null

                pactl load-module module-device-manager >> /dev/null

                read -p "Loaded! Press enter to unload!"

                pactl unload-module $COMBINE_MODULE
                pactl unload-module $STREAM_MODULE
                pactl unload-module module-device-manager
                pactl unload-module module-loopback


                There is probably a way I can grep the results of pacmd list-clients and then clean out only valid sources, change their output to the combined sink, but that would take too long and complex to do.



                Though now a new problem arises, and I even tested it by running the command through terminal. For some reason I can't change the output sink of Java. Here is what I tried and what it returned:



                vilsol@skynet:~$ pacmd move-sink-input 6421 124
                Welcome to PulseAudio! Use "help" for usage information.
                >>> Moved failed.


                I tried with others as well and they all worked. 6421 is the Java index, and 124 is the sink index.






                share|improve this answer


























                  2












                  2








                  2






                  I have found a temporary way out, but this still confuses me. I have made a combined module, and after that I link every sound source I want to the combined one, which then routes to my system sounds and to the Streaming sink.



                  STREAM_MODULE=$(pactl load-module module-null-sink sink_name=StreamAudio sink_properties=device.description="StreamAudio")
                  COMBINE_MODULE=$(pactl load-module module-combine-sink sink_name=Combined sink_properties=device.description="Combined" slaves=StreamAudio,alsa_output.pci-0000_00_1b.0.analog-stereo)

                  pactl load-module module-loopback rate=44000 adjust_time=0 source=alsa_input.usb-AKM_AK5370-00-AK5370.analog-mono sink=StreamAudio latency_msec=1 >> /dev/null

                  pactl load-module module-device-manager >> /dev/null

                  read -p "Loaded! Press enter to unload!"

                  pactl unload-module $COMBINE_MODULE
                  pactl unload-module $STREAM_MODULE
                  pactl unload-module module-device-manager
                  pactl unload-module module-loopback


                  There is probably a way I can grep the results of pacmd list-clients and then clean out only valid sources, change their output to the combined sink, but that would take too long and complex to do.



                  Though now a new problem arises, and I even tested it by running the command through terminal. For some reason I can't change the output sink of Java. Here is what I tried and what it returned:



                  vilsol@skynet:~$ pacmd move-sink-input 6421 124
                  Welcome to PulseAudio! Use "help" for usage information.
                  >>> Moved failed.


                  I tried with others as well and they all worked. 6421 is the Java index, and 124 is the sink index.






                  share|improve this answer














                  I have found a temporary way out, but this still confuses me. I have made a combined module, and after that I link every sound source I want to the combined one, which then routes to my system sounds and to the Streaming sink.



                  STREAM_MODULE=$(pactl load-module module-null-sink sink_name=StreamAudio sink_properties=device.description="StreamAudio")
                  COMBINE_MODULE=$(pactl load-module module-combine-sink sink_name=Combined sink_properties=device.description="Combined" slaves=StreamAudio,alsa_output.pci-0000_00_1b.0.analog-stereo)

                  pactl load-module module-loopback rate=44000 adjust_time=0 source=alsa_input.usb-AKM_AK5370-00-AK5370.analog-mono sink=StreamAudio latency_msec=1 >> /dev/null

                  pactl load-module module-device-manager >> /dev/null

                  read -p "Loaded! Press enter to unload!"

                  pactl unload-module $COMBINE_MODULE
                  pactl unload-module $STREAM_MODULE
                  pactl unload-module module-device-manager
                  pactl unload-module module-loopback


                  There is probably a way I can grep the results of pacmd list-clients and then clean out only valid sources, change their output to the combined sink, but that would take too long and complex to do.



                  Though now a new problem arises, and I even tested it by running the command through terminal. For some reason I can't change the output sink of Java. Here is what I tried and what it returned:



                  vilsol@skynet:~$ pacmd move-sink-input 6421 124
                  Welcome to PulseAudio! Use "help" for usage information.
                  >>> Moved failed.


                  I tried with others as well and they all worked. 6421 is the Java index, and 124 is the sink index.







                  share|improve this answer














                  share|improve this answer



                  share|improve this answer








                  edited Jul 6 '14 at 17:58

























                  answered Jul 6 '14 at 17:38









                  Vilsol

                  75212




                  75212

























                      0














                      Bit late but for those who still need help:

                      Install the 'PulseAudio Loopback Device' GNOME Shell Extension (just search the bit in quotes in Ubuntu Software).



                      PA Loopback Device Extension Screenshot



                      It has hardly any noticable latency and was a perfect solution for me after quite a bit of searching!
                      Hope this is useful to somebody!






                      share|improve this answer




























                        0














                        Bit late but for those who still need help:

                        Install the 'PulseAudio Loopback Device' GNOME Shell Extension (just search the bit in quotes in Ubuntu Software).



                        PA Loopback Device Extension Screenshot



                        It has hardly any noticable latency and was a perfect solution for me after quite a bit of searching!
                        Hope this is useful to somebody!






                        share|improve this answer


























                          0












                          0








                          0






                          Bit late but for those who still need help:

                          Install the 'PulseAudio Loopback Device' GNOME Shell Extension (just search the bit in quotes in Ubuntu Software).



                          PA Loopback Device Extension Screenshot



                          It has hardly any noticable latency and was a perfect solution for me after quite a bit of searching!
                          Hope this is useful to somebody!






                          share|improve this answer














                          Bit late but for those who still need help:

                          Install the 'PulseAudio Loopback Device' GNOME Shell Extension (just search the bit in quotes in Ubuntu Software).



                          PA Loopback Device Extension Screenshot



                          It has hardly any noticable latency and was a perfect solution for me after quite a bit of searching!
                          Hope this is useful to somebody!







                          share|improve this answer














                          share|improve this answer



                          share|improve this answer








                          edited Dec 14 at 20:10









                          Kevin Bowen

                          14.2k145969




                          14.2k145969










                          answered Dec 14 at 19:09









                          Kiran

                          1




                          1























                              -1














                              Sometime ago I was able to loopback my guitar to the speakers without noticeable delay, so pulseaudio supports that, but I remember having trouble with delays less than 10ms. My suggestions are




                              1. to review the command parameters

                              2. use a bigger delay

                              3. test each loopback separately and

                              4. ask directly pulseaudio developers for instructions.






                              share|improve this answer























                              • I have already tried testing each one separately even then the system audio makes a massive buffer, the actual arguments are fine as well. I have also tried increasing the latency, that doesn't help either. I will probably have to ask in the PulseAudio community.
                                – Vilsol
                                Jul 5 '14 at 17:28
















                              -1














                              Sometime ago I was able to loopback my guitar to the speakers without noticeable delay, so pulseaudio supports that, but I remember having trouble with delays less than 10ms. My suggestions are




                              1. to review the command parameters

                              2. use a bigger delay

                              3. test each loopback separately and

                              4. ask directly pulseaudio developers for instructions.






                              share|improve this answer























                              • I have already tried testing each one separately even then the system audio makes a massive buffer, the actual arguments are fine as well. I have also tried increasing the latency, that doesn't help either. I will probably have to ask in the PulseAudio community.
                                – Vilsol
                                Jul 5 '14 at 17:28














                              -1












                              -1








                              -1






                              Sometime ago I was able to loopback my guitar to the speakers without noticeable delay, so pulseaudio supports that, but I remember having trouble with delays less than 10ms. My suggestions are




                              1. to review the command parameters

                              2. use a bigger delay

                              3. test each loopback separately and

                              4. ask directly pulseaudio developers for instructions.






                              share|improve this answer














                              Sometime ago I was able to loopback my guitar to the speakers without noticeable delay, so pulseaudio supports that, but I remember having trouble with delays less than 10ms. My suggestions are




                              1. to review the command parameters

                              2. use a bigger delay

                              3. test each loopback separately and

                              4. ask directly pulseaudio developers for instructions.







                              share|improve this answer














                              share|improve this answer



                              share|improve this answer








                              edited Jul 5 '14 at 18:01









                              guntbert

                              9,078133169




                              9,078133169










                              answered Jul 5 '14 at 16:16









                              Henrique

                              1




                              1












                              • I have already tried testing each one separately even then the system audio makes a massive buffer, the actual arguments are fine as well. I have also tried increasing the latency, that doesn't help either. I will probably have to ask in the PulseAudio community.
                                – Vilsol
                                Jul 5 '14 at 17:28


















                              • I have already tried testing each one separately even then the system audio makes a massive buffer, the actual arguments are fine as well. I have also tried increasing the latency, that doesn't help either. I will probably have to ask in the PulseAudio community.
                                – Vilsol
                                Jul 5 '14 at 17:28
















                              I have already tried testing each one separately even then the system audio makes a massive buffer, the actual arguments are fine as well. I have also tried increasing the latency, that doesn't help either. I will probably have to ask in the PulseAudio community.
                              – Vilsol
                              Jul 5 '14 at 17:28




                              I have already tried testing each one separately even then the system audio makes a massive buffer, the actual arguments are fine as well. I have also tried increasing the latency, that doesn't help either. I will probably have to ask in the PulseAudio community.
                              – Vilsol
                              Jul 5 '14 at 17:28


















                              draft saved

                              draft discarded




















































                              Thanks for contributing an answer to Ask Ubuntu!


                              • Please be sure to answer the question. Provide details and share your research!

                              But avoid



                              • Asking for help, clarification, or responding to other answers.

                              • Making statements based on opinion; back them up with references or personal experience.


                              To learn more, see our tips on writing great answers.





                              Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


                              Please pay close attention to the following guidance:


                              • Please be sure to answer the question. Provide details and share your research!

                              But avoid



                              • Asking for help, clarification, or responding to other answers.

                              • Making statements based on opinion; back them up with references or personal experience.


                              To learn more, see our tips on writing great answers.




                              draft saved


                              draft discarded














                              StackExchange.ready(
                              function () {
                              StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f491825%2fpulseaudio-loopback-latency%23new-answer', 'question_page');
                              }
                              );

                              Post as a guest















                              Required, but never shown





















































                              Required, but never shown














                              Required, but never shown












                              Required, but never shown







                              Required, but never shown

































                              Required, but never shown














                              Required, but never shown












                              Required, but never shown







                              Required, but never shown







                              Popular posts from this blog

                              flock() on closed filehandle LOCK_FILE at /usr/bin/apt-mirror

                              Mangá

                               ⁒  ․,‪⁊‑⁙ ⁖, ⁇‒※‌, †,⁖‗‌⁝    ‾‸⁘,‖⁔⁣,⁂‾
”‑,‥–,‬ ,⁀‹⁋‴⁑ ‒ ,‴⁋”‼ ⁨,‷⁔„ ‰′,‐‚ ‥‡‎“‷⁃⁨⁅⁣,⁔
⁇‘⁔⁡⁏⁌⁡‿‶‏⁨ ⁣⁕⁖⁨⁩⁥‽⁀  ‴‬⁜‟ ⁃‣‧⁕‮ …‍⁨‴ ⁩,⁚⁖‫ ,‵ ⁀,‮⁝‣‣ ⁑  ⁂– ․, ‾‽ ‏⁁“⁗‸ ‾… ‹‡⁌⁎‸‘ ‡⁏⁌‪ ‵⁛ ‎⁨ ―⁦⁤⁄⁕