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.
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
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.
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.
There are no attributes available for configuration with this service.
{
"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": []
}
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.
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:
- 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
- Edit /etc/modprobe.d/alsa-base.conf to add content similar to:
options snd slots=snd-usb-audio,snd_soc_meson_card_utils