Alex Holkner wrote:
> On Feb 3, 2008 3:32 AM, Jon <[EMAIL PROTECTED]> wrote:
>> Has anyone successfully created sounds using numpy arrays and deployed
>> them using pyglet media objects. Would be nice to be able to play
>> sounds that were generated natively in the code (simple tones,
>> swishing) without having to create a file for each.
>>
>> Couldn't see a way to interact directly with StaticSound data. Is
>> there any example code out there?
> 
> Have a look at the (undocumented) pyglet.media.procedural module.  It
> shouldn't be much hassle to base a numpy implementation off it.

That's what I've done. The important thing is to return myarray.tostring() from 
_generate_data() rather than a ctypes pointer made from the array. This copies 
a 
few kb of memory each time, but it ensures that the data stays alive by the 
time 
it goes to the driver.

-- 
Robert Kern

"I have come to believe that the whole world is an enigma, a harmless enigma
  that is made terrible by our own mad attempt to interpret it as though it had
  an underlying truth."
   -- Umberto Eco

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"pyglet-users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/pyglet-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to