Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Animation with Sound in Mathematica?

212 views
Skip to first unread message

BenT

unread,
Dec 12, 2009, 6:56:03 AM12/12/09
to
Can anyone give an example of a true multimedia-like "music video"
created exclusively in Mathematica 7?

I have not worked with animation very often, and although I understand
how to use the related functions, I haven't found a way to "sync" them
to a/an audio (Play or SoundNote generated) track(s). An example of
how to do so would be very welcomed!

--- Benjamin Tubb

Helen Read

unread,
Dec 13, 2009, 4:48:13 AM12/13/09
to

I'd like to know how to do that too. In previous versions of
Mathematica, you could combine graphics and sounds with Show, but in
Mathematica 7, Show seems only to like graphics objects.

You can simply play the sounds at the same time the animation runs,
however, like this.

ding = SoundNote["F", 1, "Tinklebell"];
soundeffects :=
EmitSound[
Sound[{Table[
SoundNote[m, 1, "Goblins"], {m,
RealDigits[N[\[Pi], 10], 10][[1]]}],
SoundNote[RealDigits[N[\[Pi], 15], 15][[1]], 10, "Sweep"],
ding}]];
animation =
Animate[Plot[{a Sin[b x], -a Sin[1/b x]}, {x, 0, 2 \[Pi]},
PlotRange -> {-5, 5}, PlotStyle -> Thick,
ColorFunction -> Function[{x, y}, ColorData["Rainbow"][y]],
Axes -> False, PerformanceGoal -> "Quality"], {a, -5, 5}, {b, .1,
10}, AnimationDirection -> ForwardBackward,
AnimationRepetitions -> 2];
Evaluate[soundeffects];
animation


--
Helen Read
University of Vermont

BenT

unread,
Dec 15, 2009, 7:27:47 AM12/15/09
to

Thank you very much! That is an excellent educational "code" example
of how to integrate sound and video, although neither the music nor
video of your example are what I have in mind <G>.

--- Benjamin Tubb


> I'd like to know how to do that too. In previous versions of
> Mathematica, you could combine graphics and sounds with Show, but in
> Mathematica 7, Show seems only to like graphics objects.
>
> You can simply play the sounds at the same time the animation runs,
> however, like this.
>
> ding = SoundNote["F", 1, "Tinklebell"];
> soundeffects :=
> EmitSound[
> Sound[{Table[
> SoundNote[m, 1, "Goblins"], {m,
> RealDigits[N[\[Pi], 10], 10][[1]]}],
> SoundNote[RealDigits[N[\[Pi], 15], 15][[1]], 10, "Sweep"],
> ding}]];
> animation =
> Animate[Plot[{a Sin[b x], -a Sin[1/b x]}, {x, 0, 2 \[Pi]},
> PlotRange -> {-5, 5}, PlotStyle -> Thick,
> ColorFunction -> Function[{x, y}, ColorData["Rainbow"][y]],

> Axes -> False, PerformanceGoal -> "Quality"], {a, -5, 5}, {b, =

Helen Read

unread,
Dec 16, 2009, 6:19:09 AM12/16/09
to
On 12/15/2009 7:27 AM, BenT wrote:
> Thank you very much! That is an excellent educational "code" example
> of how to integrate sound and video, although neither the music nor
> video of your example are what I have in mind<G>.

No, I didn't think my example would be what you have in mind :-). It's
taken from some code I wrote for what is probably the most frivolous use
of Mathematica ever, a little something I call the Pie Machine.

http://www.vermonthorns.org/daveorama/pies/report2009/

Check out the "Video of the Pie Machine Festivities" to see it in
action. 90% of the code (which I stuck in a package) is I/O, and the
rest makes heavy use of RandomChoice.

The really sad thing is, when Mathematica 7 was released, the very first
thing of thought of was using the new speech output for the Pie Machine!

Michael Greene

unread,
Dec 16, 2009, 6:20:04 AM12/16/09
to
You might want to look at the source for
http://demonstrations.wolfram.com/EquationOfALineGame/

<http://demonstrations.wolfram.com/EquationOfALineGame/>Sergio Mejia
demonstrates a very clever trick of using a cellular automation as a note
source. It's not synchronized precisely with the other code which is what I
thought you were asking for but it may give you some additional ideas.

Michael

On Tue, Dec 15, 2009 at 4:28 AM, BenT <brt...@pdmusic.org> wrote:

>
> Thank you very much! That is an excellent educational "code" example
> of how to integrate sound and video, although neither the music nor
> video of your example are what I have in mind <G>.
>

> --- Benjamin Tubb


>
>
> > I'd like to know how to do that too. In previous versions of
> > Mathematica, you could combine graphics and sounds with Show, but in
> > Mathematica 7, Show seems only to like graphics objects.
> >
> > You can simply play the sounds at the same time the animation runs,
> > however, like this.
> >
> > ding = SoundNote["F", 1, "Tinklebell"];
> > soundeffects :=
> > EmitSound[
> > Sound[{Table[
> > SoundNote[m, 1, "Goblins"], {m,
> > RealDigits[N[\[Pi], 10], 10][[1]]}],
> > SoundNote[RealDigits[N[\[Pi], 15], 15][[1]], 10, "Sweep"],
> > ding}]];
> > animation =
> > Animate[Plot[{a Sin[b x], -a Sin[1/b x]}, {x, 0, 2 \[Pi]},
> > PlotRange -> {-5, 5}, PlotStyle -> Thick,
> > ColorFunction -> Function[{x, y}, ColorData["Rainbow"][y]],

> > Axes -> False, PerformanceGoal -> "Quality"], {a, -5, 5}, {b, =


> .1,
> > 10}, AnimationDirection -> ForwardBackward,
> > AnimationRepetitions -> 2];
> > Evaluate[soundeffects];
> > animation
> >
> > --
> > Helen Read
> > University of Vermont
>
>
>


--
Michael Greene - Programmer Analyst
Information Systems, mgr...@csumb.edu
California State University, Monterey Bay
Corporation Bldg - RM 201 - 100 Campus Center, Seaside, CA 93955-8001
831.582.3567 Fax 831.582.4796


0 new messages