The first issue I checked was that the wave sound files do correctly play from the command line.
I changed the user name to pi & root, and Mycodo will still not play the wave sound files.
I also ran alsamixer
from the command line and confirmed the volume levels of the audio.
Additionally, I ran sudo raspi-config
and selected System Options → Audio and confirmed the output device for the audio.
I searched extensively for a solution, but there appears to no solution for this issue.
I tried different types of wave files (stereo / mono, signed / unsigned, 8 bit / 16 bit, and different hertz) and still no sound files are played by Mycodo.
Here is the log showing the error for the attempt to play the sample.wav file Kyle provided:
[Trigger 54e9ae75-d7ae-495c-a454-1463ea64d4c9 (Test Soundfile Function)]
[Action b8146440, Output (On/Off/Duration)]: Turn output 5e50484a-dfd5-4074-ae01-adb96bdfd242 CH56b8a903-7787-4f88-a1ea-44509a40ea47 (6, Test Soundfile Output) on for 20.0 seconds.
2021-10-25 13:29:00,228 - DEBUG - mycodo.outputs.on_off_shell_5e50484a - output_on_off(on, 0, sec, 20.0, 0.0, True)
2021-10-25 13:29:06,669 - DEBUG - mycodo.outputs.on_off_shell_5e50484a - Output on/off on command returned: Status: 0, Output: 'b''', Error: 'b"Playing WAVE '/home/pi/sample.wav' : Unsigned 8 bit, Rate 22050 Hz, Mono\n"'
2021-10-25 13:29:06,670 - DEBUG - mycodo.outputs.on_off_shell_5e50484a - Output 5e50484a-dfd5-4074-ae01-adb96bdfd242 CH0 (Test Soundfile Output) on for 20.0 seconds. Output returned: None
2021-10-25 13:29:20,237 - DEBUG - mycodo.outputs.on_off_shell_5e50484a - output_on_off(off, 0, None, 0.0, 0.0, True)
2021-10-25 13:29:20,284 - DEBUG - mycodo.outputs.on_off_shell_5e50484a - Output on/off off command returned: Status: 1, Output: 'b''', Error: 'b'aplay: no process found\n''
2021-10-25 13:29:20,284 - DEBUG - mycodo.outputs.on_off_shell_5e50484a - Output 5e50484a-dfd5-4074-ae01-adb96bdfd242 CH0 (Test Soundfile Output) OFF at 2021-10-25 13:29:20. Output returned: None
Strangely, when I use a stereo 16-bit wav sound file, Mycodo does not play the sound file and no error in the log is displayed. Here it is:
2021-10-25 13:52:00,328 - DEBUG - mycodo.trigger_action_b8146440 - Message: 2021-10-25 13:52:00
[Trigger 54e9ae75-d7ae-495c-a454-1463ea64d4c9 (Test Soundfile Function)]
[Action b8146440, Output (On/Off/Duration)]: Turn output 5e50484a-dfd5-4074-ae01-adb96bdfd242 CH56b8a903-7787-4f88-a1ea-44509a40ea47 (6, Test Soundfile Output) on for 20.0 seconds.
2021-10-25 13:52:00,328 - DEBUG - mycodo.trigger_action_b8146440 - Note Tags: []
2021-10-25 13:52:00,329 - DEBUG - mycodo.trigger_action_b8146440 - Email Recipients: []
2021-10-25 13:52:00,329 - DEBUG - mycodo.trigger_action_b8146440 - Attachment Files: None
2021-10-25 13:52:00,329 - DEBUG - mycodo.trigger_action_b8146440 - Attachment Type: None
2021-10-25 13:52:00,330 - DEBUG - mycodo.trigger_function_actions_54e9ae75 - Message: 2021-10-25 13:52:00
[Trigger 54e9ae75-d7ae-495c-a454-1463ea64d4c9 (Test Soundfile Function)]
[Action b8146440, Output (On/Off/Duration)]: Turn output 5e50484a-dfd5-4074-ae01-adb96bdfd242 CH56b8a903-7787-4f88-a1ea-44509a40ea47 (6, Test Soundfile Output) on for 20.0 seconds.
2021-10-25 13:52:00,333 - DEBUG - mycodo.outputs.on_off_shell_5e50484a - output_on_off(on, 0, sec, 20.0, 0.0, True)