Pygame Shmup Part 8: Sound and Music

preview_player
Показать описание
Sound adds lots of excitement to a game without much effort.

In each video in this series, we'll add another feature to the Shmup game until we have a full game experience with graphics, animations, sound, and much more!

Links to things in this video:

Other helpful links:
Рекомендации по теме
Комментарии
Автор

for ppl who didnt know how to set the explosion sound low just copy this line:
for Sounds in expl_sounds:
Sounds.set_volume(0.5)

UNDER THESE LINES:
for Sounds in ['Explosion2.wav', 'Explosion4.wav', 'Explosion5.wav']:
expl_sounds.append(pygame.mixer.Sound(path.join(Sounds_dir, Sounds)))

PS:sounds is the name of my file which i had the sound files so you just have to put snd or the file name you have :)

randomness
Автор

Good on you for giving the artists recognition. Great tutorial too, I appreciate it

gregjohnson
Автор

For those that just want to lower the sound of just one wave file. try:

your_sound_variable_here = pygame.mixer.Sound(path.join(yourSoundFolder, 'YourSound.wav'))
pygame.mixer.Sound.set_volume(your_sound_variable_here, 0.3)

I hope this helps others. I know my code is not perfect, but it worked, lol. Hopefully someone can show a better solution.
Also Thanks @KidsCanCode. I've redone this video a few times now, lol, and I'm still trying.

iamkrazashell
Автор

This was a great series! Hope that you'll keep making more.

nocturnalpotato
Автор

I love Bfxr. The option to save the sound to disk CAN be helpful, if you want to be able to tweak the slider options later. export to wave just give you the sound effect itself, you won't be able to alter it anymore.

omikronweapon
Автор

I'm trying to make a list of background music (I want to make the music random) how do I do it?

LemonHeadYT
Автор

i wonder why views are going down as part increase... i am really enjoying it

bishnudas
Автор

Hi, my effects sound sometimes, but others they are silent. It usually happens when I shooyt very quick. Any idea why does this happen? I'm on windows

javierlozano
Автор

Great videos. I have tried adding ogg files for background music and I get the following error: "The selected module could not be found". I am using pygame 2.0.1 and Python 3.9.1.

christianholderith
Автор

i have a question how can i change the volume in this area
expl_sound = []
for snd in ['Explosion1.wav', 'Explosion2.wav']:
expl_sound.append(pygame.mixer.Sound(path.join(snd_dir, snd)))

asura
Автор

I did exactly as shown in the tutorial, but the shoot/explosion sound is playing after some time of actual shooting or collision. Please help me resolve this issue.

bhaskardutta
Автор

I followed the link of bfxr that was in the link description but It doesn't show me what it shows you on the screen for some reason. Does anybody know how to fix this? Thanks

SethLaksadi
Автор

Hey. I tried to play an mp3 file. It was pretty big. It was a whole song actually. It was playing really slowly. Is it because of the size or does pygame have issues with mp3 file format?

Nirmal
Автор

How do you set the volume for the sound effects? It's really loud.

AgiftfromyoMama
Автор

Does anyone know how I can turn the volume down of the laser and explosion sounds. Ive tried the command used for the background music but it doesn't seem to work.

anime_bird
Автор

What should I write if I want to set the volume of the pew sound?

williamzhang_____piano
Автор

i tried many things....but no sound, no music

eee-oldl
Автор

I ran into a small issue with pygame.mixer.music.play()

Running the code as in your example: pygame.mixer.music.play(loops=-1), gave a TypeError:

Traceback (most recent call last):
File "shmup-8.py", line 154, in <module>

TypeError: play() takes no keyword arguments

But, replacing "loops=-1" with "-1", thus: pygame.mixer.music.play(-1), ran the game just fine.

This is with the following config:
Python 2.7.5
Pygame 1.9.1
SDL 1.2.15

mojak
Автор

I get the feeling that my background music is being drowned out by the sound effects, as in, the music volume is lowered whenever an effect plays. Maybe it's more an issue with priorities?
The sound options seem very rudimentary compared to, for example, GameMaker, where sound priorities are built-in arguments

omikronweapon
Автор

I have a problem. Due to 2021, Adobe Flash Player cant load.How am I supposed to load the bfxr.net?

mathlovernerds
join shbcf.ru