Cronjob script under volumio

Hey comunnity,

I build a script to pause Volumio and start a sound(reminder) and after that continue with volumio as normal. The script works, but I can’t hear a sound. There are some restrictions playing some audio as normal “user” and not via Volumio UI?

Thanks for the replys in advance!


Hi! You don’t give details of how you proceed. How do you pause Volumio, how you want to play your sound.

sorry about that!

well I made a python script to play a sound after some action. The script call a pygame library to play the sound. I pause volumio with the own build command “Volumio pause” and after the action it will resume with “volumio play”.

I dont know if this is important too, but the action doesnt just play a sound, it send a command to the GPIO to turn a lamp on.

so my script call the GPIO, pygame and OS library.

GPio for control the GPio pins. The PyGame in order to reproduce a sound and the os.system() in order to send the “volumio pause and volumio play” commands.

This script works in a normal Raspberry Pi enviroment, but under volumio doesnt.

I dont know how about Pi, but for some linux distribution you have to install some repositories, like for Kubuntu the restricted ones, in order to use some codecs. Is this under Volumio fork too?

do you use a small delay after pause? how do you adress your Dac ? Directly by writing something like hw:XX ? If yes try plughw:XX instead.
Is your device busy when trying to play your sound?

Well, I actually expected that the default sound source should be activate automatically, so with that in mind I just call the script without other parameters.

import RPi.GPIO as GPIO
import time
import pygame
import OS

file = '/home/volumio/Music/notifications/Sound01.mp3'
os.system(volumio pause)
#timeToSleep = 10
os.system(volumio play)

There is no ‘default’ output configred in Volumio. Volumio use the output selected in playback settings. In your case, if you can’t sett the hw outputv in your script, you have to create an asound.conf file in /etc that redirect default to your hw. have a look here :