17

I run a CentOS Server with VNC enabled and some services require a microphone to work properly, but it doesn't have to be used for recording, just a microphone device available. So I was wondering if I can create a virtual recording device that can be used as a microphone, but it doesn't have to input any sound. I run alsa tools but doing modprobe sound-aloop says that the operation is not permitted.

13
  • Anything from here: alsa-project.org/main/index.php/Matrix:Module-aloop works?
    – IBr
    May 19 '14 at 10:57
  • There is a support for dummy sound card in the Linux kernel. Would that help?
    – lgeorget
    May 19 '14 at 11:36
  • @IBr doing modinfo snd-aloop prints out the information associated with the module while modprobe snd-aloop doesn't work giving this message: Error inserting snd_aloop (/lib/modules/2.6.32-042stab079.5/kernel/sound/ drivers/snd-aloop.ko): Operation not permitted I did build the suitable alsa-driver for my kernel, did make install and copied the modules to /lib/modules/uname -r/kernel/sound/drivers/ and received above message after trying modprobe.Same message for snd-page-alloc.ko, snd-timer.ko and snd-pcm.ko as well. I have no clue what to do next but thanks for your help! May 19 '14 at 22:42
  • 2
    If you have the dummy sound card (try to do a modprobe snd-dummy), you have both the dummy output output and input. These links may help: raspberrypi.org/forums/viewtopic.php?&t=42285, alsa-project.org/main/index.php/…
    – lgeorget
    May 20 '14 at 6:33
  • 1
    @krowe Nope, that doesn't work, because I don't have access to the physical server resources. Haha. Anyways I think @lgeorget is right, I tried on a Xen machine with modprobe snd-dummy and it worked! The whole thing was about the virtualization type, you will need to have permissions to load your own modules for this to work and OpenVZ doesn't allow this Aug 21 '14 at 5:25
9

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 hope it does the trick. It is primarily utilizing ALSA plugin for Audacity You don't have to play anything if you want but it should create a virtual microphone but i am also adding the playing stuff for others to refer.

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.

Get it here [git clone http://anongit.freedesktop.org/git/pulseaudio/pulseaudio.git]

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:

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") 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

enter image description here

3
  • The problem is that the program wouldn't start unless I had a microphone inserted, but thanks for the suggestion! I'm sure it would help many out there that are trying to implement what we know of "Stereo Mix" on Windows! Sep 3 '14 at 20:50
  • 1
    This is soo dope. I had just spent a good portion of my afternoon trying to create a virtual sink for obs studio, only to stumble on this answer
    – smac89
    Apr 3 '20 at 21:11
  • This is awesome. Do you know if it's possible to set up from commandline?
    – vidstige
    May 27 '20 at 15:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.