To play raw audio data from Python without installing pyaudio or pygame or similar, you first have to know the platform on which your script will be run. Well, playing uncompressed audio is, but MP3, well, I'll explain below. Is it possible, without any dependencies, yes it is, but it is not worth it.
If you meant how to play MP3 using Python, well, this is a broad question.
PPS: I'm still trying to figure out a way to pipe your own mic through there as well since this method will obviously not pipe your real microphone in too, but looking into the source code of pygame is making my head hurt due to it all being written in C. PS: This took me a while to figure out, your welcome. (Also if you want it to play on a button press I recommend using the python library keyboard, the GitHub documentation is really good and you should be able to figure it out on your own.) > ("Megalovania.mp3") #Load the mp3Īlso, the music doesn't play through your speakers, so you're going to have another python script or thread running that handles playing it through your speakers. > mixer.init(devicename='CABLE Input (VB-Audio Virtual Cable)') #Initialize it with the correct device > mixer.quit() #Quit the mixer as it's initialized on your main playback device > mixer.init() #Initialize the mixer, this will allow the next command to work > from pygame import mixer #Playing sound
Then: > from pygame._sdl2 import get_num_audio_devices, get_audio_device_name #Get playback device names
Then run this command in cmd: pip install pygame=2.0.0.dev8 (or py -m pip install pygame=2.0.0.dev8, depending on your installation of python) [Also the reason it's the dev version is that it requires some functions only in sdl2, whereas the main branch uses sdl1) (Also from what I know this specific answer only works on Windows, but it should be similar on Linux with PulseAudio instead of VB-Audio Cable, but I'm not a daily Linux user so I don't know.)įirst download:, this will create a "Virtual Audio Cable" where programs can play music to the input device (What looks like a speaker) and it'll pipe it to the output device (What looks like a microphone). Unfortunately AOE2 itself doesn't provide any debugging information to troubleshoot the inability to connect to network games.It is possible but it isn't 100% in python as it requires the installation of other software. Or if anyone has suggestions on where else to look to figure out the problem, I'd appreciate that as well. So essentially I was wondering if anyone else here has managed to play AOE2, or any similar game, inside VirtualBox from Ubuntu, and if so what you needed to do to make it possible. I'm not sure what else I would need to change, however. However I'm still unable to play multiplayer games, and suspect that some kind of networking issue lies at the heart of the problem.
I turned off the Windows firewall in the virtual machine and don't have any ports blocked by Ubuntu, so no software firewall should be at fault.So I changed from NAT networking to bridged networking in While the local IP on Ubuntu is .x, which I figured was a I noticed that the IP address of my virtual machine was 10.0.x.x,.This is what I've done so far to try to resolve the issue: Unfortunately, I tried playing multiplayer via WI-FI which I created on my Ubuntu machine and can't seem to join games.īut when I connected to my WI-FI router other able to connect to my system and we can play multiplayer mode I installed Age of Empires II (Expansion) in VirtualBox (hosting Windows XP).