2019-03-25 00:16:53

I'm really wanting to create an audio game. I would really like to use BGT, but I'm just going to bite the bullet and dive into Python. I know, as I become more experienced with Python, I"ll be glad I didn't stick with BGT. That being said, I see that everyone suggests using Pygame. Does that work with Python 2 or 3? I don't even know if that makes sense, because I barely even know what I"m talking about. Also, does anyone have a suggestion on where to start learning? Thanks

2019-03-25 00:42:09

Yes, most modules have been ported to python 3. It's advisable to forget about and leave python 2 behind

2019-03-25 00:49:03

Okay gotcha.

I've been reading this thread, and I feel like I need a little reassurance that Python is the way to go:

https://forum.audiogames.net/topic/2673 … on/page/2/

I've seen people talk about how Python is so much better for creating audio games than BGT, but then in that thread people seem to be crapping all over Python. IDK, just don't want to be jumping into this until I know it's worth my time.

2019-03-25 02:15:10

I am also trying to learn python as i also want to make a very complex multi title game and was recommended this source.
https://learnpythonthehardway.org/
Forget learn python the hard way 2 as it is a bit outdated and go to learn python the hard way 3.  From what I have seen so far, it is going to be a fun adventure.  A good luck to you and your learning journey.

Their is no such thing as a master.  One is never done learning, and those who claim to be a master at something are far from becoming one!!

2019-03-25 02:23:35

Thank you for the source, much appreciated. I found Think Python, but if I end up not liking that, I"ll check out the one you suggested smile.

2019-03-25 05:49:35 (edited by magurp244 2019-03-25 06:01:36)

@5
Python is becoming a fairly popular language, is quite powerful, has lots of documentation, and is easy to pick up. In that particular thread people seem to be talking back and forth more about libraries for Python, of which there are many of differing qualities and tastes, and not the language of Python itself. An analogy for this would be sort of like people arguing over their favorite soccer team, they both like soccer, but disagree on the best teams. If you also check the last page of that thread you'll find my post to other Python books like Dive Into Python, How To Think Like A Computer Scientist, the Python Practice Book, and a link to my OpenAL Lite examples.

Also, if you have any questions or would like any examples, such as for pygame, just ask.

-BrushTone v1.3.3: Accessible Paint Tool
-AudiMesh3D v1.0.0: Accessible 3D Model Viewer

2019-03-25 07:32:09

Hi, magurp speaking of examples, i thought i would not create another thred to ask for this, but i don't understand the panning of sounds in pygame. do you have an example on how to pan sounds in pygame?
I googled it and all i found was where other people where recomended to use other sound libraries... but i don't want to use another one now because i am already getting the hang of pygame, only the functions i need...

best regards
never give up on what ever you are doing.

2019-03-25 08:48:56

Pygame unfortunately doesn't have 3D positional audio abilities or any advanced features. As a rseult if you want more features such as reverb or positioning you'll have to use another library. However, this is where the OpenAL examples I provided come in, as OpenAL comes fully loaded will all the features you need, such as 3D positional audio, effects, filters, hrtf, etc. It comes with a selection of examples, and you can also use OpenAL with pygame instead of pygames built in basic audio. I can provide an example of that if you like.

-BrushTone v1.3.3: Accessible Paint Tool
-AudiMesh3D v1.0.0: Accessible 3D Model Viewer

2019-03-25 09:10:13

it won't hurt, thanks

best regards
never give up on what ever you are doing.

2019-03-25 09:16:14 (edited by kianoosh 2019-03-25 09:16:45)

Yeah. Pygame is there, and is a module for python. It works both with python2 and python3. However, as you saw in the previous posts, it is recommended to use python3. Just to give you more choices in case of game making modules, there's this module called panda3d which has everything itself such as positional audio handling with openal and fmod, audio effects such as reverb, game camera handling, and this sort of game-ish stuff. It's different when it comes to comparison between pygame, and panda3d. It's more like pyglet. Another module. Pyglet is another game making module which uses decorators for handling some type of functions and events. The thing that I never liked about pyglet is its slow loops. It is now your turn to search about these three libraries(pygame, panda3d and pyglet) to find the best one for your needs and start using it.

---
Co-founder of Sonorous Arts.
Check out Sonorous Arts on github: https://github.com/sonorous-arts/
my Discord: kianoosh.shakeri2#2988

2019-03-25 10:30:16

You'll have to have OpenAL32.dll and the openal.py wrapper in your working directory, and you can look to the examples in the pack for working with the advanced features. Example:

import pygame
from openal import *
import sys

def Example():
#initialize pygame
    pygame.init()
#load listener for hearing sound
    listener = Listener()
#load sound object
    sound = LoadSound('tone5.wav')
#load player for playing sound
    player = Player()
#load sound object into player
    player.add(sound)
#create display
    window = pygame.display.set_mode([640,480])

#main update loop
    while True:
        for event in pygame.event.get():
            if event.type == pygame.KEYDOWN:
            #if space is pressed, play sound
                if event.key == pygame.K_SPACE:
                    player.play()
            #if escape is pressed, clean up and quit
                if event.key == pygame.K_ESCAPE:
                    player.delete()
                    sound.delete()
                    listener.delete()
                    pygame.quit()
                    sys.exit(0)

    #update window
        pygame.display.update()

Example()
-BrushTone v1.3.3: Accessible Paint Tool
-AudiMesh3D v1.0.0: Accessible 3D Model Viewer

2019-03-25 10:40:13

OOOOOOOO it seems simple.
thanks. but is there not an easier way to load a bunch of sounds and play them acoarding to there loaded number?
because if i have to make use of multiple sounds, i would like to play them back at different times i guess since it is for a game.

best regards
never give up on what ever you are doing.

2019-03-25 11:04:05

Sure, you could just use a list to store multiple sounds and load them on startup. For example:

#load multiple sounds
sounds = [LoadSound('1.wav'),LoadSound('2.wav'),LoadSound('3.wav')]
#load the first sound
player.add(sounds[0])
#remove the loaded sound
player.remove()
#load the second sound
player.add(sounds[1])

You can also have multiple players, though each player can only play one sound at a time, and if you queue multiple sounds onto a single player it will go through them one at a time.

-BrushTone v1.3.3: Accessible Paint Tool
-AudiMesh3D v1.0.0: Accessible 3D Model Viewer

2019-03-25 11:25:50

OH. thanks

best regards
never give up on what ever you are doing.

2019-03-25 17:33:38

@6

Thanks for the clarification. I've so far been enjoying Think Python. I prefer having things explained to me in lots of detail.

2019-03-25 17:57:19 (edited by mahdi-abedi 2019-03-25 17:57:38)

as I read in one website, python2 updated on 2010 to ma'ch with new things which is python3 was with: I think, use python2: can someone please give me python2 direct link?

2019-03-25 23:40:26 (edited by magurp244 2019-03-25 23:40:42)

Hm, seems python.org's burying the python 2 download... You can get it [here]. Keep in mind that there are only a few small differences between python 2 and python 3, such that you may indeed be better off going with 3 instead.

-BrushTone v1.3.3: Accessible Paint Tool
-AudiMesh3D v1.0.0: Accessible 3D Model Viewer