pygame.error: WASAPI can’t initialize audio client:

  audio, pygame, python

pygame can’t play audio, but when I have my bluetooth speakers connected there is no error. When I disconnect my bluetooth speakers this error happens. Also I’m on a laptop, so I’m trying play the audio using the built-in speakers. Other apps can play audio just fine. And I’m running this inside a virtualenv. but I’ve only installed pygame in this virtualenv. Here’s the code in my game that deals with the audio:

import pygame
import os
from fractions import Fraction
from random import randint

snake_eat_sound = pygame.mixer.Sound(os.path.join('Assets', 'Biting Apple-SoundBible.mp3'))
snake_hit_sound = pygame.mixer.Sound(os.path.join('Assets', 'mixkit-arcade-mechanical-bling.mp3'))

And here is the error it produces:

Traceback (most recent call last):
  File "", line 6, in <module>
pygame.error: WASAPI can't initialize audio client: 
(pygame_env) PS D:Programmingprojectspythonpygame_snake_exercise> 

Source: Python Questions