> f = open("shoot.wav")
Windows! Binary file! Opened in text mode!
Could this be what is causing you problems?
--
Greg
Yes! It works! Thanks so much guys! You all have been really helpful.
On Fri, Feb 29, 2008 at 3:58 PM, Douglas Bagnall <[EMAIL PROTECTED]>
wrote:
> Alistair Buxton wrote:
>
> > On windows, you must open binary files as binary: f = open("sound.wav",
> "rb")
> >
> > If you don't do this, windows wi
Alistair Buxton wrote:
> On windows, you must open binary files as binary: f = open("sound.wav", "rb")
>
> If you don't do this, windows will truncate the file and give no
> error, though it will work on linux.
>
Aha! Pay attention, Mike. This is your problem.
The attached script worksforme.
On windows, you must open binary files as binary: f = open("sound.wav", "rb")
If you don't do this, windows will truncate the file and give no
error, though it will work on linux.
On 29/02/2008, PyMike <[EMAIL PROTECTED]> wrote:
> I tried some others and still get the same error. (error: Unrecogn
I tried some others and still get the same error. (error: Unrecognized sound
file type)
On Fri, Feb 29, 2008 at 8:00 AM, PyMike <[EMAIL PROTECTED]> wrote:
> Hi Douglas
>
> Just to let you know, my sound will load and play with pygame without the
> string compression. It's a mere 0.18 seconds long
Hi Douglas
Just to let you know, my sound will load and play with pygame without the
string compression. It's a mere 0.18 seconds long. I tried some other sounds
that were short and I got ~around~ the same results.
After editing sound2.py,
"RIFF\x16\xe9\x00\x00WAVEfmt
\x10\x00\x00\x00\x01\x00\x0
hi Mike
This is your main problem:
>> print len(s)
>>
>> 217
Your wave file is broken. In 16 bit mono, 217 bytes leaves room for 94
samples when you take away the headers. That's about 1/500 of a second
at 44.1 kHz. Your sound is not actually that short: the file is broken.
Then later you wrot
f = open("shoot.wav")
s = f.read()
f.close()
print len(s)
print len(repr(s))
print len(eval(repr(s)))
b64 = binascii.b2a_base64(snd)
f = open("sound2.py", "wr").write(str(repr(b64)))
snd = binascii.a2b_base64(b64)
f = open("sound2.py", "wr").write(str(repr(snd)))
snd = open("sound2.py", "rb").re
f = open("shoot.wav")
s = f.read()
f.close()
print len(s)
print len(repr(s))
print len(eval(repr(s)))
217
675
217
On Thu, Feb 28, 2008 at 7:11 PM, Douglas Bagnall <[EMAIL PROTECTED]>
wrote:
> PyMike wrote:
>
> > After doing that, this is the output:
> >
> > snd = 'RIFFZB\x00\x00WAVEfmt
> >
> \x1
PyMike wrote:
> After doing that, this is the output:
>
> snd = 'RIFFZB\x00\x00WAVEfmt
> \x10\x00\x00\x00\x01\x00\x01\x00D\xac\x00\x00\x88X\x01\x00\x02\x00\x10\x00data6B\x00\x00y\x18\x90\x17\xaf\x16\xd7\x15\x07\x15>\x14}\x13\xc3\x12\x10\x12d\x11\xbe\x10\x1f\x10\x85\x0f\xf1\x0ec\x0e\xd9\rU\r\xd6\x
After doing that, this is the output:
snd = 'RIFFZB\x00\x00WAVEfmt
\x10\x00\x00\x00\x01\x00\x01\x00D\xac\x00\x00\x88X\x01\x00\x02\x00\x10\x00data6B\x00\x00y\x18\x90\x17\xaf\x16\xd7\x15\x07\x15>\x14}\x13\xc3\x12\x10\x12d\x11\xbe\x10\x1f\x10\x85\x0f\xf1\x0ec\x0e\xd9\rU\r\xd6\x0c\\\x0c\xe6\x0bu\x0b\x
PyMike wrote:
>
> I tried that out, and it got close to working. But I get an "unrecognized
> file-type"' error
> Code is below. What did I do wrong?
>
> f = open("shoot.wav")
> s = f.read()
> snd = repr(s)
> print snd
Sorry, I wasn't clear. You don't need to repr() the string if you are
usin
Douglas:
I tried that out, and it got close to working. But I get an "unrecognized
file-type"' error
Code is below. What did I do wrong?
f = open("shoot.wav")
s = f.read()
snd = repr(s)
print snd
from cStringIO import StringIO
wav = StringIO(snd)
from pygame import mixer
mixer.init()
sound = mi
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
Bruce
- Original Message -
From: "Laura Creighton" <[EMAIL PROTECTED]>
Sent: Thursday, February 28, 2008 5:38 AM
Subject: Re: [pygame] Sound to String
In a message of Thu, 28 Feb 2008 04:25:53 CST, Luke Paireepinart writes:
>Ian Mallett wrote:
>> You could always rec
PyMike wrote:
> Hey! I've been trying to convert my sounds to strings so I can include them
> all in one python file. Can anyone help me?
>
>>> f = open("some_short_sound.wav")
>>> s = f.read()
The string will look something like this:
>>> s[:50]
('RIFF\xa27\x00\x00WAVEfmt \x10\x00\x00\x00\x0
The University of North Carolina wrote one.
http://www.cs.unc.edu/Research/assist/doc/pytts/
Jeez, those guys do everything.
I need to apply there.
In a message of Thu, 28 Feb 2008 04:25:53 CST, Luke Paireepinart writes:
>Ian Mallett wrote:
>> You could always record the sound you want to play, but actually
>> rendering sound from text might be difficult. If anyone knows, I'd
>> like to know too.
>Rendering sound is a pretty common operatio
Ian Mallett wrote:
You could always record the sound you want to play, but actually
rendering sound from text might be difficult. If anyone knows, I'd
like to know too.
Rendering sound is a pretty common operation called Text-to-Speech. I'm
sure you could find an open-source C library for thi
You could always record the sound you want to play, but actually rendering
sound from text might be difficult. If anyone knows, I'd like to know too.
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
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.
Hey! I've been trying to convert my sounds to strings so I can include them
all in one python file. Can anyone help me?
--
- PyMike
23 matches
Mail list logo