Using Mixer to Play Mp3 Throws Error About libmpg123-0.dll, but There's No Context

85 views Asked by At

I wanted to play a .mp3 file to my microphone using python code that I found in a Stack Overflow post, but I had to do some tweaking with the steps I had to take.

Here are the steps that I had to do:

  1. I had to install a program from https://www.vb-audio.com/Cable/ what would create a "Virtual Audio Cable" where programs can play music to the input device. However, the program costs money, so I decided to download a separate Virtual Audio Cable from https://vac.muzychenko.net/en/download.htm, which seems good.

  2. Next, I had to use the command pip install pygame==2.0.0.dev8 to install that specific version of pygame, but it threw the error: ERROR: Could not find a version that satisfies the requirement pygame==2.0.0.dev8 (following a lot of different versions). So, I decided to use the command pip install pygame==2.0.0 which worked fine.

  3. I then had to go through a series of commands (which can be found in the post) so I can load a .mp3 file to play. However, when I tried to run the command mixer.music.load("speech.mp3"), it gave me the error: pygame.error: Failed loading libmpg123-0.dll: The specified module could not be found. So, i went to https://www.dll-files.com/libmpg123-0.dll.html to download the file that I needed (The second post linked below suggested it), and I moved the contents to C:\Windows\System32. Although I downloaded it, I then ran the command again, but it gave me this: pygame.error: Failed loading libmpg123-0.dll: without any context why something went wrong.

Could someone please give me the correct steps to actually fixing this and getting it working? I have spent nearly three hours now trying to figure out what is wrong.

Playing mp3 file through microphone with python

pygame.error: Failed loading libmpg123.dll: Attempt to access invalid address (I used this post because it was the only one I could find)

1

There are 1 answers

2
Starbuck5 On BEST ANSWER

This was a bug in pygame when installed into Windows Store Python. It was fixed in pygame 2.1.3 by me (https://github.com/pygame/pygame/pull/3196)

It is also fixed in pygame-ce, a modern fork of pygame, which I would recommend over pygame.

pip uninstall pygame
pip install pygame-ce