Re: [pygame] Noob question: playing sounds

2015-06-04 Thread Michael Lutinsky
I can verify that running:

$ python /usr/lib/python2.7/dist-packages/pygame/examples/sound.py

plays without error on my Kubuntu distro (x86_64 Linux kernel 3.19.0-18, 
pulseaudio 6.0). Must be a RPi issue?

~ Michael 



> Well, this is strange. In
> /usr/lib/python2.7/dist-packages/pygame/examples there is sound.py. This
> must have worked for someone once, and it doesn't include anything about
> creating a window. When I run it for the first time it makes a click but
> doesn't play the sound. It produces the xcb_connection_has_error()
> message but seems to ignore it.
> 
> Adding pygame.display.set_mode((1,1)) to my program (which otherwise now
> is very similar to sound.py) doesn't help. This is driving me nuts!
> 
> Regards - Philip
> 
> On 02/06/2015 13:58, diliup gabadamudalige wrote:
> > to do most things with pygame you need to initialize a pygame window.
> >
> > On Tue, Jun 2, 2015 at 3:50 AM, B W  > > wrote:
> >
> > Hi, you cannot use the dummy video driver if you want sound. At
> > least I have not figured out a way to do it. You need at least a
> > 1x1 window.
> >
> > Gumm
> >
> > On Mon, Jun 1, 2015 at 2:11 PM, Philip Le Riche
> > mailto:phi...@blueskylark.org>> wrote:
> >
> > Just trying to get started with pygame and stuck at square 1.
> > All I want to do is play sounds on a Raspberry Pi (Raspbian).
> > No screen. Nothing visual. So I do:
> >
> > import pygame, os, sys
> > from pygame.locals import *
> >
> > os.environ["SDL_VIDEODRIVER"] = "dummy"
> >
> > pygame.mixer.init()
> > sound = pygame.mixer.Sound("Exclamation.wav")
> > sound.play(loops = 0)
> > while pygame.mixer.music.get_busy() == True:
> > continue
> >
> > Having saved it in file try.py, I do
> >
> > python try.py
> >
> > and get
> >
> > xcb_connection_has_error() returned true
> >
> > Yes, I've done an apt-get update and upgrade. I can make
> > sounds with Sonic Pi but this produces nothing. Googling the
> > error seemed to give no relevant results. Can someone give me
> > a hint please?
> >
> > Regards - Philip
> >
> >
> >
> >
> >
> >
> > http://www.diliupg.com
> > http://soft.diliupg.com/
> >
> > **
> > This e-mail is confidential. It may also be legally privileged. If you
> > are not the intended recipient or have received it in error, please
> > delete it and all copies from your system and notify the sender
> > immediately by return e-mail. Any unauthorized reading, reproducing,
> > printing or further dissemination of this e-mail or its contents is
> > strictly prohibited and may be unlawful. Internet communications
> > cannot be guaranteed to be timely, secure, error or virus-free. The
> > sender does not accept liability for any errors or omissions.
> > **
> >
> 


Re: [pygame] Noob question: playing sounds

2015-06-04 Thread Carlos Zuniga
On Thu, Jun 4, 2015 at 12:03 PM, Philip Le Riche  wrote:
> Thank you for that, but still no joy whatsoever. I also tried uninstalling
> python-pygame and installing python3-pygame instead, but that gave the same
> error and furthermore, wouldn't recognise the existence of my wav file. I
> also tried installing pulseaudio, python-alsaaudio and python-pyalsa,
> thinking that it looked like pygame was failing to connect to the underlying
> sound system, but nothing made any difference.
>
> Are people successfully using pygame on the Raspberry Pi, or is it just
> broken?
>

I think you'll have more luck asking in the RPi forums.
Looking at the last post in this thread it seems to be a problem with
pulseaudio:
https://www.raspberrypi.org/forums/viewtopic.php?t=45548&p=360197

Are you able to run other sound applications?


Re: [pygame] Noob question: playing sounds

2015-06-04 Thread Philip Le Riche
Thank you for that, but still no joy whatsoever. I also tried
uninstalling python-pygame and installing python3-pygame instead, but
that gave the same error and furthermore, wouldn't recognise the
existence of my wav file. I also tried installing pulseaudio,
python-alsaaudio and python-pyalsa, thinking that it looked like pygame
was failing to connect to the underlying sound system, but nothing made
any difference.

Are people successfully using pygame on the Raspberry Pi, or is it just
broken?

Regards - Philip

On 04/06/2015 06:21, diliup gabadamudalige wrote:
> This has happened to me too on several occasions. I have resolved this by
>
> 1.pygame.mixer.pre_init(44100, 16, 2, 4096) # setup mixer to avoid
> sound lag
>
> 2.pygame.init()
>
> 3.pygame.mixer.set_num_channels(64)
>
> Try deleting the name of the file completley and renaming it.
> Sometimes there are hidden characters and this too causes problems.
>
> Hope this helps.
>
>
>
> On Thu, Jun 4, 2015 at 4:41 AM, Greg Ewing
> mailto:greg.ew...@canterbury.ac.nz>> wrote:
>
> Philip Le Riche wrote:
>
>   Well, this is strange. In
> /usr/lib/python2.7/dist-packages/pygame/examples there is
> sound.py. This must have worked for someone once,
>
>
> It still works for me, using pygame 1.9.2 with
> Python 2.7 on MacOSX 10.6.
>
> -- 
> Greg
>
>
>
>
> -- 
> Diliup Gabadamudalige
>
> http://www.diliupg.com
> http://soft.diliupg.com/
>
> **
> This e-mail is confidential. It may also be legally privileged. If you
> are not the intended recipient or have received it in error, please
> delete it and all copies from your system and notify the sender
> immediately by return e-mail. Any unauthorized reading, reproducing,
> printing or further dissemination of this e-mail or its contents is
> strictly prohibited and may be unlawful. Internet communications
> cannot be guaranteed to be timely, secure, error or virus-free. The
> sender does not accept liability for any errors or omissions.
> **
>



[pygame] Some pygame documentation typos

2015-06-04 Thread John Smith
https://www.pygame.org/docs/
various programs demonstrating the use of individual pyame modules

https://www.pygame.org/docs/tut/chimp/ChimpLineByLine.html
players fist
Since this sprite container is really an instance of the "DrawPlain" sprite
group, it knows how to draw our sprites.

https://www.pygame.org/docs/tut/chimp/chimp.py.html
#call sprite intializer
depending on the monkeys state

Not cool:
self.dizzy = self.dizzy + 12