> You can achieve the same outcome by playing the two sources
> simultaneously

Maybe a little more background would clarify my problem. I'll actually
be looking to play a dozen or so pure tones continuously for an
unspecified amount of time, then as quickly as possible turn them all
off and turn on another set of a dozen or so pure tones that again
play continuously for an unspecified amount of time. I can see that
for each tone I can set up a player, cue the tone, and set eos_action
for that player to 'loop', then once all the players are initialized,
tell each to play, but it strikes me that with increasing numbers of
players I'll soon be able to notice the difference in start time
between the first tone and the last tone, and a similar differences
during the transition to the second set of tones. I was hoping that by
simply getting the aggregate waveforms I would only have to deal with
2 players, one for each tone set.

On Jan 7, 12:50 am, "Alex Holkner" <[EMAIL PROTECTED]> wrote:
> 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