Skip to content

Latest commit

 

History

History
95 lines (70 loc) · 2.88 KB

README.md

File metadata and controls

95 lines (70 loc) · 2.88 KB

audioout modular service

This module implements the viam-labs:audioout API in a pygame model. This modular service provides audio output capabilities via the Python pygame mixer library.

Requirements

No prerequisite action is needed for Mac/Darwin. If you want to run this module on a Linux-based machine, install prerequisites with the following commands:

sudo apt update && sudo apt upgrade -y
sudo apt-get install python3
sudo apt install python3-pip python3-venv
sudo apt install python3-pyaudio
sudo apt-get install alsa-tools alsa-utils
sudo apt-get install flac

Build and Run

To use this module, follow these instructions to add a module from the Viam Registry and select the viam-labs:audioout:pygame model from the audioout module.

Configure your audioout:pygame service

Note

Before configuring your service, you must create a machine.

Navigate to the Config tab of your machine’s page in the Viam app. Click on the Components subtab and click Create component. Select the audioout type, then select the pygame model. Enter a name for your service and click Create.

Note

For more information, see Configure a Machine.

Attributes

There are no attributes available for configuration with this service.

Example Configuration

{
  "services": [
    {
      "name": "my-audioout",
      "type": "audioout",
      "namespace": "viam-labs",
      "model": "viam-labs:audioout:pygame"
    }
  ],
  "modules": [
    {
      "type": "registry",
      "name": "viam-labs_audioout",
      "module_id": "viam-labs:audioout",
      "version": "0.0.6"
    }
  ],
  "packages": []
}

API Usage

This service implements the viam-labs:audioout API.

Please reference the API codebase to interact with your configured service through a Viam SDK. Follow the instructions in Using Audioout-api with the Python SDK to get started.

Troubleshooting

When using a USB audio device, the device may not be registered as the default audio device on boot. To configure your USB device as the default audio device:

  1. Verify the existing alsa modules:
cat /proc/asound/modules

This will output something like:

 0 snd_usb_audio
 2 snd_soc_meson_card_utils
 3 snd_usb_audio
  1. Edit /etc/modprobe.d/alsa-base.conf to add content similar to:
options snd slots=snd-usb-audio,snd_soc_meson_card_utils