Kirsle.net logo Kirsle.net

Redirect Audio Out to Mic In (Linux)

February 3, 2010 by Noah
I discovered a neat trick you can do with PulseAudio: redirect the audio output of your computer to the microphone input, so that any application that supports recording from a mic will get your audio output instead.

I needed to do this because I was testing something at work that involved an Asterisk server calling a softphone running on my Linux box, and it wanted me to record a voice prompt and then hang up. This computer didn't have a microphone installed, so I started looking for a way to fake the mic input and make it record an MP3 or something instead.

If your system is using PulseAudio (every recent Fedora and Ubuntu distribution does), the steps to follow are:

1) Open PulseAudio Volume Control

This is pavucontrol on the command line, and in Fedora is provided by the package pavucontrol.

Go to the "Input Devices" tab, and select "Show: Monitors" from the bottom of the window. If your computer is currently playing audio, you should see a bar showing the volume of the output:

Input Devices
The "Input Devices" tab showing monitors.

2) Start running an app that is recording audio, and go to the "Recording" tab and see if your app is listed.

In this screenshot I'm running Audacity and recording audio.

3) Click the input device button ("ALSA Capture from") and pick "Monitor of Internal Audio Analog Stereo")

Recording
The "Input Devices" tab showing monitors.

And that's pretty much it. If you see volume bars on the Recording tab now then it's probably working, and the recording app is now recording your audio output.

Here's a full desktop screenshot of me running `play audiodump.wav` (a WMA-to-WAV conversion of the Windows XP Welcome Music) in a terminal, the PulseAudio Volume Control running, and Audacity recording from the mic.

Audio Out to Mic In
Click for bigger screenshot.
Tags:

Comments

There are 18 comments on this page. Add yours.

Avatar image
John posted on May 12, 2010 @ 12:09 UTC

Thanks,

I found this useful.

Avatar image
danyle posted on December 22, 2010 @ 16:01 UTC

yeah, really helped especially with google voice and espeak, thanks.

Avatar image
gtech posted on December 28, 2010 @ 22:30 UTC

Wow this is great, works perfectly.

Avatar image
westen posted on July 30, 2011 @ 10:20 UTC

hi, can you please tell me how i can get my mic input to be heard over my speakers. massively appreciated

Avatar image
dog posted on April 10, 2012 @ 08:26 UTC

Im using this for my honours thesis. Thanks! saved me some effort emulating recording process in the software im writing :)

Avatar image
srikrishna posted on May 26, 2012 @ 04:56 UTC

thanks this post is help full. but this is only redirecting speaker to mic. original mic in is missing. i want both audio out and mic out to mic in is there any solution

Avatar image
simon posted on December 2, 2012 @ 20:45 UTC

Fantastic, thanks, I've been trying to work out how to do this for a long time.

Avatar image
avmfree posted on January 19, 2013 @ 15:50 UTC

Thanks. Very useful.

Avatar image
cata posted on December 6, 2013 @ 12:38 UTC

thanks man! I knew about PulseAudio, but didn't know it can redirect sound. Much appreciate!

Avatar image
george posted on December 9, 2014 @ 18:17 UTC

How to do the exact oposite?

Im participating in some video conferences and im making some kind of echo because of this.

But i cant find a way to do the oposite,

Thanks!

Avatar image
Jerry posted on January 27, 2015 @ 17:01 UTC

I was banging my head on this problem for the past month! Thanks so much!

Avatar image
_nix posted on February 11, 2015 @ 17:57 UTC

5 years ago and still helping. thank you! got the job done.

Avatar image
Andrew_Gaines posted on April 23, 2015 @ 21:25 UTC

What about recording both the mic AND the output stream?

Avatar image
SGoblin posted on October 10, 2015 @ 00:33 UTC

hey, i see this works. but there is an echo. on my recording software, how can i fix this?

Avatar image
Ramon posted on March 20, 2016 @ 18:01 UTC

THANKS a lot man!! <3

Avatar image
D. Grateful Mann posted on June 8, 2016 @ 18:54 UTC

I've been trying to find a reasonably decent recording of Tchaikovsky's 1812 Overture with cannons and chorus for a good few years now - classical music is getting harder to find through most of my usual channels. The only place I've had any luck has been YouTube, and although kissyoutube/savemedia.com exists, this song is longer than that service allows for.
Thank you for helping me replace this fundamental classic in my library.

Avatar image
TangoDeltaDelta posted on August 31, 2016 @ 18:40 UTC

Is there a way to do this completely from the command line for a Linux system that isn't running X at all?

Avatar image
Rafael posted on August 31, 2018 @ 21:10 UTC

Wow....really a great tip, very useful, in my case, to generate closed captions for on line videos that does not provide this feature =) Thank you so much for sharing this tip !

Add a Comment

Used for your Gravatar and optional thread subscription. Privacy policy.
You may format your message using GitHub Flavored Markdown syntax.