MathGroup Archive 2010

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

Search the Archive

Using MapAt with Play

  • To: mathgroup at smc.vnet.net
  • Subject: [mg113837] Using MapAt with Play
  • From: BenT <brtubb at pdmusic.org>
  • Date: Mon, 15 Nov 2010 05:50:02 -0500 (EST)

Using Mathematica 7, please consider this code:

Play[{Sin[440 t 2 Pi], Sin[441 t 2 Pi]}, {t, 0, 1},
 SampleRate -> 44100, SampleDepth -> 16]

which works as intended.

But now attempting to use the MapAt function,

p = {440, 550, 660, 770, 880};
Play[{Sin[# t 2 Pi], Sin[(# + 1) t 2 Pi] &} /@ p, {t, 0, 1},
 SampleRate -> 44100, SampleDepth -> 16]

I get the following error coding:

During evaluation of In[28]:= Sound::ssnm: A good PlayRange could not
be found since most of the samples are not evaluating to machine-size
real numbers. >>

Out[28]= Sound[
 SampledSoundFunction[
  Function[{Play`Time37},
   Block[{t =
      0. + 0.0000226757 Play`Time37}, ({Sin[#1 t 2 \[Pi]],
         Sin[(#1 + 1) t 2 \[Pi]] &} /@ p + 0.) 1.]],
  44100, {44100, 16}]]

Can anyone tell me how to "correct" the problem? The intent is to
"automate" the playback of several "paired" pitches.



  • Prev by Date: Simplification question in Mathematica 7
  • Next by Date: Re: Plotting functions and lines on the same figure?
  • Previous by thread: Re: Simplification question in Mathematica 7
  • Next by thread: Re: Using MapAt with Play