MathGroup Archive 2003

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

Search the Archive

Re: music with Mathematica

  • To: mathgroup at smc.vnet.net
  • Subject: [mg40667] Re: music with Mathematica
  • From: wself at msubillings.edu (Will Self)
  • Date: Sat, 12 Apr 2003 03:13:23 -0400 (EDT)
  • References: <b738mj$nuh$1@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

ibid.hagnoi at free.fr (Jul) wrote in message news:<b738mj$nuh$1 at smc.vnet.net>...
> Hi !
> I have to write a song with the Mathematica software and I encounter a
> few difficulties to do it since I've just discovered it. Do you have
> any idea or piece of advice ? (especially regarding the rythm
> structure). A pretty good thing would be to have an example of such a
> work.
> 
> Thank you for your time.
> 
> 
> Jul

Mathematica sends the output from Play to PostScript as well as to the
sound generator -- an unfortunate design decision, in my opinion. 
Maybe someone knows how to get around that, but I don't.

Look under Play in the Help menu; there is a package on Audio and one
on Music; one of these may be some help.

Make a list of the notes that you want and then use Show to play them.
 Whatever you do, expect it to sound awful.

wav[t_] := Sin[2. Pi t] - Sin[10. Pi t] + .5 Sin[18. Pi t];
(* Put in some harmonics *)
c = Play[ wav[262. s], {s, 0., .2}];
d = Play[ wav[294. s], {s, 0., .2}];
e = Play[ wav[330. s], {s, 0., .2}];
f = Play[ wav[349. s], {s, 0., .2}];
g = Play[ wav[392. s], {s, 0., .2}];
a = Play[ wav[440. s], {s, 0., .2}];
r = Play[ 0, {s, 0., .2}];

twinkle = {c, r, c, r, g, r, g, r, a, r, a, r, g, r, r, r,
    f, r, f, r, e, r, e, r, d, r, d, r, c}

Show[twinkle]

This may be an opportunity to branch out into 12-tone serial
minimalism :-)


  • Prev by Date: NDAESolve
  • Next by Date: Re: Re: Adding elements of a matrix
  • Previous by thread: Re: music with Mathematica
  • Next by thread: Assign values to characters gen by "FromCharacterCode"