about musical functions
- To: mathgroup at smc.vnet.net
- Subject: [mg20070] about musical functions
- From: "Postman" <cmannu at eternite.com>
- Date: Wed, 29 Sep 1999 03:33:27 -0400
- Organization: CompuServe Interactive Services
- Sender: owner-wri-mathgroup at wolfram.com
Hi all,
I'm using Mathematica 3, and trying to play songs simultaneously.
I've read the composer's guide which is really good, but i don't find it
clear enough to make a function such as the one for scales (on part 7)...
I wanted mainly to play "accords", two different notes from a given scale in
a same time.
Scale is given in cents such as :
MeanChromatic = {0,76,193.2,310.3,386.3,503.4,579.5,
696.6,772.6,889.7,1006.8,1082.9,1200}
and i want to play 76 and 772.6 in the same time....
The function :
PlayScale[scaleType_,startingFreq_,totalDuration_] :=
Module[{scaleList,noteDuration},
scaleList =
Map[(N[startingFreq * 10^(#/(1200/Log[10,2]))])&,
scaleType];
noteDuration = Length[scaleList]/totalDuration;
Play[
Sin[ 2 Pi t scaleList[[ 1+Floor[t * noteDuration] ]] ],
{t,0,totalDuration-.000001}]
];
Many thanks.