For this game I'm creating I need to use the pygame mixer. Here's how my code currently goes:
import pygame as pg
pg.init()
# Other stuff
class Menu(Scene):
def __init__(self, screen, scenes):
self.scenes = scenes
self.screen = screen
self.font = pygame.font.SysFont('freesansbold.ttf', 32)
self.music = pygame.mixer.Sound("path to wav file")
self.channel = pygame.mixer.Channel(0)
# Rest of code
However, every time I run that I get the following error:
pygame.error: mixer not initialized
So I tried to manually import the mixer with:
pygame.mixer.init()
but then I get the error:
pygame.error: ALSA: Couldn't open audio device: No such file or directory
Does anyone know how to fix this?