Python Forum

Full Version: mixer failing in 2.0
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Just updated to Pygame 2 and have a problem that perhaps somebody has run into before.
Here's the simple code that's failing, and the shell output further below. I added the print-statement just to prove that the file does exist.

import pygame, os
pygame.init()
pygame.mixer.init()
print ("\n Music file exists? ", os.path.exists('music\\Rawhide.ogg'), "\n" )
pygame.mixer.music.load('music\\Rawhide.ogg')

===================== RESTART: C:/Users/Mark/Dropbox/Python/Scale/test.py =====================
pygame 2.0.1 (SDL 2.0.14, Python 3.9.1)
Hello from the pygame community. https://www.pygame.org/contribute.html

Music file exists? True

Traceback (most recent call last):
File "C:/Users/Mark/Dropbox/Python/Goebberts_scale/test.py", line 9, in <module>
pygame.mixer.music.load('music\\Rawhide.ogg')
pygame.error: Failed loading libvorbisfile-3.dll: The specified module could not be found.
=====================
libvorbisfile-3.dll is the driver for the .ogg file format.

Try a .wav and see if that works.
I'd suggest taking this to the Pygame support channels: https://www.pygame.org/wiki/info

The Windows binary of pygame is supposed to include all optional features, which includes Vorbis audio support. If you were on Linux or Mac, you might have to install libvorbis through your package manager, but the Windows installer should absolutely have that covered for you.
Try this and let us know if it works... Okay?

import pygame
pygame.mixer.init()
screen = pygame.display.set_mode ((400, 300))
pygame.mixer.music.load('music\\Rawhide.ogg')
pygame.mixer.music.play ()
while True :
	for action in pygame.event.get () :
		if action.type == pygame.QUIT :
			pygame.mixer.music.stop ()
			pygame.quit ()
			break
(Mar-14-2021, 11:43 PM)BashBedlam Wrote: [ -> ]Try this and let us know if it works... Okay?

import pygame
pygame.mixer.init()
screen = pygame.display.set_mode ((400, 300))
pygame.mixer.music.load('music\\Rawhide.ogg')
pygame.mixer.music.play ()
while True :
	for action in pygame.event.get () :
		if action.type == pygame.QUIT :
			pygame.mixer.music.stop ()
			pygame.quit ()
			break

How is this expected to load a .ogg file differently that what was originally posted?
(Mar-15-2021, 03:08 PM)michael1789 Wrote: [ -> ]How is this expected to load a .ogg file differently that what was originally posted?
It doesn't... It just gives it time to play before pygame ends.