On Jan 7, 2008 3:43 PM, Mike Lawrence <[EMAIL PROTECTED]> wrote:
>
> Hi all,
>
> Is there any way to combine two audio waveforms into one audio data
> object? For instance
>
> import pyglet, pyglet.media, pyglet.media.procedural
>
> low = pyglet.media.StaticSource(pyglet.media.procedural.Sine(1,300))
> high = pyglet.media.StaticSource(pyglet.media.procedural.Sine(1,500))
>
> both = some_magic_function(low,high)
> both.play() #plays the combined 300Hz+500Hz waveform
>
> Any help would be greatly appreciated!

The "magic" function just needs to add the sample data, saturating at
the +/- limits.  pyglet doesn't expose the sample data in a useful
format, but if you dig around the media sources you'll see that sample
data is generally just a string of bytes or ctypes array.

You can achieve the same outcome by playing the two sources
simultaneously -- this has the added bonus that pyglet will use
hardware audio mixing where possible.

Alex.

--~--~---------~--~----~------------~-------~--~----~
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