Re: [pygame] pygame.midi not working on Ubuntu Jaunty?

2009-08-07 Thread Gary Bishop

Ok, I got it going. For me the modprobe is not required.

Simply typing

sudo /etc/init.d/timidity restart

fixes things up. That command stops and restarts the timidity server. 
Why doing that fixes its relationship to pygame I don't know but it does.


Note that vkeybd (an app from the Ubuntu repository) works fine without 
this hack. So there is something different about the way pygame is using 
midi.


Thanks for the help
gb


Lenard Lindstrom wrote:

Hi,

The instructions I found for Timidity, 
http://koti.mbnet.fi/bstrom/filedata/en/my-timidity-howto.html, claim 
that the Alsa virtual midi port module must also be installed:


modprobe vir_midi

With it in place and the Timidity virtual server started I get this 
listing from pygame.examples.midi:


~$ python -m pygame.examples.midi --list
0: interface :ALSA:, name :Midi Through Port-0:, opened :0:  (output)
1: interface :ALSA:, name :Midi Through Port-0:, opened :0:  (input)
2: interface :ALSA:, name :VirMIDI 1-0:, opened :0:  (output)
3: interface :ALSA:, name :VirMIDI 1-0:, opened :0:  (input)
4: interface :ALSA:, name :VirMIDI 1-1:, opened :0:  (output)
5: interface :ALSA:, name :VirMIDI 1-1:, opened :0:  (input)
6: interface :ALSA:, name :VirMIDI 1-2:, opened :0:  (output)
7: interface :ALSA:, name :VirMIDI 1-2:, opened :0:  (input)
8: interface :ALSA:, name :VirMIDI 1-3:, opened :0:  (output)
9: interface :ALSA:, name :VirMIDI 1-3:, opened :0:  (input)
10: interface :ALSA:, name :TiMidity port 0:, opened :0:  (output)
11: interface :ALSA:, name :TiMidity port 1:, opened :0:  (output)
12: interface :ALSA:, name :TiMidity port 2:, opened :0:  (output)
13: interface :ALSA:, name :TiMidity port 3:, opened :0:  (output)

I tried it with port 10 and it works, though sounds lousy on my slow 
machine. With some Timidity tweaks for interactive playback the sound 
becomes better.


Lenard Lindstrom


Gary Bishop wrote:

More details on what I am seeing:

$ pmidi -l
 Port Client name   Port name
 14:0 Midi Through  Midi Through Port-0
128:0 TiMidity  TiMidity port 0
128:1 TiMidity  TiMidity port 1
128:2 TiMidity  TiMidity port 2
128:3 TiMidity  TiMidity port 3

pmidi shows I have midi ports.

$ vkeybd --addr 128:0

Works and sounds fine.

$ python midi.py --list
 0: interface :ALSA:, name :Midi Through Port-0:, opened :0:  (output)
 1: interface :ALSA:, name :Midi Through Port-0:, opened :0:  (input)
 2: interface :ALSA:, name :TiMidity port 0:, opened :0:  (output)
 3: interface :ALSA:, name :TiMidity port 1:, opened :0:  (output)
 4: interface :ALSA:, name :TiMidity port 2:, opened :0:  (output)
 5: interface :ALSA:, name :TiMidity port 3:, opened :0:  (output)

The pygame midi test can see all the midi ports.

$ python midi.py --output 2
 0: interface :ALSA:, name :Midi Through Port-0:, opened :0:  (output)
 1: interface :ALSA:, name :Midi Through Port-0:, opened :0:  (input)
 2: interface :ALSA:, name :TiMidity port 0:, opened :0:  (output)
 3: interface :ALSA:, name :TiMidity port 1:, opened :0:  (output)
 4: interface :ALSA:, name :TiMidity port 2:, opened :0:  (output)
 5: interface :ALSA:, name :TiMidity port 3:, opened :0:  (output)
using output_id :2:

Running midi.py with --output 2 looks great but no sound.

Still looking for ideas.
Thanks
gb



Gary Bishop wrote:
Yes, timidity is in the list and as I said, works fine from the 
vkeybd app connects to it and works fine.

gb

Lenard Lindstrom wrote:

Gary Bishop wrote:

I'm trying out the new pygame.midi on Ubuntu Jaunty. I'm running
examples/midi.py in output mode on Python 2.6.2 with pygame 1.9.1 
built
from source without errors. portmidi and porttime were found during 
the

build.

The vkeybd app works so I know midi output (timidity) works fine.

examples/midi.py displays properly and does not produce any error
messages but it produces no sound.

Any ideas?

Thanks
gb


Hi Gary,

Try the --list option on examples/midi.py to see if a virtual 
timidity output port is present. Getting some form of midi working 
with alsa is a hassel.


Lenard Lindstrom






Re: [pygame] pygame.midi not working on Ubuntu Jaunty?

2009-08-07 Thread Gary Bishop

More details on what I am seeing:

$ pmidi -l
 Port Client name   Port name
 14:0 Midi Through  Midi Through Port-0
128:0 TiMidity  TiMidity port 0
128:1 TiMidity  TiMidity port 1
128:2 TiMidity  TiMidity port 2
128:3 TiMidity  TiMidity port 3

pmidi shows I have midi ports.

$ vkeybd --addr 128:0

Works and sounds fine.

$ python midi.py --list
 0: interface :ALSA:, name :Midi Through Port-0:, opened :0:  (output)
 1: interface :ALSA:, name :Midi Through Port-0:, opened :0:  (input)
 2: interface :ALSA:, name :TiMidity port 0:, opened :0:  (output)
 3: interface :ALSA:, name :TiMidity port 1:, opened :0:  (output)
 4: interface :ALSA:, name :TiMidity port 2:, opened :0:  (output)
 5: interface :ALSA:, name :TiMidity port 3:, opened :0:  (output)

The pygame midi test can see all the midi ports.

$ python midi.py --output 2
 0: interface :ALSA:, name :Midi Through Port-0:, opened :0:  (output)
 1: interface :ALSA:, name :Midi Through Port-0:, opened :0:  (input)
 2: interface :ALSA:, name :TiMidity port 0:, opened :0:  (output)
 3: interface :ALSA:, name :TiMidity port 1:, opened :0:  (output)
 4: interface :ALSA:, name :TiMidity port 2:, opened :0:  (output)
 5: interface :ALSA:, name :TiMidity port 3:, opened :0:  (output)
using output_id :2:

Running midi.py with --output 2 looks great but no sound.

Still looking for ideas.
Thanks
gb



Gary Bishop wrote:
Yes, timidity is in the list and as I said, works fine from the vkeybd 
app connects to it and works fine.

gb

Lenard Lindstrom wrote:

Gary Bishop wrote:

I'm trying out the new pygame.midi on Ubuntu Jaunty. I'm running
examples/midi.py in output mode on Python 2.6.2 with pygame 1.9.1 built
from source without errors. portmidi and porttime were found during the
build.

The vkeybd app works so I know midi output (timidity) works fine.

examples/midi.py displays properly and does not produce any error
messages but it produces no sound.

Any ideas?

Thanks
gb


Hi Gary,

Try the --list option on examples/midi.py to see if a virtual timidity 
output port is present. Getting some form of midi working with alsa is 
a hassel.


Lenard Lindstrom




Re: [pygame] pygame.midi not working on Ubuntu Jaunty?

2009-08-07 Thread Gary Bishop
Yes, timidity is in the list and as I said, works fine from the vkeybd 
app connects to it and works fine.

gb

Lenard Lindstrom wrote:

Gary Bishop wrote:

I'm trying out the new pygame.midi on Ubuntu Jaunty. I'm running
examples/midi.py in output mode on Python 2.6.2 with pygame 1.9.1 built
from source without errors. portmidi and porttime were found during the
build.

The vkeybd app works so I know midi output (timidity) works fine.

examples/midi.py displays properly and does not produce any error
messages but it produces no sound.

Any ideas?

Thanks
gb


Hi Gary,

Try the --list option on examples/midi.py to see if a virtual timidity 
output port is present. Getting some form of midi working with alsa is a 
hassel.


Lenard Lindstrom




[pygame] pygame.midi not working on Ubuntu Jaunty?

2009-08-07 Thread Gary Bishop

I'm trying out the new pygame.midi on Ubuntu Jaunty. I'm running
examples/midi.py in output mode on Python 2.6.2 with pygame 1.9.1 built
from source without errors. portmidi and porttime were found during the
build.

The vkeybd app works so I know midi output (timidity) works fine.

examples/midi.py displays properly and does not produce any error
messages but it produces no sound.

Any ideas?

Thanks
gb



Re: [pygame] Sound still glitchy in 1.8.1rc1 on Ubuntu

2008-07-14 Thread Gary Bishop

Hi,

Yes, I have run the buffer size up huge with no improvement. I'm pretty 
sure it is not a buffer size problem.


I isolated this piece from some spoken text. It occurred on several 
words in the sequence but not on every word. It does not appear to be 
related to amplitude because some words sounded fine at higher and lower 
volumes. It is not obvious what is different. Particular lengths? Maybe 
only a few samples are broken and some words have very low energy at 
those places?


I hear the problem at 11025 as well as 22050. I *don't* hear the problem 
with the size set to -8 but I don't want to use 8 bit audio.


I wish my sound card had the capability to record the stereo output. 
Then I could carefully examine the waveform to possibly guess what is 
happening. Alas, it doesn't. Perhaps a jumper from headphone to 
microphone will do the job with careful adjustment of the levels.


gb

Brian Fisher wrote:

Hi Gary,
  Making the mixer work great in all cases without tweaking numbers is
indeed a goal for pygame. I would guess that in this case the problem may be
something other than the buffer size, which is what was tweaked in 1.8.1 to
be larger. This seems the case to me because you mentioned a higher sampling
rate eliminates the problem for you.

To confirm, can you try a big fat buffer size with the original 22050
sampling rate? (basically something that should be able to fit the whole .44
second wave without mixing over time)
so something like this:
pygame.mixer.init(22050, -16, 2, 16384)
The lag will likely be longer, so I'm just curious if playback quality is
good in that case.

Also, have you tried many other wav files? Any at different sampling rates?
Is the problem consistent at 22050 for all samples tried, or are there some
that don't seem to have problems?


On Mon, Jul 14, 2008 at 12:31 PM, Gary Bishop <[EMAIL PROTECTED]> wrote:


2. Yes, fooling with the options to pygame.mixer.pre_init seems to always
be the not very satisfactory answer. My understanding of the goal for 1.8.1
was to eliminate that requirement. Having users fool with numbers on a hit
or miss basis is a sure way to drive them away.

That said, I found that forcing the rate to 44100 instead of letting it be
at 22050 where it apparently went by default makes it sound better. Makes no
sense that a higher sampling rate cures it but it appears to.






Re: [pygame] Sound still glitchy in 1.8.1rc1 on Ubuntu

2008-07-14 Thread Gary Bishop

1. No, diff. That sleep is just waiting for the audio to terminate.

2. Yes, fooling with the options to pygame.mixer.pre_init seems to 
always be the not very satisfactory answer. My understanding of the goal 
for 1.8.1 was to eliminate that requirement. Having users fool with 
numbers on a hit or miss basis is a sure way to drive them away.


That said, I found that forcing the rate to 44100 instead of letting it 
be at 22050 where it apparently went by default makes it sound better. 
Makes no sense that a higher sampling rate cures it but it appears to.


3. Yes, the real code pumps the event queue. That was just a boiled down 
demo case.


Thanks
gb

claxo wrote:


I'am not an expert in pygame audio but:

1. It makes any diference if you reduce the sleep time? 
Say, 1/30 sec by example.


2. It makes some diference if you initialize the mixer with diferent buffer
sizes ? 
That was pointed to me by Patrick Mullen time ago, and the advice

 periodically resurfaces. Sometimes, especially with old hardware,
increasing the buffer size alleviates the problem ( at the cost of more
latency, If i remember well).

 ex: 
 # last param is buffer size 
 pygame.mixer.init(44100, -16, True, 1024)


3. Your real code really dont pump the event queue? Maybe .get_busy()
updates all necesary inner state, but a lot of pygame functionallity
depends on the event queue being pumped.

HTH

--- claxo   


[pygame] Sound still glitchy in 1.8.1rc1 on Ubuntu

2008-07-14 Thread Gary Bishop
The following small program still produces glitchy audio using 1.8.1rc1 
checked out from svn today. You can get the file w11.wav (a single 
spoken word from espeak) here: http://gb-cs.cs.unc.edu/tmp/w11.wav


import pygame
import time

print pygame.version.ver

pygame.init()

snd = pygame.mixer.Sound('w11.wav')

c = snd.play()
while c.get_busy():
time.sleep(0.1)

I get the same bad audio with 1.8.

Other apps, including audacity and totem play it fine.

Is there any hope for pygame sound on Linux? Otherwise it is a great 
platform for our accessible games for children with disabilities.


Thanks
gb


Re: [pygame] seg fault question with numpy and pygame and py2exe

2008-05-05 Thread Gary Bishop
Do you have the latest py2exe from svn? I had problems until I 
downloaded and built it myself. Then it worked great. Apparently some 
changes have been made in the repository that haven't been released.


gb

andy uehara wrote:

Hello all,

I have read that there is an issue with Exception in _numpysurfarray.py
But I don't think my issue is the same. The code compiles and runs fine 
normally using python interpreter. When I run py2exe I produce a windows 
executable. But, when I run the windows executable, I get a segmentation fault. 
Here is the actual error:

Fatal Python error: (pygame parachute) Segmentation Fault

I tried to make the smallest case example:
#!/usr/bin/env python

import os
import pygame
import numpy
from pygame.locals import *

def main():
pygame.init()
mini=pygame.Surface((5,5))
mini_surfarray = pygame.surfarray.array3d(mini)

#this calls the 'main' function when this script is executed
if __name__ == '__main__': main()

Here is my system information:
windows 64 vista
python:  2.5.2
pygame 1.8.0
py2exe 0.6.6
numpy 1.0.4

Is this the same issue as numpysurfarray.py? I apologize if this is a py2exe or 
numpy issue. I am not sure where to look further since the pygame parachute 
doesn't give me more information.

-andy

   
-

Be a better friend, newshound, and know-it-all with Yahoo! Mobile.  Try it now.


Re: [pygame] Python and Speed

2008-04-17 Thread Gary BIshop
ctypes is great stuff! I find it much harder to crash the interpreter 
with ctypes than with extensions I've developed and debugged. It is 
quite resilient. I've used it to interface with the Windows API to 
simulate keystrokes, to interface to a USB Digital IO interface, in a 
wrapper for the huge OpenCV library, to set the background image on my 
desktop, to adjust the system volume control, to interface to the 
Wiimote, and to wrap eSpeak to name a few. I've pretty much given up on 
swig and pyrex.


gb

Greg Ewing wrote:

Ian Mallett wrote:
How do you write an extension module in C and call it from Python?   
Someone gave some instructions earlier, but I found them too vague...


Another way I forgot to mention earlier is to use the
ctypes module (I often forget about it, because it wasn't
in the stdlib until very recently.)

That allows you to call compiled routines from a shared
library directly without having to write any C. It's
less efficient, though, as it has to go through some
Python wrapper objects to get there, and also more
dangerous, because you can easily crash the interpreter
if you don't get everything exactly right.



Re: [pygame] TTS and VISTA?

2008-04-14 Thread Gary Bishop

pyTTS works on Vista. It just has a different selection of voices.
gb

FT wrote:

Hi,

Since Microsoft has deliberately destroyed the use of the TTS engines in
VISTA, does anyone know if someone is going to make a TTS version for VISTA?

Bruce



Re: [pygame] pygame for 2d graphics

2008-03-19 Thread Gary Bishop

Madhubala wrote:
> My code is  below
> -
> s = pygame.Surface((4892,3164)) #original dimension of a screen in
> pixels got from some other application
> s.fill((255,255,255))
>
> 
pygame.draw.aalines(s,(0,0,0),True,[(3000,2500),(3192,2500),(3192,2648),(3000,2648)],0) 


> #original dimensions of a rect
> pygame.display.init()
> w = pygame.display.set_mode((1000,750))
> s1 = pygame.transform.scale(s,(1000,750))
> w.blit(s1,(0,0))
> pygame.display.flip()

> When i am trying to scale down the original surface to pygame window ,
> the rectangle is not visible.
> This is original scalling. I have to provide different scalling
> levels to provide  zooming effect .
>

You are experiencing the destructive effects of aliasing. The scale 
function probably does point or at best bilinear sampling. When scaling 
down by such a large factor you must first filter the image to remove 
frequencies above 1/2 the sampling rate, then sample. This can be done 
with a convolution but is likely to be slow. You'll likely also be 
unhappy with the resulting dimness of the lines. The filtering will 
blend them with their environment causing them to be light gray instead 
of black.


You can read more about aliasing at http://en.wikipedia.org/wiki/Aliasing

gb



Re: [pygame] Creating unique userevent ids?

2008-03-18 Thread Gary Bishop

René Dudfield wrote:

I see it uses opencv.  Did you know there is a python module for
opencv made by the opencv authors?



Yes, I tried the official one and it didn't work for me so I found 
Otto's ctypes wrapper and got it working with the latest version of 
opencv. I really prefer using ctypes over other types of extensions 
because it frees me from the issues of building for multiple platforms.


gb





Re: [pygame] py2exe problems

2008-03-15 Thread Gary BIshop

Ian Mallett wrote:

New problem.
My program (which only uses pygame) doesn't run when py2exe'd.  It says
something about not being able to find the surfarray module when the .exe is
run, but it closes almost instantly, so I can't really tell.  I upgraded to
pygame 1.8, if that makes a difference.



Run it from the command prompt, then you'll get to see the message.

py2exe has some facilities for forcing it to include modules.
gb


Re: [pygame] Timing question (newbie)

2008-03-11 Thread Gary BIshop
I've attached some very rough, proof of concept code I wrote for my 
students. It wants 2 command line arguments. The first is a sound file 
(mp3 or wav). The second has the times in seconds at which beats occur. 
I generated mine with aubiotrack. You feed it a wav file and it prints 
out times of the detected beat.


The program draws a little graph showing how close your key, mouse, or 
ddr pad presses are to the beat.


Very rough. It was just a test to see if this was even possible. I've 
got a team of students working on an accessible version of DDR for kids 
who are blind. They'll do a better job I'm sure.


gb

Miguel Sicart wrote:

Hi all,
I have a question about timing - I want to make a little game based on
rhythm input, a bit like dance dance revolution, patapon, or similar. The
idea is that the player has to press a key within a specific time, getting
more points the better the timing. And I have little idea how to do it.
I am thinking creating uservents, and the matching them to key input, but I
am a bit clueless about the timing thing. Any help is welcome!


Thanks a bunch!

M

HIT_TOL = 0.200
BEAT_TOL = 0.033

import sys
import os
import pygame
music = pygame.mixer.music
from bisect import bisect

pygame.mixer.pre_init(44100,-16,2,1024*2)
pygame.init()

songfile = sys.argv[1]
timefile = sys.argv[2]

music.load(songfile)

times = [ float(t.strip()) for t in file(timefile, 'rt') ]
def GetDelta(t):
n = bisect(times, t)
d1 = t - times[n-1]
d2 = times[n] - t
if d1 < d2:
return -d1
else:
return d2

size = width, height = 320, 240
origin = height/2
scale = height/2
bar_w = 16
bar_n = width/bar_w

screen = pygame.display.set_mode(size, pygame.DOUBLEBUF | pygame.HWSURFACE)

try:
joystick = pygame.joystick.Joystick(0)
joystick.init()
except pygame.error:
pass

music.play()

errors = []

run = True
while run:
t = music.get_pos() * 0.001
dt = GetDelta(t)
hit = False
for event in pygame.event.get():
if event.type == pygame.QUIT: 
run = False
if event.type == pygame.KEYDOWN:
if event.key == pygame.K_ESCAPE:
run = False
f = max(-1, min(1, (dt / HIT_TOL)))
hit = abs(f) < 0.5
errors.append(f)
if event.type == pygame.JOYBUTTONDOWN or event.type == pygame.MOUSEBUTTONDOWN:
f = max(-1, min(1, (dt / HIT_TOL)))
hit = abs(f) < 0.5
errors.append(f)
else:
pygame.time.wait(2)

if abs(dt) < BEAT_TOL:
screen.fill((255,255,255))
else:
screen.fill((0,0,0))
for i,f in enumerate(errors[-bar_n:]):
x1 = i*bar_w
w = bar_w
if f < 0:
y1 = origin + f * scale
else:
y1 = origin
h = abs(f) * scale
if f < 0:
c = (255,0,0)
else:
c = (0,255,0)
screen.fill(c, pygame.Rect(x1, y1, w, h))
pygame.display.flip()

print 'exiting'


Re: [pygame] TTS and Pitch Parameter

2008-03-08 Thread Gary BIshop
I repeat, pyTTS, at least the version 3.0 that I have, does not have a 
method or property named Pitch. You are, I think simply assigned those 
values to an instance variable that you are adding to the tts object.


Do you hear the pitch change when you assign to the pitch variable?

I include a session in ipython below. You can see that while tts.Rate is 
identified as a property, tts.Pitch is not found.


gb

In [2]: tts=pyTTS.Create()

In [3]: tts.Rate?
Type:   property
Base Class: 
String Form:
Namespace:  Interactive
Docstring:
@return: Rate of speech, typically in the range of [-10, 10]
@rtype: integer
Class Docstring:
property(fget=None, fset=None, fdel=None, doc=None) -> property 
attribute


fget is a function to be used for getting an attribute value, and likewise
fset is a function for setting, and fdel a function for del'ing, an
attribute.  Typical use is to define a managed attribute x:
class C(object):
def getx(self): return self.__x
def setx(self, value): self.__x = value
def delx(self): del self.__x
x = property(getx, setx, delx, "I'm the 'x' property.")


In [4]: tts.Pitch?
Object `tts.Pitch` not found.

In [5]:

FT wrote:

Hi!

Below is the speech.py file which will load in python25 from my windows
OS. It uses the same command as in the pygame example, no different. So, the
same import should be in affect, except if pygame uses these same commands,
the pitch does not work.


Re: [pygame] TTS and Pitch Parameter

2008-03-07 Thread Gary BIshop
I don't think pyTTS has a method or property named Pitch. Maybe you're 
using another tts engine?


gb

FT wrote:

Brian,
I know pygame has no text to speech, but the python25 I have does not
have the error. It would appear to be how pygame was made. For the pyTTS
module is brought in but something in pygame must be interfering with it.
For the module is the same, something else must be there. Or a different
revision level...Mixer???

Bruce


Brian Fisher Wrote:
pygame doesn't have any text-to-speech features. I don't think pygame
is related to the problem. I think it's a red herring.

On Fri, Mar 7, 2008 at 11:31 AM, FT <[EMAIL PROTECTED]> wrote:

When running a python25 game I get the tts.Rate and tts.Pitch to work
 fine. But when using pygame the tts.Pitch is not there, is there a reason
 why? Is it because of the wrong version used to make pygame?

I am using pygame 1.8.0 rc3 and it just says that this parameter is

not

 a part of this synth


Bruce




Re: [pygame] Creating unique userevent ids?

2008-03-06 Thread Gary Bishop

Hi Rene,

You can find the rapidly changing current version of the code in CVS at 
http://uncpythontools.cvs.sourceforge.net/uncpythontools/CV/ under 
pygame_cam.py. You'll need CVtypes of course. It appears to work for me 
on Ubuntu, Windows, and Mac OS X.


I've just hacked together an object for the pgu gui kit. If that 
interests you I can create another project for it in CVS.


I'm working as hard as I can to get stuff ready for a trip to Asheville 
week after next so I don't have much time to discuss it now but I'd be 
very pleased to talk to anyone interested about how best to provide such 
capabilities to the pygame community.


gb

René Dudfield wrote:

hi,

that's probably a good idea :)

The upcomming SDL 1.3 has a new method for doing better user events...
until then, it's probably good to do something like Ian suggests -
except maybe start way higher.  Perhaps have some functions for
getting events?  That way your code would be more abstracted for
working with later changes.  eg.  FRAME_READY =
webcam.get_event("FRAME_READY") etc.


ps. do you have a url for your code repository?  I've also been
thinking about starting a webcam module probably based of VidCapture,
and opencv.  I think webcam support would be good for the next release
of pygame, that is version 1.9.  Same with wiimote support.

I think if we include new code with pygame that requires new events,
we would increment USEREVENT, and hopefully that won't break much user
code.

That could be another approach that you take, increment USEREVENT
yourself at init time, and require your init code before USEREVENT
usage.


On Tue, Feb 26, 2008 at 7:40 AM, Ian Mallett <[EMAIL PROTECTED]> wrote:

I really have no idea what I'm talking about.  :)
If I have separate modules that must use the same set of integers to do
something, (like my solution for wxPython menu bindings), I go like this:
module number + number
  1+1   = 11
  2+52 = 252
  1+31 = 131
...and so on.  This ensures that the bandwidth for each module remains
reserved.  All of the numbers beginning in 1 belong to module 1, like 11,
110, and 1100, all the ones to 2 begin with 2, like 21, 210, and 2100.  You
could add this value to pygame.USEREVENT for each submodule.

I've never used pygame.USEREVENT, so I have no idea what I'm talking about.
This might totally work, or be completely in the wrong direction.  I
apologise in the case of the latter. :)
HTH
Ian
--
There are 10 kinds of people;
those who understand binary and those who don't.
Without order nothing can exist - without chaos nothing can evolve.


Re: [pygame] PGU doesn't work when installed?

2008-03-05 Thread Gary Bishop

Sorry, my fault. Works fine.
gb

Gary Bishop wrote:
Phil's pygame utilities work fine from the current directory but fails 
after python setup.py install. I get:


cannot import name text.

This is python 2.5.1 on Ubuntu.

Is this a known problem?

Thanks
gb


[pygame] PGU doesn't work when installed?

2008-03-05 Thread Gary Bishop
Phil's pygame utilities work fine from the current directory but fails 
after python setup.py install. I get:


cannot import name text.

This is python 2.5.1 on Ubuntu.

Is this a known problem?

Thanks
gb


Re: [pygame] event.wait and userevents

2008-03-04 Thread Gary Bishop

I think the problem is the way you are using it. This works fine for me.

pygame.time.set_timer(pygame.USEREVENT, 1000)

while True:
event = pygame.event.wait()
if event.type == pygame.QUIT:
break
elif event.type == pygame.USEREVENT:
print 'timer'



Christian Reichlin wrote:

hello,

i made a litte app with pygame. i had troubles with the event loop using 
pygame.event.wait and userevents, triggered by 
pygame.time.set_timer(pygame.USEREVENT, 1000)


the following code didn't work. it looks like during pygame.event.wait() 
userevents aren't processed internally. as long as no other event got 
triggered, the loop blocked.

   ...
   for event in [ pygame.event.wait() ] + pygame.event.get( ):
   # event handling code


Re: [pygame] Text To Speech PYTTS

2008-03-03 Thread Gary Bishop
Speaking of "selfish and lazy", changing topics in a thread without 
changing the subject is the worst. Years from now people will be 
searching for Text to Speech PYTTS and get this crap!


Lazily and selfishly yours,
gb

Greg Ewing wrote:

Joe Johnston wrote:
Top posting, also known as "jeopardy posting," has the unfortunate 
consequence of giving the answer before the question is known.


Aaaargh.

Whenever I see a thread about "Top posting or
bottom posting?" it makes me want to shout out
NEITHER!!!

Both of them are a stupid and senseless waste of
bandwidth.

The only sensible quoting method is to quote as
*little* of the original as necessary to establish
context. Anyone who refuses to take the time to
do this is being selfish and lazy.



Re: [pygame] Other Engines

2008-03-01 Thread Gary BIshop

no I haven't looked at it.

FT wrote:

Gary,

NVDA uses a large choice of engines and wondering if you have looked at it?
Gives you choices on what to use.

Bruce




Re: [pygame] Text To Speech PYTTS

2008-03-01 Thread Gary BIshop
Sorry to hear you run Vista. That is probably the root of the problem. I 
have made pyTTS work on Vista back when I had a VM running it but I 
don't now.


I recommend you upgrade to XP. Lots of vendors are offering XP upgrade 
coupons for people who bought Vista.


gb

Ian Mallett wrote:

Vista Home Premium



Re: [pygame] Text To Speech PYTTS

2008-03-01 Thread Gary BIshop
You need the additional voices. XP comes with only MSSam. You can get 
Mary and Mike here: 
http://www.cs.unc.edu/Research/assist/Hark3/SAPI5VoiceInstaller.msi


gb


FT wrote:

Hi!

No, for an error will come up if you use the 4 version for Python 2.5 so
it will not work.

But, having loaded the SAPI5 I can not access the Mary and Mike voices,
even though I used the SAPI installer. So something is going on or they are
not being installed.

Mine does work but only with the Sam voice. Some how they have to be
loaded into the Control panel for speech and how is that done?

For that is the only conclusion if all other things are there and
installed. For the problem you're having seems to be the same but on a
different level. FOr I am given no choice on what speech to install unless
that is done directly from the Windows disk...

Bruce


Ian,

What operating system are you using?

gb

Ian Mallett wrote:

I did that and it still doesn't work.  Must I use
pyTTS-3.0.win32-py2.4.exe-- I have Python
2.5




--
No virus found in this incoming message.
Checked by AVG Free Edition.
Version: 7.5.516 / Virus Database: 269.21.2/1305 - Release Date: 2/29/2008
6:32 PM




Re: [pygame] Text To Speech PYTTS

2008-03-01 Thread Gary BIshop

Ian,

What operating system are you using?

gb

Ian Mallett wrote:

I did that and it still doesn't work.  Must I use
pyTTS-3.0.win32-py2.4.exe-- I have Python
2.5



Re: [pygame] Open Sounds From URL

2008-02-29 Thread Gary BIshop
You don't need StringIO there. It is just converting a string into a 
file object. urllib2.urlopen() returns a file object.


So this will work also:

#! /usr/bin/env python

import urllib2, time
from pygame import mixer
from cStringIO import StringIO

#Read the sound from the url
snd = urllib2.urlopen("http://pymike93.googlepages.com/shoot.wav";)

#Convert to a sound!
mixer.init()
sound = mixer.Sound(snd)
sound.play()

#Pause while you listen to a sound loaded from an online database!
time.sleep(1)


PyMike wrote:

Hey guys! I figured out how to open sounds from urls! Enjoy!

#! /usr/bin/env python

import urllib2, time
from pygame import mixer
from cStringIO import StringIO

#Read the sound from the url
f = urllib2.urlopen("http://pymike93.googlepages.com/shoot.wav";).read()

#Convert to a file
snd = StringIO(f)

#Convert to a sound!
mixer.init()
sound = mixer.Sound(snd)
sound.play()

#Pause while you listen to a sound loaded from an online database!
time.sleep(1)




Re: [pygame] Sound to String

2008-02-28 Thread Gary BIshop
Peter Parente provides some examples of using pyTTS at 
http://www.mindtrove.info/articles/pytts.html. Windows only.


I've got a simple wrapper for the open-source espeak dll. Not documented 
unfortunately. NVDA probably has one also. I've only tested it on linux 
but I bet it works on windows and mac too. Especially if you don't use 
its audio output.


gb

FT wrote:

Hi!

I was also wondering along these lines if anyone knows who has the best 
text to speech documentation? I would like to learn how to use it, and write my 
own talking games.

I am using the windows OS 


Bruce

Subject: Re: [pygame] Sound to String


You can use sndarray to change the sound into an array, then you can recompose 
the sound in your file.  PyDay allows the use of modules in the construction, 
though not in the final product.  In short, you can use Numeric to create the 
data, but you will have to reencode it yourself.






No virus found in this incoming message.
Checked by AVG Free Edition. 
Version: 7.5.516 / Virus Database: 269.21.1/1301 - Release Date: 2/27/2008 8:35 AM




[pygame] Creating unique userevent ids?

2008-02-25 Thread Gary Bishop

I'm gradually building up a small collection of modules that enhance
pygame with new input devices (wiimote, webcam). The modules generate
new events so I've been doing things like pygame.USEREVENT+1. But this
is guaranteed to get me into trouble when using multiple independent
extensions.

Is there some way to assure I've got a unique id? wxPython has NewId for
this purpose.

Thanks
Gary Bishop