MicrophoneLoopback is a little program to loopback the microphone sound into the speakers. It's working on both Windows and Linux.
MicrophoneLoopback use the PortAudio API to capture the microphone stream and send it back to the speakers. cxxopts to parse commands lines arguments and ini_parser to parse ini file.
To compile MicrophoneLoopback, you first need to compile PortAudio, follow this PortAudio installation guide.
The PortAudio binary files must be in the dependencies/portaudio folders with :
- lib: put in this folder the file portaudio_static_x64.lib file.
- include: put the PortAudio include file.
Clone the cxxopts library and the ini_parser library into the dependencies folder.
Then, compile the MicrophoneLoopback with CMake.
On Linux, MicrophoneLooback use the pulse_simple api or the PortAudio to capture microphone stream and send it back to the speakers, cxxopts for parsing commands lines arguments and ini_parser for parsing ini file.
To compile MicrophoneLoopback you need to have pulseaudio, PortAudio, cxxopts and ini_parser installed on your system.
MicrophoneLoopback [OPTION...]
-
-r, --sample-rate arg : Set the sample rate at which the program will loopback the sound of the microphone to the speakers. The default value is 48000Hz.
-
-f, --frames-per-buffer arg : Set the number of frames per buffer, a lower value will decrease the latency, but will increase cpu overhead and glitches. The default value is 256.
-
-s, --short arg : Allow to use short version for setting the sample rate :
- 44 -> 44100
- 48 -> 48000
- 96 -> 96000
This settings is overridden by --sample-rate.
-
-v, --version : show the version of the program.
-
-h, --help : show a help text on the available options of the program.
- -i, --input_latency arg : Set the input latency in seconds at which Windows will get the audio from the microphone. The default value is 0.02.
- -o, --output_latency arg : Set the output latency in seconds at which Windows will send the audio to the speakers. The default value is 0.02.
- -p, --portaudio : Use PortAudio API instead of the Pulse Simple API.
It is possible to configure MicrophoneLoopback with a .conf file. An exemple template here. The file use an ini syntax.
Ini file :
# Configuration file to configure MicrophoneLoopback.
[stream]
#sample-rate=48000
#frames-per-buffer=256
[Windows]
#input_latency=0.02
#output_latency=0.02
[api]
#use-portaudio=yes
On Windows the file must be put in the same location of the executable. On Linux, the file may be put either in /home/user/.config/MicrophoneLoopback/
or in /etc/MicrophoneLoopback
.
See the LICENCE file.