Skip to content
Go back

macOS Menu Bar App to Control Transcription with Python

Edit page

macOS Menu Bar App to Control Transcription

This guide explains how to create a macOS menu bar application using Python that:

Prerequisites

pip install pyobjc sounddevice

File Structure

Instructions

  1. Set Up the Menu Bar App

    Use NSStatusBar from PyObjC to create a status item in the macOS menu bar.

  2. List Input Devices

    Use sounddevice.query_devices() to get available audio input devices. Filter for devices with max_input_channels > 0.

  3. Generate a Menu for Devices

    For each input device, create a menu item. When clicked, this sets the selected device.

  4. Start Transcription

    Use subprocess.Popen to run the transcription script with the selected device passed as --device. Capture stdout for real-time transcription.

  5. Open Transcription Window

    Create a NSWindow with a NSTextView wrapped in a NSScrollView. Display transcription output here.

  6. Stop Transcription

    Terminate the subprocess and close the transcription window.

  7. Quit App

    Add a Quit menu item that terminates the app and subprocess if running.

Running the App

Launch the app using:

python menu_app.py

Look for the “Transcribe” menu in the macOS menu bar. Select an input device, start transcription, and see the output in a separate window.

Notes


Edit page
Share this post on:

Previous Post
OIDC vs SAML Authentication Flows
Next Post
Control Your Windows PC with Homebridge