MathGroup Archive 2002

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

Search the Archive

Re: Overlapping sounds

  • To: mathgroup at smc.vnet.net
  • Subject: [mg34348] Re: [mg34193] Overlapping sounds
  • From: Omega Consulting <omega_consulting at yahoo.com>
  • Date: Thu, 16 May 2002 05:08:31 -0400 (EDT)
  • Sender: owner-wri-mathgroup at wolfram.com

At 04:15 AM 5/9/2002, Goyder Dr HGD wrote:

>The following plays a swept sine wave repeating it 5 times.
>
>vals = {f0 -> 1000, tt -> 5};
>f = 2  Pi (f0 t - f0 t^2 /(2 tt)) /. vals;
>Do[Play[Sin[f], {t, 0, tt /. vals}], {5}]
>
>
>However, the first four sounds are not completed but are truncated with the
>next repeat starting early.
>Why? How do I get each sound completed before the next starts?
>
>In[16]:=
>$Version[]
>
>Out[16]=
>4.1 for Microsoft Windows (June 13, 2001)[]
>
>Hugh Goyder

The sounds overlay when being generated, but they do not when re-played. So 
we can solve the problem by generating all the sounds silently and then 
playing them as a group.

c = Cell[GraphicsData["PostScript",
       DisplayString[
         Play[Sin[f], {t, 0, tt /. vals}, DisplayFunction -> Identity]]],
     "Graphics"];
Do[NotebookWrite[EvaluationNotebook[], c], {5}];
SelectionMove[EvaluationNotebook[], All, GeneratedCell];
FrontEndExecute[{FrontEndToken["SoundPlay"]}]

--------------------------------------------------------------
Omega Consulting
"The final answer to your Mathematica needs"

Spend less time searching and more time finding.
http://www.wz.com/internet/Mathematica.html



  • Prev by Date: Re: how mathematica deals with complex i in output
  • Next by Date: extracting variable values from built-in function FindMinimum
  • Previous by thread: Overlapping sounds
  • Next by thread: TeX Problems