Chapter9 Namespace Reference


Functions

Void C090400 ()
Void C090703 ()
Void C090703a ()
Void C090703b ()
Void C090703c ()
Void C090903 ()
Void C091101 ()
Void C091102 ()
Void C091200 ()
Void C091201 ()
Void C091201a ()
Void C091201b ()
Void C091201c ()
Void C091201d ()
Void C091201e ()
Void C091201f ()
Void C091204 ()
Void C091204a ()
Void C091204b ()
Void C091204d ()
Void C091405 ()
Void C091406 ()
Void C091406a ()
Void C091406b ()
Void C091406c ()
Void C091704b ()
Void C091704c ()
Void C091704d ()
Static Void para1 ()
Static Void para2 ()
Static Void para3 ()
Integer LCRandom ()
Real Random (Real L=0.0, Real U=1.0)
Integer Random (Integer L, Integer U)
Integer interpTendency (Real f, IntegerList L1, Integer Reference pos1, IntegerList L2, Integer Reference pos2, Integer inc)
RealList Reference accumulate (RealList Reference L)
IntegerList invert (IntegerList)
IntegerList transpose (IntegerList, Integer)
Void rotate (IntegerList Reference, Integer, Integer)
IntegerList randomRow (Integer)
Integer cycle (IntegerList, Integer Reference, Integer)
Integer getIndex (RealList, Real)
RealList normalize (RealList L, Real s)
Void realToRational (Real f, Integer Reference num, Integer Reference den)
Real sum (RealList L)

Variables

Integer x
RealList f


Function Documentation

Void Chapter9::C090400 (  ) 

Void Chapter9::C090703 (  ) 

Void Chapter9::C090703a (  ) 

Void Chapter9::C090703b (  ) 

Void Chapter9::C090703c (  ) 

Void Chapter9::C090903 (  ) 

Void Chapter9::C091101 (  ) 

Void Chapter9::C091102 (  ) 

Void Chapter9::C091200 (  ) 

Void Chapter9::C091201 (  ) 

Void Chapter9::C091201a (  ) 

Void Chapter9::C091201b (  ) 

Void Chapter9::C091201c (  ) 

Void Chapter9::C091201d (  ) 

Void Chapter9::C091201e (  ) 

Void Chapter9::C091201f (  ) 

Void Chapter9::C091204 (  ) 

Void Chapter9::C091204a (  ) 

Void Chapter9::C091204b (  ) 

Void Chapter9::C091204d (  ) 

Void Chapter9::C091405 (  ) 

Void Chapter9::C091406 (  ) 

Void Chapter9::C091406a (  ) 

Void Chapter9::C091406b (  ) 

Void Chapter9::C091406c (  ) 

Void Chapter9::C091704b (  ) 

Void Chapter9::C091704c (  ) 

Void Chapter9::C091704d (  ) 

Static Void Chapter9::para1 (  ) 

Definition at line 19 of file C090400.cpp.

References n(), Random(), and VossFracRand().

00019                     {
00020 /*****************************************************************************
00021 See "Musimathics" section B.2.1 for a description of PitchList. 
00022 Then we need a source of judgment for which of Guido’s three vowel sequences 
00023 should be chosen. We’ll use the integer Random( ) method to generate random values. 
00024 Combining these, we obtain the program for Guido’s method:
00025 *****************************************************************************/
00026 }

Static Void Chapter9::para2 (  ) 

Definition at line 51 of file C090400.cpp.

References f, guido(), and sum().

00051                     {
00052 /*****************************************************************************
00053 The program indexes one Character at a time of text. 
00054 If Character c is a vowel, it calculates offset based on which vowel it is. 
00055 If it is not a vowel, the program sets offset to –1 so that the final step is skipped. 
00056 If it is a vowel, the program chooses a random number 0, 1, or 2, corresponding to the 
00057 three possible outcomes for each vowel. This is multiplied by 5, corresponding to the
00058 number of vowels, and added to offset to arrive at the index of the selected element in 
00059 the list of guidoPitches. The selected Character from that list is then stored in PitchList G. 
00060 The method is repeated until text is exhausted. PitchList G then contains the list of pitches 
00061 composed for this text. As its final action, the PitchList G is returned to the calling program.
00062 To invoke the function guido(), we need a Latin text. I’ll use the first phrase of the text 
00063 Guido used to name the solfeggio syllables, the medieval hymn Sanctus Joharines (St. John). 
00064 This program fragment prints the pitches for a plain chant melody based on the text:
00065 *****************************************************************************/
00066 
00067 Print("*** Guidonian melody for the text: Ut queant laxis resonare ***");
00068 Print(guido("Ut queant laxis resonare"));
00069 
00070 /*****************************************************************************
00071 An example result of this method is shown in "Musimathics" V1, figure 9.3.
00072 *****************************************************************************/                                                                                  
00073 }}

Static Void Chapter9::para3 (  ) 

Definition at line 90 of file C091101.cpp.

References f, retrograde(), sum(), and x.

00090                     {
00091 /*****************************************************************************
00092 Here is an example of retrograding a list:
00093 *****************************************************************************/
00094                 Print("*** Retrograding a list ***");
00095                 IntegerList L( 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11 );
00096                 Print("Original row:", L);
00097                 Print( "Retrograded row:", retrograde(L) );
00098 
00099 }}

Integer Chapter9::LCRandom (  ) 

Definition at line 53 of file C090703.cpp.

References a, b, c, and x.

00053                   {
00054         x = Mod(a * x + b, c);                  // update x based on its previous value
00055         Integer r = x;                                  // x may be positive or negative
00056         If (r < 0)                                              // force the result to be positive
00057                 r = -r;
00058         Return(r);
00059 }

Real Chapter9::Random ( Real  L = 0.0,
Real  U = 1.0 
)

Definition at line 15 of file C090703b.cpp.

References c, and LCRandom().

00015                             {
00016         Integer i = LCRandom();                 // get a random integer value
00017         Real r = Real(i);                               // convert it to a real value
00018         r = r/Real(c);                                  // scale it to 0.0 <= r < 1.0
00019         Return(r * (U - L) + L);                // scale it to the range L to U
00020 }

Integer Chapter9::Random ( Integer  L,
Integer  U 
)

Definition at line 33 of file C090703c.cpp.

References Random(), and x.

00033                                      {
00034         Real rL = L;                                                    // convert L to Real
00035         Real rU = U + 1.0;                                              // convert U to Real, add 1.0
00036         Real x = Random(rL, rU);                                // get a real random value
00037         Return( Integer(x));                                    // return it as an integer
00038 }

Integer Chapter9::interpTendency ( Real  f,
IntegerList  L1,
Integer Reference  pos1,
IntegerList  L2,
Integer Reference  pos2,
Integer  inc 
)

Definition at line 55 of file C091201e.cpp.

References cycle(), unitInterp(), and x.

00060   {
00061         Integer x = cycle(L1, pos1, inc);
00062         Integer y = cycle(L2, pos2, inc);
00063         Return(Integer(Round(unitInterp(f, x, y))));
00064 }

RealList Reference Chapter9::accumulate ( RealList Reference  L  ) 

Definition at line 16 of file C091406a.cpp.

00016                                                    {
00017         For(Integer i = 1; i < Length(L); i = i + 1){
00018                  L[i] = L[i] + L[i - 1];
00019         }
00020         Return(L);
00021 }

IntegerList Chapter9::invert ( IntegerList   ) 

Definition at line 62 of file C091101.cpp.

00062                                   {
00063         For(Integer i = 0; i < Length(L); i = i + 1)
00064                 L[i] = Mod(12 - L[i], 12);
00065         Return(L);
00066 }

IntegerList Chapter9::transpose ( IntegerList  ,
Integer   
)

Definition at line 41 of file C091101.cpp.

00041                                                 {
00042         For(Integer i = 0; i < Length(L); i = i + 1)
00043                  L[i] = PosMod(L[i] + t, 12); // BUG: given as Mod() in "Musimat", s.b. PosMod()
00044         Return(L);
00045 }

Void Chapter9::rotate ( IntegerList  Reference,
Integer  ,
Integer   
)

Definition at line 19 of file C090903.cpp.

References rotate(), and x.

00019                                                               {
00020         n = Mod(n, Length(f));                                          //constrain rotation to length of list
00021         Integer x = f[i];                                                       //store f[i] for use after recursion
00022         If(i < Length(f)-1)                                                     // reached the end?
00023                 rotate(f, n, i+1);                                              // no, call rotate() recursively
00024         // continue from here when the recursion unwinds
00025         Integer pos = PosMod(i+n, Length(f));           // index list modulo its length
00026         f[pos] = x;                                                                     // assign value of x saved above
00027 }

IntegerList Chapter9::randomRow ( Integer   ) 

Definition at line 20 of file C091204a.cpp.

References Random(), and x.

00020                                  {
00021         IntegerList L;                                          // keep track of pitches chosen so far
00022         IntegerList M;                                          // used to build up random 12-tone row
00023         Integer i;
00024         
00025         // set all list elements to zero, which means "unused"
00026         For (i = 0; i < N; i = i + 1) {L[i] = 0;}
00027 
00028         // build up M, marking off elements in L when they are chosen
00029         i = 0;
00030         While (i < N) {
00031                 Integer x = Random(0, N - 1);           // returns integer random value
00032                 If (L[x] == 0) {                                        // hasn’t been chosen yet?
00033                          L[x] = 1;                                              // mark it "used"
00034                          M[i] = x;                                              // save result
00035                          i = i + 1;                                     // increment control variable
00036                 }
00037         }
00038         Return(M);
00039 }

Integer Chapter9::cycle ( IntegerList  ,
Integer  Reference,
Integer   
)

Definition at line 31 of file C091201a.cpp.

00031                                                                  {
00032         Integer i = PosMod(pos, Length(L)); // compute current index
00033         pos = PosMod(pos + inc, Length(L)); // compute index for next time
00034         Return(L[i]);
00035 }

Integer Chapter9::getIndex ( RealList  ,
Real   
)

Definition at line 15 of file C091406b.cpp.

00015                                     {
00016         Integer i;
00017         For (i = Length(L) - 1; i >= 0; i = i - 1){
00018                 If (R > L[i]){
00019                         Return(i + 1);
00020                 }
00021         }
00022         Return( 0 );
00023 }

RealList Chapter9::normalize ( RealList  L,
Real  s 
)

Definition at line 60 of file C091406.cpp.

00060                                               {
00061                 For (Integer i = 0; i < Length(L); i = i + 1){
00062                         L[i] = L[i]/s;
00063                 }
00064                 Return(L);
00065         }

Void Chapter9::realToRational ( Real  f,
Integer Reference  num,
Integer Reference  den 
)

Real Chapter9::sum ( RealList  L  ) 

Definition at line 38 of file C091406.cpp.

00038                              {
00039                 Real s = 0.0;
00040                 For (Integer i = 0; i < Length(L); i = i + 1) {
00041                         s = s + L[i];
00042                 }
00043                 Return(s);
00044         }


Variable Documentation

Integer Chapter9::x

Definition at line 51 of file C090703.cpp.

RealList Chapter9::f


Generated on Fri Sep 8 23:52:57 2006 for Musimat Chapter 9 Code Examples by  doxygen 1.4.7