MathGroup Archive 2005

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Play restarting to early

  • To: mathgroup at smc.vnet.net
  • Subject: [mg53259] Re: Play restarting to early
  • From: David Bailey <dave at Remove_Thisdbailey.co.uk>
  • Date: Mon, 3 Jan 2005 04:29:35 -0500 (EST)
  • References: <cr8e56$r6k$1@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

Erich Neuwirth wrote:
> I have a problem with Play:
> Map[Play[Sin[#*2*Pi*t], {t, 0, 1}] &, {440, 550}]
> does not wait with playing the second sound
> until the first oen has finished playing.
> Is there a canonical way of havin Mathematica waiting
> to redner the second sound until the first one has finished playing?
> 
Hi,

You need to get the two sounds fused together into one larger sound 
before it goes to the frontend. For example:

s=Map[Play[Sin[#*2*Pi*t],{t,0,1},DisplayFunction\[Rule]Identity]&,{440,550}]

Sound@(s/.Sound[x_]->x)//Show

BTW, if you want to get decent quality sound out of Mathematica, you 
should use the SampleDepth option and possibly SampleRate option to more 
realistic values, and if you have sounds of varying intensity (which you 
don't in your example), you really need to set a PlayRange, otherwise 
Mathematica sets the gain so that the loud parts overload! It is amazing 
what a difference that makes - the defaults were appropriate about 15 
years ago!

David Bailey
dbaileyconsultancy.co.uk


  • Prev by Date: Re: Thread
  • Next by Date: Re: How to draw a trajectory in DensityPlot&#65311;
  • Previous by thread: Re: Play restarting to early
  • Next by thread: For to Map to Increase Speed