redirect sound (microphone) via ssh, how to telephone via ssh?

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











up vote
45
down vote

favorite
35












How can I redirect the microphone of one computer to listen to it on another computer via ssh? Which is the right device or which is the right command line?



Some years ago it was easy and fun to redirect sound from a remote microphone to a local computer or vice versa – it was an easy telephone. There are some instructions for it, but none of them seem to work on newer computers/linux distros. I don’t even have a /dev/audio on my computer (Fedora 17).



I think that it may have something to do with pulse audio. Or don’t I need pulse audio for this simple telephone? Which is the right device?



I can see all my sound devices when I start alsamixer and press the F6 key. But I don’t know which are the devices in my /dev tree.










share|improve this question



























    up vote
    45
    down vote

    favorite
    35












    How can I redirect the microphone of one computer to listen to it on another computer via ssh? Which is the right device or which is the right command line?



    Some years ago it was easy and fun to redirect sound from a remote microphone to a local computer or vice versa – it was an easy telephone. There are some instructions for it, but none of them seem to work on newer computers/linux distros. I don’t even have a /dev/audio on my computer (Fedora 17).



    I think that it may have something to do with pulse audio. Or don’t I need pulse audio for this simple telephone? Which is the right device?



    I can see all my sound devices when I start alsamixer and press the F6 key. But I don’t know which are the devices in my /dev tree.










    share|improve this question

























      up vote
      45
      down vote

      favorite
      35









      up vote
      45
      down vote

      favorite
      35






      35





      How can I redirect the microphone of one computer to listen to it on another computer via ssh? Which is the right device or which is the right command line?



      Some years ago it was easy and fun to redirect sound from a remote microphone to a local computer or vice versa – it was an easy telephone. There are some instructions for it, but none of them seem to work on newer computers/linux distros. I don’t even have a /dev/audio on my computer (Fedora 17).



      I think that it may have something to do with pulse audio. Or don’t I need pulse audio for this simple telephone? Which is the right device?



      I can see all my sound devices when I start alsamixer and press the F6 key. But I don’t know which are the devices in my /dev tree.










      share|improve this question















      How can I redirect the microphone of one computer to listen to it on another computer via ssh? Which is the right device or which is the right command line?



      Some years ago it was easy and fun to redirect sound from a remote microphone to a local computer or vice versa – it was an easy telephone. There are some instructions for it, but none of them seem to work on newer computers/linux distros. I don’t even have a /dev/audio on my computer (Fedora 17).



      I think that it may have something to do with pulse audio. Or don’t I need pulse audio for this simple telephone? Which is the right device?



      I can see all my sound devices when I start alsamixer and press the F6 key. But I don’t know which are the devices in my /dev tree.







      ssh audio remote telephony






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Apr 12 '14 at 23:54









      Gilles

      520k12510381569




      520k12510381569










      asked Feb 25 '14 at 20:05









      erik

      9,15742034




      9,15742034




















          2 Answers
          2






          active

          oldest

          votes

















          up vote
          52
          down vote



          accepted










          OK, I've just found it, and it still works! Really funny. You don’t need any fancy applications, instant messengers or the like. With this command you send your audio to the remote host.



          arecord -f cd -t raw | oggenc - -r | ssh <user>@<remotehost> mplayer -


          Or if you like ffmpeg better



          ffmpeg -f alsa -ac 1 -i hw:3 -f ogg - 
          | ssh <user>@<remotehost> mplayer - -idle -demuxer ogg


          Source: http://shmerl.blogspot.de/2011/06/some-fun-with-audio-forwarding.html




          If you want a real telephone:



          The command above was only for one direction. For the other direction you have to start another ssh session. So, to receive what the other user says to you, use



          ssh <user>@<remotehost> 'arecord -f cd -t raw | oggenc - -r' | mplayer -


          Or if you like ffmpeg better



          ssh <user>@<remotehost> ffmpeg -f alsa -ac 1 -i hw:3 -f ogg - 
          | mplayer - -idle -demuxer ogg


          where hw:3 is the alsadevice you want to record (find it with arecord -l; you can also use a device name, find this with arecord -L; in many cases you can just use the device listed with the following command: arecord -L | grep sysdefault).



          Update



          In 2018 on my Fedora Linux systems ffmpeg does not have alsa support included (it seems to be the same on RaspberryPi systems with Raspbian). But there is a simple solution without recompiling. Just pipe the output of arecord (the alsarecorder) to ffmpeg:



          ssh <user>@<remotehost> 'arecord -f cd -D plughw:2 | ffmpeg -ac 1 -i - -f ogg -' 
          | mplayer - -idle -demuxer ogg


          You get the input device plughw:2 by finding your device in the output of the following command:



          arecord -l


          In my case I see card0 and card2 (my webcam which has a microphone). So I wrote plughw:2 for card2.



          Update 2 (without mplayer)



          If you don’t have or like mplayer but ffplay (which is part of ffmpeg) you can use:




          • uncompressed wave-audio (high bandwidth, very low cpu usage on the recording side)



            ssh <user>@<remotehost> "arecord -f cd -D plughw:2" | ffplay -nodisp -



          • compressed with flac (low bandwidth, low cpu usage on the recording side)



            ssh <user>@<remotehost> "arecord -f cd -D plughw:2 | flac - -o -" | ffplay -nodisp -



          • compressed with ogg (very low bandwidth, high cpu usage on the recording side)



            ssh <user>@<remotehost> "arecord -f cd -D plughw:2 | oggenc -" | ffplay -nodisp -






          share|improve this answer


















          • 1




            Is there some reason you are doing cat - | mplayer - instead of just mplayer -?
            – Chris Down
            Feb 28 '14 at 7:29










          • The reason is: I just copied the command from the cited source. Might be redundant. I have deleted it, seems to still work. Maybe there is an edge case where it was needed and the author knew about it without telling it in his post?
            – erik
            Feb 28 '14 at 19:46

















          up vote
          2
          down vote













          Erik's answer works well, but using it how it is, using flac or oggenc, there's significant lag.

          A solution is to add -cache 256 to the mplayer command, so it would look as follows:



          ssh <user>@<remotehost> "arecord -f cd -D plughw:2 | oggenc -" | mplayer -cache 256 -


          Another thing to mention is that nowadays pretty much every modern distribution uses PulseAudio, which takes control over the hardware device, therefore using plughw:2 will fail if PulseAudio is running.

          Generally, default should work fine and use PulseAudio, where you can use pavucontrol or similar to select your desired input source using PulseAudio.



          That would make the command as follows:



          ssh <user>@<remotehost> "arecord -f cd | oggenc -" | mplayer -cache 256 -


          BUT: This introduces a lag. In my case, it is around eight seconds. That's terrible.




          The solution is much simpler than any other command:



          ssh <user>@<host> "arecord -f S16_LE -r 36000" | aplay


          That's it. This is using barely any CPU (0.1% according to htop). It's using ~60KB/s of bandwidth for me.



          If you want stereo sound: ssh <user>@<host> "arecord -f cd" | aplay

          Only useful if you have a stereo microphone, increases bandwidth to ~150KB/s for me. (Since it also raises the sampling rate to 44100Hz).



          More information on sampling rate (-r) and bit rate (affected by -f) can be found here.

          Basically: The lower you go, the worse the quality but the lower the bandwidth needed.



          This solution is fully compatible with PulseAudio, you can control output device, volume and more using pactl or the pavucontrol GUI application:



          pavucontrol






          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: true,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: null,
            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%2funix.stackexchange.com%2fquestions%2f116919%2fredirect-sound-microphone-via-ssh-how-to-telephone-via-ssh%23new-answer', 'question_page');

            );

            Post as a guest















            Required, but never shown

























            2 Answers
            2






            active

            oldest

            votes








            2 Answers
            2






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes








            up vote
            52
            down vote



            accepted










            OK, I've just found it, and it still works! Really funny. You don’t need any fancy applications, instant messengers or the like. With this command you send your audio to the remote host.



            arecord -f cd -t raw | oggenc - -r | ssh <user>@<remotehost> mplayer -


            Or if you like ffmpeg better



            ffmpeg -f alsa -ac 1 -i hw:3 -f ogg - 
            | ssh <user>@<remotehost> mplayer - -idle -demuxer ogg


            Source: http://shmerl.blogspot.de/2011/06/some-fun-with-audio-forwarding.html




            If you want a real telephone:



            The command above was only for one direction. For the other direction you have to start another ssh session. So, to receive what the other user says to you, use



            ssh <user>@<remotehost> 'arecord -f cd -t raw | oggenc - -r' | mplayer -


            Or if you like ffmpeg better



            ssh <user>@<remotehost> ffmpeg -f alsa -ac 1 -i hw:3 -f ogg - 
            | mplayer - -idle -demuxer ogg


            where hw:3 is the alsadevice you want to record (find it with arecord -l; you can also use a device name, find this with arecord -L; in many cases you can just use the device listed with the following command: arecord -L | grep sysdefault).



            Update



            In 2018 on my Fedora Linux systems ffmpeg does not have alsa support included (it seems to be the same on RaspberryPi systems with Raspbian). But there is a simple solution without recompiling. Just pipe the output of arecord (the alsarecorder) to ffmpeg:



            ssh <user>@<remotehost> 'arecord -f cd -D plughw:2 | ffmpeg -ac 1 -i - -f ogg -' 
            | mplayer - -idle -demuxer ogg


            You get the input device plughw:2 by finding your device in the output of the following command:



            arecord -l


            In my case I see card0 and card2 (my webcam which has a microphone). So I wrote plughw:2 for card2.



            Update 2 (without mplayer)



            If you don’t have or like mplayer but ffplay (which is part of ffmpeg) you can use:




            • uncompressed wave-audio (high bandwidth, very low cpu usage on the recording side)



              ssh <user>@<remotehost> "arecord -f cd -D plughw:2" | ffplay -nodisp -



            • compressed with flac (low bandwidth, low cpu usage on the recording side)



              ssh <user>@<remotehost> "arecord -f cd -D plughw:2 | flac - -o -" | ffplay -nodisp -



            • compressed with ogg (very low bandwidth, high cpu usage on the recording side)



              ssh <user>@<remotehost> "arecord -f cd -D plughw:2 | oggenc -" | ffplay -nodisp -






            share|improve this answer


















            • 1




              Is there some reason you are doing cat - | mplayer - instead of just mplayer -?
              – Chris Down
              Feb 28 '14 at 7:29










            • The reason is: I just copied the command from the cited source. Might be redundant. I have deleted it, seems to still work. Maybe there is an edge case where it was needed and the author knew about it without telling it in his post?
              – erik
              Feb 28 '14 at 19:46














            up vote
            52
            down vote



            accepted










            OK, I've just found it, and it still works! Really funny. You don’t need any fancy applications, instant messengers or the like. With this command you send your audio to the remote host.



            arecord -f cd -t raw | oggenc - -r | ssh <user>@<remotehost> mplayer -


            Or if you like ffmpeg better



            ffmpeg -f alsa -ac 1 -i hw:3 -f ogg - 
            | ssh <user>@<remotehost> mplayer - -idle -demuxer ogg


            Source: http://shmerl.blogspot.de/2011/06/some-fun-with-audio-forwarding.html




            If you want a real telephone:



            The command above was only for one direction. For the other direction you have to start another ssh session. So, to receive what the other user says to you, use



            ssh <user>@<remotehost> 'arecord -f cd -t raw | oggenc - -r' | mplayer -


            Or if you like ffmpeg better



            ssh <user>@<remotehost> ffmpeg -f alsa -ac 1 -i hw:3 -f ogg - 
            | mplayer - -idle -demuxer ogg


            where hw:3 is the alsadevice you want to record (find it with arecord -l; you can also use a device name, find this with arecord -L; in many cases you can just use the device listed with the following command: arecord -L | grep sysdefault).



            Update



            In 2018 on my Fedora Linux systems ffmpeg does not have alsa support included (it seems to be the same on RaspberryPi systems with Raspbian). But there is a simple solution without recompiling. Just pipe the output of arecord (the alsarecorder) to ffmpeg:



            ssh <user>@<remotehost> 'arecord -f cd -D plughw:2 | ffmpeg -ac 1 -i - -f ogg -' 
            | mplayer - -idle -demuxer ogg


            You get the input device plughw:2 by finding your device in the output of the following command:



            arecord -l


            In my case I see card0 and card2 (my webcam which has a microphone). So I wrote plughw:2 for card2.



            Update 2 (without mplayer)



            If you don’t have or like mplayer but ffplay (which is part of ffmpeg) you can use:




            • uncompressed wave-audio (high bandwidth, very low cpu usage on the recording side)



              ssh <user>@<remotehost> "arecord -f cd -D plughw:2" | ffplay -nodisp -



            • compressed with flac (low bandwidth, low cpu usage on the recording side)



              ssh <user>@<remotehost> "arecord -f cd -D plughw:2 | flac - -o -" | ffplay -nodisp -



            • compressed with ogg (very low bandwidth, high cpu usage on the recording side)



              ssh <user>@<remotehost> "arecord -f cd -D plughw:2 | oggenc -" | ffplay -nodisp -






            share|improve this answer


















            • 1




              Is there some reason you are doing cat - | mplayer - instead of just mplayer -?
              – Chris Down
              Feb 28 '14 at 7:29










            • The reason is: I just copied the command from the cited source. Might be redundant. I have deleted it, seems to still work. Maybe there is an edge case where it was needed and the author knew about it without telling it in his post?
              – erik
              Feb 28 '14 at 19:46












            up vote
            52
            down vote



            accepted







            up vote
            52
            down vote



            accepted






            OK, I've just found it, and it still works! Really funny. You don’t need any fancy applications, instant messengers or the like. With this command you send your audio to the remote host.



            arecord -f cd -t raw | oggenc - -r | ssh <user>@<remotehost> mplayer -


            Or if you like ffmpeg better



            ffmpeg -f alsa -ac 1 -i hw:3 -f ogg - 
            | ssh <user>@<remotehost> mplayer - -idle -demuxer ogg


            Source: http://shmerl.blogspot.de/2011/06/some-fun-with-audio-forwarding.html




            If you want a real telephone:



            The command above was only for one direction. For the other direction you have to start another ssh session. So, to receive what the other user says to you, use



            ssh <user>@<remotehost> 'arecord -f cd -t raw | oggenc - -r' | mplayer -


            Or if you like ffmpeg better



            ssh <user>@<remotehost> ffmpeg -f alsa -ac 1 -i hw:3 -f ogg - 
            | mplayer - -idle -demuxer ogg


            where hw:3 is the alsadevice you want to record (find it with arecord -l; you can also use a device name, find this with arecord -L; in many cases you can just use the device listed with the following command: arecord -L | grep sysdefault).



            Update



            In 2018 on my Fedora Linux systems ffmpeg does not have alsa support included (it seems to be the same on RaspberryPi systems with Raspbian). But there is a simple solution without recompiling. Just pipe the output of arecord (the alsarecorder) to ffmpeg:



            ssh <user>@<remotehost> 'arecord -f cd -D plughw:2 | ffmpeg -ac 1 -i - -f ogg -' 
            | mplayer - -idle -demuxer ogg


            You get the input device plughw:2 by finding your device in the output of the following command:



            arecord -l


            In my case I see card0 and card2 (my webcam which has a microphone). So I wrote plughw:2 for card2.



            Update 2 (without mplayer)



            If you don’t have or like mplayer but ffplay (which is part of ffmpeg) you can use:




            • uncompressed wave-audio (high bandwidth, very low cpu usage on the recording side)



              ssh <user>@<remotehost> "arecord -f cd -D plughw:2" | ffplay -nodisp -



            • compressed with flac (low bandwidth, low cpu usage on the recording side)



              ssh <user>@<remotehost> "arecord -f cd -D plughw:2 | flac - -o -" | ffplay -nodisp -



            • compressed with ogg (very low bandwidth, high cpu usage on the recording side)



              ssh <user>@<remotehost> "arecord -f cd -D plughw:2 | oggenc -" | ffplay -nodisp -






            share|improve this answer














            OK, I've just found it, and it still works! Really funny. You don’t need any fancy applications, instant messengers or the like. With this command you send your audio to the remote host.



            arecord -f cd -t raw | oggenc - -r | ssh <user>@<remotehost> mplayer -


            Or if you like ffmpeg better



            ffmpeg -f alsa -ac 1 -i hw:3 -f ogg - 
            | ssh <user>@<remotehost> mplayer - -idle -demuxer ogg


            Source: http://shmerl.blogspot.de/2011/06/some-fun-with-audio-forwarding.html




            If you want a real telephone:



            The command above was only for one direction. For the other direction you have to start another ssh session. So, to receive what the other user says to you, use



            ssh <user>@<remotehost> 'arecord -f cd -t raw | oggenc - -r' | mplayer -


            Or if you like ffmpeg better



            ssh <user>@<remotehost> ffmpeg -f alsa -ac 1 -i hw:3 -f ogg - 
            | mplayer - -idle -demuxer ogg


            where hw:3 is the alsadevice you want to record (find it with arecord -l; you can also use a device name, find this with arecord -L; in many cases you can just use the device listed with the following command: arecord -L | grep sysdefault).



            Update



            In 2018 on my Fedora Linux systems ffmpeg does not have alsa support included (it seems to be the same on RaspberryPi systems with Raspbian). But there is a simple solution without recompiling. Just pipe the output of arecord (the alsarecorder) to ffmpeg:



            ssh <user>@<remotehost> 'arecord -f cd -D plughw:2 | ffmpeg -ac 1 -i - -f ogg -' 
            | mplayer - -idle -demuxer ogg


            You get the input device plughw:2 by finding your device in the output of the following command:



            arecord -l


            In my case I see card0 and card2 (my webcam which has a microphone). So I wrote plughw:2 for card2.



            Update 2 (without mplayer)



            If you don’t have or like mplayer but ffplay (which is part of ffmpeg) you can use:




            • uncompressed wave-audio (high bandwidth, very low cpu usage on the recording side)



              ssh <user>@<remotehost> "arecord -f cd -D plughw:2" | ffplay -nodisp -



            • compressed with flac (low bandwidth, low cpu usage on the recording side)



              ssh <user>@<remotehost> "arecord -f cd -D plughw:2 | flac - -o -" | ffplay -nodisp -



            • compressed with ogg (very low bandwidth, high cpu usage on the recording side)



              ssh <user>@<remotehost> "arecord -f cd -D plughw:2 | oggenc -" | ffplay -nodisp -







            share|improve this answer














            share|improve this answer



            share|improve this answer








            edited Mar 20 at 0:35

























            answered Feb 25 '14 at 20:16









            erik

            9,15742034




            9,15742034







            • 1




              Is there some reason you are doing cat - | mplayer - instead of just mplayer -?
              – Chris Down
              Feb 28 '14 at 7:29










            • The reason is: I just copied the command from the cited source. Might be redundant. I have deleted it, seems to still work. Maybe there is an edge case where it was needed and the author knew about it without telling it in his post?
              – erik
              Feb 28 '14 at 19:46












            • 1




              Is there some reason you are doing cat - | mplayer - instead of just mplayer -?
              – Chris Down
              Feb 28 '14 at 7:29










            • The reason is: I just copied the command from the cited source. Might be redundant. I have deleted it, seems to still work. Maybe there is an edge case where it was needed and the author knew about it without telling it in his post?
              – erik
              Feb 28 '14 at 19:46







            1




            1




            Is there some reason you are doing cat - | mplayer - instead of just mplayer -?
            – Chris Down
            Feb 28 '14 at 7:29




            Is there some reason you are doing cat - | mplayer - instead of just mplayer -?
            – Chris Down
            Feb 28 '14 at 7:29












            The reason is: I just copied the command from the cited source. Might be redundant. I have deleted it, seems to still work. Maybe there is an edge case where it was needed and the author knew about it without telling it in his post?
            – erik
            Feb 28 '14 at 19:46




            The reason is: I just copied the command from the cited source. Might be redundant. I have deleted it, seems to still work. Maybe there is an edge case where it was needed and the author knew about it without telling it in his post?
            – erik
            Feb 28 '14 at 19:46












            up vote
            2
            down vote













            Erik's answer works well, but using it how it is, using flac or oggenc, there's significant lag.

            A solution is to add -cache 256 to the mplayer command, so it would look as follows:



            ssh <user>@<remotehost> "arecord -f cd -D plughw:2 | oggenc -" | mplayer -cache 256 -


            Another thing to mention is that nowadays pretty much every modern distribution uses PulseAudio, which takes control over the hardware device, therefore using plughw:2 will fail if PulseAudio is running.

            Generally, default should work fine and use PulseAudio, where you can use pavucontrol or similar to select your desired input source using PulseAudio.



            That would make the command as follows:



            ssh <user>@<remotehost> "arecord -f cd | oggenc -" | mplayer -cache 256 -


            BUT: This introduces a lag. In my case, it is around eight seconds. That's terrible.




            The solution is much simpler than any other command:



            ssh <user>@<host> "arecord -f S16_LE -r 36000" | aplay


            That's it. This is using barely any CPU (0.1% according to htop). It's using ~60KB/s of bandwidth for me.



            If you want stereo sound: ssh <user>@<host> "arecord -f cd" | aplay

            Only useful if you have a stereo microphone, increases bandwidth to ~150KB/s for me. (Since it also raises the sampling rate to 44100Hz).



            More information on sampling rate (-r) and bit rate (affected by -f) can be found here.

            Basically: The lower you go, the worse the quality but the lower the bandwidth needed.



            This solution is fully compatible with PulseAudio, you can control output device, volume and more using pactl or the pavucontrol GUI application:



            pavucontrol






            share|improve this answer


























              up vote
              2
              down vote













              Erik's answer works well, but using it how it is, using flac or oggenc, there's significant lag.

              A solution is to add -cache 256 to the mplayer command, so it would look as follows:



              ssh <user>@<remotehost> "arecord -f cd -D plughw:2 | oggenc -" | mplayer -cache 256 -


              Another thing to mention is that nowadays pretty much every modern distribution uses PulseAudio, which takes control over the hardware device, therefore using plughw:2 will fail if PulseAudio is running.

              Generally, default should work fine and use PulseAudio, where you can use pavucontrol or similar to select your desired input source using PulseAudio.



              That would make the command as follows:



              ssh <user>@<remotehost> "arecord -f cd | oggenc -" | mplayer -cache 256 -


              BUT: This introduces a lag. In my case, it is around eight seconds. That's terrible.




              The solution is much simpler than any other command:



              ssh <user>@<host> "arecord -f S16_LE -r 36000" | aplay


              That's it. This is using barely any CPU (0.1% according to htop). It's using ~60KB/s of bandwidth for me.



              If you want stereo sound: ssh <user>@<host> "arecord -f cd" | aplay

              Only useful if you have a stereo microphone, increases bandwidth to ~150KB/s for me. (Since it also raises the sampling rate to 44100Hz).



              More information on sampling rate (-r) and bit rate (affected by -f) can be found here.

              Basically: The lower you go, the worse the quality but the lower the bandwidth needed.



              This solution is fully compatible with PulseAudio, you can control output device, volume and more using pactl or the pavucontrol GUI application:



              pavucontrol






              share|improve this answer
























                up vote
                2
                down vote










                up vote
                2
                down vote









                Erik's answer works well, but using it how it is, using flac or oggenc, there's significant lag.

                A solution is to add -cache 256 to the mplayer command, so it would look as follows:



                ssh <user>@<remotehost> "arecord -f cd -D plughw:2 | oggenc -" | mplayer -cache 256 -


                Another thing to mention is that nowadays pretty much every modern distribution uses PulseAudio, which takes control over the hardware device, therefore using plughw:2 will fail if PulseAudio is running.

                Generally, default should work fine and use PulseAudio, where you can use pavucontrol or similar to select your desired input source using PulseAudio.



                That would make the command as follows:



                ssh <user>@<remotehost> "arecord -f cd | oggenc -" | mplayer -cache 256 -


                BUT: This introduces a lag. In my case, it is around eight seconds. That's terrible.




                The solution is much simpler than any other command:



                ssh <user>@<host> "arecord -f S16_LE -r 36000" | aplay


                That's it. This is using barely any CPU (0.1% according to htop). It's using ~60KB/s of bandwidth for me.



                If you want stereo sound: ssh <user>@<host> "arecord -f cd" | aplay

                Only useful if you have a stereo microphone, increases bandwidth to ~150KB/s for me. (Since it also raises the sampling rate to 44100Hz).



                More information on sampling rate (-r) and bit rate (affected by -f) can be found here.

                Basically: The lower you go, the worse the quality but the lower the bandwidth needed.



                This solution is fully compatible with PulseAudio, you can control output device, volume and more using pactl or the pavucontrol GUI application:



                pavucontrol






                share|improve this answer














                Erik's answer works well, but using it how it is, using flac or oggenc, there's significant lag.

                A solution is to add -cache 256 to the mplayer command, so it would look as follows:



                ssh <user>@<remotehost> "arecord -f cd -D plughw:2 | oggenc -" | mplayer -cache 256 -


                Another thing to mention is that nowadays pretty much every modern distribution uses PulseAudio, which takes control over the hardware device, therefore using plughw:2 will fail if PulseAudio is running.

                Generally, default should work fine and use PulseAudio, where you can use pavucontrol or similar to select your desired input source using PulseAudio.



                That would make the command as follows:



                ssh <user>@<remotehost> "arecord -f cd | oggenc -" | mplayer -cache 256 -


                BUT: This introduces a lag. In my case, it is around eight seconds. That's terrible.




                The solution is much simpler than any other command:



                ssh <user>@<host> "arecord -f S16_LE -r 36000" | aplay


                That's it. This is using barely any CPU (0.1% according to htop). It's using ~60KB/s of bandwidth for me.



                If you want stereo sound: ssh <user>@<host> "arecord -f cd" | aplay

                Only useful if you have a stereo microphone, increases bandwidth to ~150KB/s for me. (Since it also raises the sampling rate to 44100Hz).



                More information on sampling rate (-r) and bit rate (affected by -f) can be found here.

                Basically: The lower you go, the worse the quality but the lower the bandwidth needed.



                This solution is fully compatible with PulseAudio, you can control output device, volume and more using pactl or the pavucontrol GUI application:



                pavucontrol







                share|improve this answer














                share|improve this answer



                share|improve this answer








                edited yesterday

























                answered yesterday









                confetti

                364118




                364118



























                     

                    draft saved


                    draft discarded















































                     


                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function ()
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f116919%2fredirect-sound-microphone-via-ssh-how-to-telephone-via-ssh%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

                    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?