ovos-microphone-plugin-pyaudio

July 31, 2026 · View on GitHub

This microphone plugin for OVOS runs on Linux, macOS, and Windows through PortAudio via pyaudio. It does not depend on speech_recognition. It calls the PyAudio API directly and maps sample_width to the matching PyAudio format for int16, int32, and float32 capture.

Platform: Linux, macOS, Windows (requires the libportaudio2 system library).

Source: PyAudioMicrophone in ovos_microphone_plugin_pyaudio/__init__.py

Entry point: opm.microphone = ovos-microphone-plugin-pyaudio


Configuration

FieldTypeDefaultDescription
devicestr|int|Noneconfig hierarchy / "default"Device name, integer index, or "default"
period_sizeint1024Frames per stream.read() call
timeoutfloat5.0Seconds to block in read_chunk() before returning None
multiplierfloat1.0Gain multiplier (skipped for float32, requires audioop)
float32_outputboolFalseUse paFloat32, required by ggwave
mutedboolFalseEnqueue silence instead of real audio
queue_maxsizeint8Max buffered chunks, oldest evicted when full
sample_rateint16000Sample rate in Hz (base class)
sample_widthint2Bytes per sample (base class)
sample_channelsint1Channels (base class)
chunk_sizeint4096Output chunk size in bytes (base class)

sample_width → PyAudio format mapping

sample_widthPyAudio format
1paInt8
2paInt16
3paInt24
4paInt32
float32_output=TruepaFloat32 (overrides width)

float32 output (ggwave)

{
  "listener": {
    "microphone": {
      "module": "ovos-microphone-plugin-pyaudio",
      "ovos-microphone-plugin-pyaudio": {
        "sample_rate": 48000,
        "sample_width": 4,
        "sample_channels": 1,
        "float32_output": true
      }
    }
  }
}

Device selection

find_input_device(name) tries, in order: integer passthrough, exact name, substring, then regex. list_input_devices() returns (index, info_dict) pairs for all input-capable devices.

Device resolution order

  1. listener.microphone.ovos-microphone-plugin-pyaudio.device
  2. listener.device
  3. "default"

Known limitations

  • No resampling or channel conversion
  • No stream-open fallback chain
  • multiplier gain requires audioop (removed from Python 3.13 stdlib)