Defines | Functions

/Users/garethloy/Musimathics/Musimat1.2/MusimatChapter9/MusimatChapter9.h File Reference

#include "Musimat.h"
#include "Pitches.h"

Go to the source code of this file.

Defines

#define MusimatChapter9Section(x)   Void x()

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 ()
IntegerList transpose (IntegerList, Integer)
IntegerList invert (IntegerList)
Integer getIndex (RealList, Real)
Void rotate (IntegerList Reference, Integer, Integer)
Integer cycle (IntegerList, Integer Reference, Integer)
Real sum (RealList L)
RealList Reference accumulate (RealList Reference L)
IntegerList randomRow (Integer)
RealList normalize (RealList L, Real s)
Void realToRational (Real f, Integer Reference num, Integer Reference den)
Static Void para1 ()
Static Void para2 ()
Static Void para3 ()

Define Documentation

#define MusimatChapter9Section (   x )    Void x()

Definition at line 65 of file MusimatChapter9.h.


Function Documentation

RealList Reference accumulate ( RealList Reference  L )

Definition at line 16 of file C091406a.cpp.

                                                   {
        For(Integer i = 1; i < Length(L); i = i + 1) {
                L[i] = L[i] + L[i - 1];
        }
        Return(L);
}
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 (  )
Integer cycle ( IntegerList  ,
Integer  Reference,
Integer   
)

Definition at line 31 of file C091201a.cpp.

                                                                 {
        Integer i = PosMod(pos, Length(L)); // compute current index
        pos = PosMod(pos + inc, Length(L)); // compute index for next time
        Return(L[i]);
}
Integer getIndex ( RealList  ,
Real   
)

Definition at line 16 of file C091406b.cpp.

                                    {
        Integer i;
        For (i = Length(L) - 1; i >= 0; i = i - 1) {
                If (R > L[i]) {
                        Return(i + 1);
                }
        }
        Return( 0 );
}
IntegerList invert ( IntegerList   )

Definition at line 63 of file C091101.cpp.

                                  {
        For(Integer i = 0; i < Length(L); i = i + 1) {
                L[i] = Mod(12 - L[i], 12);
        }
        Return(L);
}
RealList normalize ( RealList  L,
Real  s 
)

Definition at line 60 of file C091406.cpp.

                                      {
        For (Integer i = 0; i < Length(L); i = i + 1) {
                L[i] = L[i]/s;
        }
        Return(L);
}
Static Void para1 (  )

Definition at line 19 of file C090400.cpp.

References a(), b(), brownian(), c(), cycle(), d(), f(), getIndex(), lcRandom(), linearInterpolate(), luRandom(), n(), palindrome(), permute(), PlotPoint(), randomMelody(), randomRow(), randTendency(), rotate(), seedRandom(), transpose(), and VossFracRand().

                    {
        /*****************************************************************************
         See "Musimathics" section B.2.1 for a description of PitchList. 
         Then we need a source of judgment for which of Guido's three vowel sequences 
         should be chosen. We'll use the integer Random( ) method to generate random values. 
         Combining these, we obtain the program for Guido's method. Here is the
         version from Musimathics:
         *****************************************************************************/
}
Static Void para2 (  )

Definition at line 83 of file C090400.cpp.

References accumulate(), f(), generateSetComplex(), getIndex(), guido(), interpTendency(), invert(), iRandom(), n(), normalize(), shuffle(), stretch(), and sum().

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

Definition at line 93 of file C091101.cpp.

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

                    {
        /*****************************************************************************
         Here is an example of retrograding a list:
         *****************************************************************************/
        Print("*** Retrograding a list ***");
        IntegerList L( 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11 );
        Print("Original row:", L);
        Print( "Retrograded row:", retrograde(L) );
        
}
IntegerList randomRow ( Integer   )

Definition at line 20 of file C091204a.cpp.

                                 {
        IntegerList L;                                          // keep track of pitches chosen so far
        IntegerList M;                                          // used to build up random 12-tone row
        Integer i;
        
        // set all list elements to zero, which means "unused"
        For (i = 0; i < N; i = i + 1) {
                L[i] = 0;
        }
        
        // build up M, marking off elements in L when they are chosen
        i = 0;
        While (i < N) {
                Integer x = Random(0, N - 1);           // returns integer random value
                If (L[x] == 0) {                                        // hasn't been chosen yet?
                        L[x] = 1;                                               // mark it "used"
                        M[i] = x;                                               // save result
                        i = i + 1;                                      // increment control variable
                }
        }
        Return(M);
}
Void realToRational ( Real  f,
Integer Reference  num,
Integer Reference  den 
)
Void rotate ( IntegerList  Reference,
Integer  ,
Integer   
)

Definition at line 19 of file C090903.cpp.

References rotate().

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

Definition at line 38 of file C091406.cpp.

                     {
        Real s = 0.0;
        For (Integer i = 0; i < Length(L); i = i + 1) {
                s = s + L[i];
        }
        Return(s);
}
IntegerList transpose ( IntegerList  ,
Integer   
)

Definition at line 41 of file C091101.cpp.

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