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))
speaker_added(*args)#
  • Signal

Emitted when a speaker is added.

Parameters:

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

microphone_added(*args)#
  • Signal

Emitted when a microphone is added.

Parameters:

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

app_added(*args)#
  • Signal

Emitted when an app is added.

Parameters:

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

recorder_added(*args)#
  • Signal

Emitted when a recorder is added.

Parameters:

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

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

An instance of Gvc.MixerControl.

property speaker: Stream#
  • read-write

The default speaker.

property microphone: Stream#
  • read-write

The default microphone.

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

A list of all streams.

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

A list of speakers.

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

A list of microphones.

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

A list of applications currently playing sound.

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

A list of audio recorders.

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

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

Raises:

GvcNotFoundError -- If Gvc is not found.

removed()#
  • Signal

Emitted when the stream has been removed.

property stream: gi.repository.Gvc.MixerStream | None#
  • read-only

An instance of Gvc.MixerStream.

property application_id: str | None#
  • read-only

The application ID or None.

property icon_name: str | None#
  • read-only

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

property id: int | None#
  • read-only

The ID of the stream.

property name: str | None#
  • read-only

The name of the stream.

property description: str | None#
  • read-only

The description of the stream.

property is_muted: bool | None#
  • read-only

Whether the stream is muted.

property volume: float | None#
  • read-only

The current volume of the stream.

property is_default: bool#
  • read-only

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