Follow the default device and microphone activity by listener

Open
#129 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
35/100
Issue type
Feature
Clarity
Mostly clear
Activity status
Active
Tech stack
python

Research direction

Read AGENTS.md, docs/standards/testing.md, ROADMAP.md, and the two Python adapter files named in the issue to learn the project’s audio contracts. First check that prerequisite #119 is closed; the issue says not to start until it is. Then locate the two modules and their tests in aitts-audio-coreaudio; done means listener based default output following and per process microphone activity meet the acceptance criteria, with tests and a record in docs/testing-evidence/.

Written by the indexing model from the issue text.

Description

enhancement
.dag: issue-dag/2
.id: flyingrobots/AI-TTS#129
.kind: task
task: coreaudio-listeners
title: "Follow the default device and microphone activity by listener"
.type: feature
workstream: Audio
wave: 1
.blocked_by: [flyingrobots/AI-TTS#119]
roadmap: ROADMAP.md
language: ASD-STE100

Feature

Do this task in the flyingrobots/AI-TTS repository: Add default-output following and microphone-activity reports to `aitts-audio-coreaudio`, with property listeners in place of polls.
Read these first: AGENTS.md, docs/standards/testing.md, ROADMAP.md, and src/aitts/adapters/core_audio.py, src/aitts/application/audio_device.py.
Do not start until each issue in the Prerequisites section is closed.
Stay in the Scope section. Do not change what the Scope section excludes.
Write each failing test before the code that makes it pass. Record falsification evidence as the testing standard requires.
Stop when each item in Acceptance Criteria and in Definition of Done is true.
Report what you did, what you verified, and what you did not verify.

1. Background Context

The Python daemon reads Core Audio through ctypes and polls each 150 ms. It does this because PortAudio keeps an old device list.

2. Problem Description

The Rust adapter opens the default device one time. It does not follow a change, and it cannot report microphone activity.

2b. Proposed Solution

Add default_device: a listener on the default output property that tells the player to move. Add input_activity: a listener that reports that an application has an input device open.

2c. Alternatives considered and rejected

  • Poll as the Python daemon does: a listener is immediate and uses no timer.
  • Use a cross-platform audio library: such a library caused the old device list problem.

2d. Acceptance Criteria

  • A change of the default output moves speech to the new device during a clip.
  • Microphone activity is reported in less than 200 ms after a different application opens an input device.
  • No timer runs while the daemon is idle.
  • The contract can express activity for each process, for platforms that can report it.

2e. Test Plan

Golden: A simulated property change calls the listener one time.
Edges: The default device is removed. Two changes arrive in 10 ms. No input device exists.
Known failure modes: A listener that is not removed keeps a callback to freed state.
Fuzz and stress: Random sequences of device changes leave one open stream.

3. Prerequisites

  • #119 Validate the Rust output process on real audio hardware

4. Scope

In: Two modules in aitts-audio-coreaudio and their tests.
Out: Adapters for other platforms.

5. Why now

The player and the duplex adapter depend on it.

6. Risks

Listener callbacks arrive on a system thread. They must only send a message.

7. Definition of Done

Each acceptance criterion is true. The tests are in the repository and pass in CI. A record is in docs/testing-evidence/. The change is merged. This issue is closed.

8. Stakeholders

  • James Ross, the repository owner: decides the scope and accepts the result.

9. Related Issues

  • #16
Dominant language
Python
Stars
0
Forks
1
Avg merge
2h 13m
Merged PRs (30d)
51

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from flyingrobots/AI-TTS

All issues in flyingrobots/AI-TTS

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.