I have a simple Python script to play audio:
#!/usr/bin/env python2 import sys import pygame print(sys.version) file = '/home/pi/Musik/02-black_light_burns-animal.mp3' pygame.init() pygame.mixer.init() pygame.mixer.music.load(file) pygame.mixer.music.play() while pygame.mixer.music.get_busy(): pygame.time.Clock().tick(10)
which plays fine when called from terminal, I can hear the sound. From Nodered, the file also plays (pygame.busy returns 1) and I can see the loop is running, however, there is no sound to hear. Also the mixer does not show there is sound playing.
The Python envoirement and compiler are same:
pygame 1.9.4.post1 Hello from the pygame community. https://www.pygame.org/contribute.html
2.7.16 (default, Oct 10 2019, 22:02:15) [GCC 8.3.0]
also Nodered is started with same user as used in terminal.
I cannot see any difference.
On Stackoverflow I got one response in two days, telling me to try playing a wav instead of mp3, which did not make a difference.
Maybe here someone has an idea?