I am working on a program to play a song and at the same time light up a 45 led Neopixel strip. The problem is when I am running the code using sudo the sound is not working (I am using a soundwave USB to audio sound card) but the lights work (i tried it using a separate test program for just lights) and on the other hand when I run the program without sudo in terminal using (python3 test_light_led.py) the sound works but now the lights don't work.
Has anyone worked on something like this? I have been searching a lot of places for a solution but couldn't find one.
THis is my current code. Any help would be appriciated.
import os
import playsound
import neopixel
import board
from adafruit_led_animation.animation.pulse import Pulse
from adafruit_led_animation.color import AMBER
pixel_pin = board.D18
pixel_num = 45
pixels = neopixel.NeoPixel(pixel_pin, pixel_num, brightness = 1, auto_write = False)
pulse = Pulse(pixels, speed = 0.1, color = AMBER, period = 3)
while True:
playsound.playsound("Happy_Voice.wav")
pulse.animate()