This question already has answers here:
how to play wav file in python?
(5 answers)
How can I play an mp3 with pygame?
(7 answers)
Closed 2 years ago.
i have a sound file with a delay in it that plays with pygame.
menu_sound = pygame.mixer.Sound('sounds/Devastation.ogg')
#these lines are not next to each other in my code, i just picked out relevant lines.
menu_sound.play(-1)
there is about a 4 second delay. how can i force pygame to play the music starting at 4 seconds? i have looked at the mixer module documentation and can't find anything.
Python 3.3.3, windows
Related
This question already has answers here:
Spawning multiple instances of the same object concurrently in python
(1 answer)
Is there a way to have different tick rates for differents parts of my code in pygame?
(1 answer)
Closed 9 months ago.
I am making a game in python using pygame in which you click a candy and you get candies. This game is similar to the famous game 'Cookie Clicker'. I've got the clicking part done but I have no idea how to do the auto candies per second. If anybody knows how to do this, please tell me.
This question already has answers here:
how to play wav file in python?
(5 answers)
How can I play an mp3 with pygame?
(7 answers)
Closed 2 years ago.
I'm trying to add to my game background music with sound effects and I understood that the best way to do it is with channels and sounds, so I tried it but when I play a sound sound_name.play() or play it with a channel channel_name.play(sound_name) it does nothing, and when I add a delay it beeps.
Does anyone know how to figure it out or has a better way to play some sound on my game (when one sound doesn't stop or reset the other sound)?
Thank you :)
This question already has answers here:
how to clear the screen in python [duplicate]
(1 answer)
How to clear the interpreter console?
(31 answers)
Closed 3 years ago.
I'm trying to clear the shell window when the actual code runs. I've done a couple different searches and saw some options but none seem to work. Here is the one I've been trying to get to work (I'm using Python 3.8.1).
import os
os.system('cls')
This question already has answers here:
Clear terminal in Python [duplicate]
(27 answers)
Closed 4 years ago.
I am making a text based rpg in python 3 and the output window gets very cluttered cluttered. I was wondering if there was a way to clear the screen automatically from time to time.
import os
os.system('cls')
You can use os.system('clear') if you are on linux.
This question already has answers here:
Play a Sound with Python [duplicate]
(10 answers)
Closed 9 years ago.
How would I be able to play a .wma file in Python? Let's just say the file name is Scream.wma
http://wiki.python.org/moin/Audio/ has a long list of audio libraries. There's even one on the list called wave, which is just for WAV files. Besides those you can use PyGame:
import pygame
import pygame.mixer
pygame.mixer.music.load('file.wav')
pygame.mixer.music.play()