Audio#

class ignis.services.audio.AudioService(*args: Any, **kwargs: Any)#

An audio service. Allows controlling audio devices.

Warning

This service uses the PulseAudio backend. To use it with PipeWire, install pipewire-pulse.

Example usage:

from ignis.services.audio import AudioService

audio = AudioService.get_default()
audio.connect("speaker-added", lambda x, speaker: print(speaker.description))
signal speaker_added#

Emitted when a speaker is added.

Parameters:

stream (Stream) -- The instance of the stream.

signal microphone_added#

Emitted when a microphone is added.

Parameters:

stream (Stream) -- The instance of the stream.

signal app_added#

Emitted when an app is added.

Parameters:

stream (Stream) -- The instance of the stream.

signal recorder_added#

Emitted when a recorder is added.

Parameters:

stream (Stream) -- The instance of the stream.

gproperty control: gi.repository.Gvc.MixerControl#
  • read-only

An instance of Gvc.MixerControl.

gproperty speaker: Stream#
  • read-write

The default speaker.

gproperty microphone: Stream#
  • read-write

The default microphone.

gproperty streams: list[Stream]#
  • read-only

A list of all streams.

gproperty speakers: list[Stream]#
  • read-only

A list of speakers.

gproperty microphones: list[Stream]#
  • read-only

A list of microphones.

gproperty apps: list[Stream]#
  • read-only

A list of applications currently playing sound.

gproperty recorders: list[Stream]#
  • read-only

A list of audio recorders.

class ignis.services.audio.Stream(control: gi.repository.Gvc.MixerControl, stream: Gvc.MixerStream | None)#

An audio stream. A general class for speakers, microphones, applications, and recorders.

Raises:

GvcNotFoundError -- If Gvc is not found.

signal removed#

Emitted when the stream has been removed.

gproperty stream: Gvc.MixerStream | None#
  • read-only

An instance of Gvc.MixerStream.

gproperty application_id: str#
  • read-only

The application ID, or "" if unknown.

gproperty icon_name: str#
  • read-only

The current icon name, depending on volume and is_muted properties. Works only for speakers and microphones.

gproperty id: int#
  • read-only

The ID of the stream, or -1 if unknown.

gproperty name: str#
  • read-only

The name of the stream, or "" if unknown.

gproperty description: str#
  • read-only

The description of the stream, or "" if unknown.

gproperty is_muted: bool#
  • read-write

Whether the stream is muted.

gproperty volume: float#
  • read-write

The current volume of the stream, or -1.0 if unknown.

gproperty is_default: bool#
  • read-only

Whether the stream is default. Works only for speakers and microphones.