Pulse Audio Virtual Sinks Changing on Alsa Underrun

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP











up vote
0
down vote

favorite












I'm experiencing an issue that when ALSA gives an XRUN underrun, the pulseaudio virtual sinks for the output that i've set start changing. Description below:



I've created three virtual sinks using the following commands (from Virtual0 to Virtual2)



pacmd load-module module-null-sink sink_name=Virtual0
pacmd update-sink-proplist Virtual0 device.description=Virtual0
pacmd update-source-proplist Virtual0.monitor device.description=Virtual0


I'm then running some DSP commands which output into three aplay commands (aplay -v -r 48000 -f S16_LE). Then in pavucontrol I set each of those to a seperate virtual sink (Virtual0 - Virtual2), which I then use to pipe to another DSP program.



The problem is that whenever ALSA underruns due to high CPU usage, the source entry in pavucontrol will briefly dissappear, then come back a second or two later with the virtual sink changed to the last one that i've set in the pavucontrol GUI (usually Virtual2). So after a few underruns on each alsa instance all sources end up outputting to the Virtual2 sink.



I don't mind ALSA underruning every now and then (underruns only occur rarely when the CPU fully maxes out - this is a Raspberry Pi), but I just want the sources to restore to the same sink.



I think the problem is that each aplay source has the same name. So when one briefly disappears due to an underrun it goes to the last set sink for that name, which happens to be the last one set in the GUI.



Is there anything I can do to stop the source entry briefly dissappearing on an underrun? Or change the aplay source name to something unique?



Just a note: Interestingly, i've also tried outputting with mplayer, and this never glitches the source in pavucontrol, but unforuntately mplayer introduces an unacceptable latency on the audio (even with caching disabled), so it can't be used. aplay and play (from sox) both have the issue.



Before Underruns
Before Underruns



After Underruns
After Underruns







share|improve this question

























    up vote
    0
    down vote

    favorite












    I'm experiencing an issue that when ALSA gives an XRUN underrun, the pulseaudio virtual sinks for the output that i've set start changing. Description below:



    I've created three virtual sinks using the following commands (from Virtual0 to Virtual2)



    pacmd load-module module-null-sink sink_name=Virtual0
    pacmd update-sink-proplist Virtual0 device.description=Virtual0
    pacmd update-source-proplist Virtual0.monitor device.description=Virtual0


    I'm then running some DSP commands which output into three aplay commands (aplay -v -r 48000 -f S16_LE). Then in pavucontrol I set each of those to a seperate virtual sink (Virtual0 - Virtual2), which I then use to pipe to another DSP program.



    The problem is that whenever ALSA underruns due to high CPU usage, the source entry in pavucontrol will briefly dissappear, then come back a second or two later with the virtual sink changed to the last one that i've set in the pavucontrol GUI (usually Virtual2). So after a few underruns on each alsa instance all sources end up outputting to the Virtual2 sink.



    I don't mind ALSA underruning every now and then (underruns only occur rarely when the CPU fully maxes out - this is a Raspberry Pi), but I just want the sources to restore to the same sink.



    I think the problem is that each aplay source has the same name. So when one briefly disappears due to an underrun it goes to the last set sink for that name, which happens to be the last one set in the GUI.



    Is there anything I can do to stop the source entry briefly dissappearing on an underrun? Or change the aplay source name to something unique?



    Just a note: Interestingly, i've also tried outputting with mplayer, and this never glitches the source in pavucontrol, but unforuntately mplayer introduces an unacceptable latency on the audio (even with caching disabled), so it can't be used. aplay and play (from sox) both have the issue.



    Before Underruns
    Before Underruns



    After Underruns
    After Underruns







    share|improve this question























      up vote
      0
      down vote

      favorite









      up vote
      0
      down vote

      favorite











      I'm experiencing an issue that when ALSA gives an XRUN underrun, the pulseaudio virtual sinks for the output that i've set start changing. Description below:



      I've created three virtual sinks using the following commands (from Virtual0 to Virtual2)



      pacmd load-module module-null-sink sink_name=Virtual0
      pacmd update-sink-proplist Virtual0 device.description=Virtual0
      pacmd update-source-proplist Virtual0.monitor device.description=Virtual0


      I'm then running some DSP commands which output into three aplay commands (aplay -v -r 48000 -f S16_LE). Then in pavucontrol I set each of those to a seperate virtual sink (Virtual0 - Virtual2), which I then use to pipe to another DSP program.



      The problem is that whenever ALSA underruns due to high CPU usage, the source entry in pavucontrol will briefly dissappear, then come back a second or two later with the virtual sink changed to the last one that i've set in the pavucontrol GUI (usually Virtual2). So after a few underruns on each alsa instance all sources end up outputting to the Virtual2 sink.



      I don't mind ALSA underruning every now and then (underruns only occur rarely when the CPU fully maxes out - this is a Raspberry Pi), but I just want the sources to restore to the same sink.



      I think the problem is that each aplay source has the same name. So when one briefly disappears due to an underrun it goes to the last set sink for that name, which happens to be the last one set in the GUI.



      Is there anything I can do to stop the source entry briefly dissappearing on an underrun? Or change the aplay source name to something unique?



      Just a note: Interestingly, i've also tried outputting with mplayer, and this never glitches the source in pavucontrol, but unforuntately mplayer introduces an unacceptable latency on the audio (even with caching disabled), so it can't be used. aplay and play (from sox) both have the issue.



      Before Underruns
      Before Underruns



      After Underruns
      After Underruns







      share|improve this question













      I'm experiencing an issue that when ALSA gives an XRUN underrun, the pulseaudio virtual sinks for the output that i've set start changing. Description below:



      I've created three virtual sinks using the following commands (from Virtual0 to Virtual2)



      pacmd load-module module-null-sink sink_name=Virtual0
      pacmd update-sink-proplist Virtual0 device.description=Virtual0
      pacmd update-source-proplist Virtual0.monitor device.description=Virtual0


      I'm then running some DSP commands which output into three aplay commands (aplay -v -r 48000 -f S16_LE). Then in pavucontrol I set each of those to a seperate virtual sink (Virtual0 - Virtual2), which I then use to pipe to another DSP program.



      The problem is that whenever ALSA underruns due to high CPU usage, the source entry in pavucontrol will briefly dissappear, then come back a second or two later with the virtual sink changed to the last one that i've set in the pavucontrol GUI (usually Virtual2). So after a few underruns on each alsa instance all sources end up outputting to the Virtual2 sink.



      I don't mind ALSA underruning every now and then (underruns only occur rarely when the CPU fully maxes out - this is a Raspberry Pi), but I just want the sources to restore to the same sink.



      I think the problem is that each aplay source has the same name. So when one briefly disappears due to an underrun it goes to the last set sink for that name, which happens to be the last one set in the GUI.



      Is there anything I can do to stop the source entry briefly dissappearing on an underrun? Or change the aplay source name to something unique?



      Just a note: Interestingly, i've also tried outputting with mplayer, and this never glitches the source in pavucontrol, but unforuntately mplayer introduces an unacceptable latency on the audio (even with caching disabled), so it can't be used. aplay and play (from sox) both have the issue.



      Before Underruns
      Before Underruns



      After Underruns
      After Underruns









      share|improve this question












      share|improve this question




      share|improve this question








      edited Jun 13 at 23:41
























      asked Jun 13 at 23:33









      Projectile Fish

      1235




      1235




















          1 Answer
          1






          active

          oldest

          votes

















          up vote
          0
          down vote



          accepted










          If anyone comes across a similar issue, I eventually found the solution. You need to create some virtual cards that have the device set in asound.conf, then output the audio to those cards.



          sudo nano /etc/asound.conf


          Paste into asound.conf.



          pcm.VirtualCard0 
          type pulse
          device Virtual0


          ctl.VirtualCard0
          type pulse
          device Virtual0


          pcm.VirtualCard1
          type pulse
          device Virtual1


          ctl.VirtualCard1
          type pulse
          device Virtual1


          pcm.VirtualCard2
          type pulse
          device Virtual2


          ctl.VirtualCard2
          type pulse
          device Virtual2



          Then run the output with



          aplay -v -r 48000 -f S16_LE -DVirtualCard0
          aplay -v -r 48000 -f S16_LE -DVirtualCard1
          aplay -v -r 48000 -f S16_LE -DVirtualCard2


          Now whenever the device 'dissappears' briefly from pulseaudio on an underrun, it will at least come back to the correct sink.



          Make sure you create the Virtual sinks first like I described in the OP.






          share|improve this answer





















            Your Answer







            StackExchange.ready(function()
            var channelOptions =
            tags: "".split(" "),
            id: "106"
            ;
            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',
            convertImagesToLinks: false,
            noModals: false,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: null,
            bindNavPrevention: true,
            postfix: "",
            onDemand: true,
            discardSelector: ".discard-answer"
            ,immediatelyShowMarkdownHelp:true
            );



            );








             

            draft saved


            draft discarded


















            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f449690%2fpulse-audio-virtual-sinks-changing-on-alsa-underrun%23new-answer', 'question_page');

            );

            Post as a guest






























            1 Answer
            1






            active

            oldest

            votes








            1 Answer
            1






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes








            up vote
            0
            down vote



            accepted










            If anyone comes across a similar issue, I eventually found the solution. You need to create some virtual cards that have the device set in asound.conf, then output the audio to those cards.



            sudo nano /etc/asound.conf


            Paste into asound.conf.



            pcm.VirtualCard0 
            type pulse
            device Virtual0


            ctl.VirtualCard0
            type pulse
            device Virtual0


            pcm.VirtualCard1
            type pulse
            device Virtual1


            ctl.VirtualCard1
            type pulse
            device Virtual1


            pcm.VirtualCard2
            type pulse
            device Virtual2


            ctl.VirtualCard2
            type pulse
            device Virtual2



            Then run the output with



            aplay -v -r 48000 -f S16_LE -DVirtualCard0
            aplay -v -r 48000 -f S16_LE -DVirtualCard1
            aplay -v -r 48000 -f S16_LE -DVirtualCard2


            Now whenever the device 'dissappears' briefly from pulseaudio on an underrun, it will at least come back to the correct sink.



            Make sure you create the Virtual sinks first like I described in the OP.






            share|improve this answer

























              up vote
              0
              down vote



              accepted










              If anyone comes across a similar issue, I eventually found the solution. You need to create some virtual cards that have the device set in asound.conf, then output the audio to those cards.



              sudo nano /etc/asound.conf


              Paste into asound.conf.



              pcm.VirtualCard0 
              type pulse
              device Virtual0


              ctl.VirtualCard0
              type pulse
              device Virtual0


              pcm.VirtualCard1
              type pulse
              device Virtual1


              ctl.VirtualCard1
              type pulse
              device Virtual1


              pcm.VirtualCard2
              type pulse
              device Virtual2


              ctl.VirtualCard2
              type pulse
              device Virtual2



              Then run the output with



              aplay -v -r 48000 -f S16_LE -DVirtualCard0
              aplay -v -r 48000 -f S16_LE -DVirtualCard1
              aplay -v -r 48000 -f S16_LE -DVirtualCard2


              Now whenever the device 'dissappears' briefly from pulseaudio on an underrun, it will at least come back to the correct sink.



              Make sure you create the Virtual sinks first like I described in the OP.






              share|improve this answer























                up vote
                0
                down vote



                accepted







                up vote
                0
                down vote



                accepted






                If anyone comes across a similar issue, I eventually found the solution. You need to create some virtual cards that have the device set in asound.conf, then output the audio to those cards.



                sudo nano /etc/asound.conf


                Paste into asound.conf.



                pcm.VirtualCard0 
                type pulse
                device Virtual0


                ctl.VirtualCard0
                type pulse
                device Virtual0


                pcm.VirtualCard1
                type pulse
                device Virtual1


                ctl.VirtualCard1
                type pulse
                device Virtual1


                pcm.VirtualCard2
                type pulse
                device Virtual2


                ctl.VirtualCard2
                type pulse
                device Virtual2



                Then run the output with



                aplay -v -r 48000 -f S16_LE -DVirtualCard0
                aplay -v -r 48000 -f S16_LE -DVirtualCard1
                aplay -v -r 48000 -f S16_LE -DVirtualCard2


                Now whenever the device 'dissappears' briefly from pulseaudio on an underrun, it will at least come back to the correct sink.



                Make sure you create the Virtual sinks first like I described in the OP.






                share|improve this answer













                If anyone comes across a similar issue, I eventually found the solution. You need to create some virtual cards that have the device set in asound.conf, then output the audio to those cards.



                sudo nano /etc/asound.conf


                Paste into asound.conf.



                pcm.VirtualCard0 
                type pulse
                device Virtual0


                ctl.VirtualCard0
                type pulse
                device Virtual0


                pcm.VirtualCard1
                type pulse
                device Virtual1


                ctl.VirtualCard1
                type pulse
                device Virtual1


                pcm.VirtualCard2
                type pulse
                device Virtual2


                ctl.VirtualCard2
                type pulse
                device Virtual2



                Then run the output with



                aplay -v -r 48000 -f S16_LE -DVirtualCard0
                aplay -v -r 48000 -f S16_LE -DVirtualCard1
                aplay -v -r 48000 -f S16_LE -DVirtualCard2


                Now whenever the device 'dissappears' briefly from pulseaudio on an underrun, it will at least come back to the correct sink.



                Make sure you create the Virtual sinks first like I described in the OP.







                share|improve this answer













                share|improve this answer



                share|improve this answer











                answered Jun 16 at 5:28









                Projectile Fish

                1235




                1235






















                     

                    draft saved


                    draft discarded


























                     


                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function ()
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f449690%2fpulse-audio-virtual-sinks-changing-on-alsa-underrun%23new-answer', 'question_page');

                    );

                    Post as a guest













































































                    Popular posts from this blog

                    How to check contact read email or not when send email to Individual?

                    Displaying single band from multi-band raster using QGIS

                    How many registers does an x86_64 CPU actually have?