Re: Play Command Error
- To: mathgroup at smc.vnet.net
- Subject: [mg105647] Re: Play Command Error
- From: BenT <brtubb at pdmusic.org>
- Date: Sun, 13 Dec 2009 05:39:19 -0500 (EST)
- References: <hfnutl$g9e$1@smc.vnet.net> <hfqgpb$oo7$1@smc.vnet.net>
Sorry, I "misplaced" the closing "Evaluate" function bracket (which is
apparently critical <g>! The code should be:
(* start *)
ClearAll["Global`*"]
notes = Table[N[ (440 / 64) * 2^((n + 3) / 12)], {n, 60, 72, 1}];
Sound[
Play[
Evaluate[Sin[# 2 Pi t] & /@ notes], {t,0,.5}]
]
(* end *)
I also corrected an "initialization" error with "bf" in the other code
shown:
(* start *)
(* 7-Note Tuning Systems *)
Manipulate[
scale = {0, s2, s3, s4, s5, s6, s7, 1200};
cents[x_] := N[bf 2^(x/1200)];
freq = cents[#] & /@ scale;
Sound[
Play[
Evaluate[Sin[# 2 Pi t]], {t, 0, .5}] & /@ freq],
{{bf, 440, "Base Frequency"}, 27.5, 6017, Appearance -> "Labeled"},
{{s2, 200}, 2, s3 - 2, Appearance -> "Labeled"},
{{s3, 400}, s2 + 2, s4 - 2, Appearance -> "Labeled"},
{{s4, 500}, s3 + 2, s5 - 2, Appearance -> "Labeled"},
{{s5, 700}, s4 + 2, s6 - 2, Appearance -> "Labeled"},
{{s6, 900}, s5 + 2, s7 - 2, Appearance -> "Labeled"},
{{s7, 1100}, s6 + 2, 1198, Appearance -> "Labeled"},
Initialization :>
{SetOptions[Play, SampleDepth -> 16, SampleRate -> 44100],
SetOptions[Sound, SoundVolume -> .5]
}]
(* end *)
--- Benjamin Tubb