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 |
| RealList Reference Chapter9::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 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 | ( | ) |
| Integer Chapter9::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 Chapter9::getIndex | ( | RealList | , |
| Real | |||
| ) |
Definition at line 15 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 );
}
| 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.
{
Integer x = cycle(L1, pos1, inc);
Integer y = cycle(L2, pos2, inc);
Return(Integer(Round(unitInterp(f, x, y))));
}
| IntegerList Chapter9::invert | ( | IntegerList | ) |
Definition at line 62 of file C091101.cpp.
{
For(Integer i = 0; i < Length(L); i = i + 1)
L[i] = Mod(12 - L[i], 12);
Return(L);
}
| Integer Chapter9::LCRandom | ( | ) |
| RealList Chapter9::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 Chapter9::para1 | ( | ) |
Definition at line 19 of file C090400.cpp.
References a, accumulate(), b, brownian(), c, cycle(), d(), f(), getIndex(), LCRandom(), linearInterpolate(), N, n(), normalize(), palindrome(), permute(), PlotPoint(), Random(), randomMelody(), randomRow(), randTendency(), rotate(), SeedRandom(), sum(), transpose(), unitInterp(), VossFracRand(), and x.
{
/*****************************************************************************
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:
*****************************************************************************/
}
| Static Void Chapter9::para2 | ( | ) |
Definition at line 51 of file C090400.cpp.
References f(), generateSetComplex(), guido(), interpTendency(), invert(), Random(), shuffle(), stretch(), sum(), and x.
{
/*****************************************************************************
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 Chapter9::para3 | ( | ) |
Definition at line 90 of file C091101.cpp.
References f(), retrograde(), sum(), and x.
{
/*****************************************************************************
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) );
}}
| Real Chapter9::Random | ( | Real | L = 0.0, |
| Real | U = 1.0 |
||
| ) |
Definition at line 15 of file C090703b.cpp.
References c, and LCRandom().
| Integer Chapter9::Random | ( | Integer | L, |
| Integer | U | ||
| ) |
| IntegerList Chapter9::randomRow | ( | Integer | ) |
Definition at line 20 of file C091204a.cpp.
References N, Random(), and x.
{
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 Chapter9::realToRational | ( | Real | f, |
| Integer Reference | num, | ||
| Integer Reference | den | ||
| ) |
| Void Chapter9::rotate | ( | IntegerList | Reference, |
| Integer | , | ||
| Integer | |||
| ) |
Definition at line 19 of file C090903.cpp.
{
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 Chapter9::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 Chapter9::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);
}
| RealList Chapter9::f |
| Integer Chapter9::x |
Definition at line 51 of file C090703.cpp.
1.7.2