Git Product home page Git Product logo

pulseaudio-virtualmic's Introduction

Virtualmic

This minimal script creates a PulseAudio source and pipes a media file or stream into it.

Packaging status

Dependencies

  • any POSIX compliant shell
  • PulseAudio
  • FFmpeg
  • mktemp (optional, not needed when virtualmic is run with -p filename)

Installation

Copy the script to any of your $PATH directories. On most systems, /usr/bin would be the most sensical directory.

Usage

Usage: virtualmic [-p pipe_filename] [-n source_name] [-f format]
       [-r rate] [-c channels] [-v] [-d] [-h] [input_filename]

  input_filename  This file is piped to the virtual mic (can be an url) (default: stdin)
  -p, --pipe      Set audio pipe filename (use mktemp otherwise)
  -n, --name      Set PulseAudio source_name (default: virtualmic)
  -f, --format    Set audio format (default: s16le)
  -r, --rate      Set audio sampling frequency (default: 44100)
  -c, --channels  Set number of audio channels (default: 1)
  -v, --verbose   Make output verbose
  -d, --default   Set virtual microphone as PulseAudio default source
  -h, --help      Show this help

Examples

The most basic example is to use an audio file as virtual microphone:

virtualmic file.mp3

virtualmic reads from stdin by default:

<command that generates audio> | virtualmic

Use any smartphone as microphone

I wrote this script initially to use my smartphone as mic after the sound card on my laptop got broken.

For this to work you first need to install an app on your phone to broadcast audio, I'm using IP Webcam on Android. When you run the app on your phone, you can connect to it with virtualmic.

Over wifi

With an IP Webcam URL, this is what the command looks like:

virtualmic http://192.168.0.5:8080/audio.opus

There will of course be some latency, but the latency due to virtualmic should be very little.

With ADB (the Android Debug Bridge)

On Android devices you can use ADB to connect over USB for a better connection. In my previous example with IP Webcam, the phone broadcasts audio over port 8080. This port can be forwarded to a connected computer using ADB:

adb forward tcp:8080 tcp:8080

Then you can connect virtualmic to your local port:

virtualmic http://localhost:8080/audio.opus

pulseaudio-virtualmic's People

Contributors

matthiascoppens avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.