Re: [pygame] Noob question: playing sounds

2015-06-09 Thread Philip Le Riche
Hi Miriam - My problem seems to have been with the wav file I was using. I'd always assumed a wav file consisted of little more than raw binary samples, in what case there'd be very little to go wrong, but it seems the structure is more complicated than that. In particular, the file I was using

Re: [pygame] Noob question: playing sounds

2015-06-09 Thread Miriam English
Hi Philip, I appreciate the update. Yes, I was surprised to find that WAV files are a series of chunks of data with headers when I first looked into it a while back. At the time I was mucking about generating raw waveforms mathematically using simple programs to basically just build a file

Re: [pygame] Noob question: playing sounds

2015-06-05 Thread Miriam English
I found this, which might help: https://www.raspberrypi.org/documentation/configuration/audio-config.md and this gives a little more: https://www.raspberrypi.org/forums/viewtopic.php?t=11086p=122466 -- If you don't have any failures then you're not trying hard enough. - Dr. Charles Elachi,

Re: [pygame] Noob question: playing sounds

2015-06-05 Thread Philip Le Riche
I got rid of the xcb_connection_has_error() by unsetting shell environment variable DISPLAY, which PuTTy was helpfully setting for me (for good reason in other circumstances). The line os.environ[SDL_VIDEODRIVER] = dummy still seems to be necessary. However, I still get no sound. I'll try the

Re: [pygame] Noob question: playing sounds

2015-06-05 Thread Philip Le Riche
I did try forcing output to the 3.5mm socket using raspi-config even though sound works with omxplayer, but with no effect. But thanks for posting anyway - your second link contains a link to a sound troubleshooting page which I'll follow up later. Regards - Philip On 05/06/2015 10:00, Miriam

Re: [pygame] Noob question: playing sounds

2015-06-05 Thread Philip Le Riche
Thanks Miriam, but since I can play sounds with omxplayer that wouldn't seem to be the problem. Kind regards - Philip On 05/06/2015 09:52, Miriam English wrote: It just occurred to me that I recall reading somewhere that there are 2 sound outputs in the Raspberry Pi (the audio jack, and the

Re: [pygame] Noob question: playing sounds

2015-06-05 Thread Miriam English
It just occurred to me that I recall reading somewhere that there are 2 sound outputs in the Raspberry Pi (the audio jack, and the HDMI connector) and that some people have had difficulty switching between them. You are probably trying to get sound from the audio jack. Did you check whether

Re: [pygame] Noob question: playing sounds

2015-06-05 Thread Miriam English
Ah. Then by elimination it does seem that python/pygame on Raspberry Pi is the source of the problem somehow. Good luck. Let us know when you solve it. I have a Raspberry Pi too and though I haven't got around to playing with python and pygame on it yet, I hope to in the future. :) Cheers,

Re: [pygame] Noob question: playing sounds

2015-06-04 Thread Carlos Zuniga
On Thu, Jun 4, 2015 at 12:03 PM, Philip Le Riche phi...@blueskylark.org 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

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,

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

Re: [pygame] Noob question: playing sounds

2015-06-03 Thread Greg Ewing
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

Re: [pygame] Noob question: playing sounds

2015-06-03 Thread Philip Le Riche
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

Re: [pygame] Noob question: playing sounds

2015-06-03 Thread diliup gabadamudalige
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

Re: [pygame] Noob question: playing sounds

2015-06-02 Thread diliup gabadamudalige
to do most things with pygame you need to initialize a pygame window. On Tue, Jun 2, 2015 at 3:50 AM, B W stabbingfin...@gmail.com 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

Re: [pygame] Noob question: playing sounds

2015-06-01 Thread B W
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 phi...@blueskylark.org wrote: Just trying to get started with pygame and stuck at square 1. All I

[pygame] Noob question: playing sounds

2015-06-01 Thread Philip Le Riche
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 =