#include "MusimatChapter9.h"Go to the source code of this file.
Functions | |
| MusimatChapter9Section (C090400) | |
| PitchList | guidoPitches (G3, A3, B3, C4, D4, E4, F4, G4, A4, B4, C5, D5, E5, F5, G5) |
| Static Void | para1 () |
| PitchList | guido (String text) |
| Static Void | para2 () |
| PitchList guido | ( | String | text | ) |
Definition at line 28 of file C090400.cpp.
References c, guidoPitches(), n(), and Random().
00028 { 00029 PitchList G; //place to put the mel ody 00030 Integer k = 0; //indexes G 00031 Integer offset; //indexes guidoPitches[ ] 00032 //evaluate one character of the text at a time 00033 For (Integer i = 0; i < Length(text); i = i + 1) { 00034 Character c = text[ i ]; //get a character of the text 00035 If ( c == 'a' ) { offset = 0; } 00036 Else If ( c == 'e' ) { offset = 1; } 00037 Else If ( c == 'i' ) { offset = 2; } 00038 Else If ( c == 'o' ) { offset = 3; } 00039 Else If ( c == 'u' ) { offset = 4; } 00040 Else { offset = -1; } //the character is not a vowel 00041 If ( offset != -1 ) { //if the character is a vowel. . . 00042 Integer R = Random( 0, 2 ); //returns 0, 1, or 2 00043 Integer n = ( 5 * R ) + offset; 00044 G[ k ] = guidoPitches[ n ]; 00045 k = k + 1; 00046 } 00047 } 00048 Return( G ); //return the list of pitches composed 00049 }
| PitchList guidoPitches | ( | G3 | , | |
| A3 | , | |||
| B3 | , | |||
| C4 | , | |||
| D4 | , | |||
| E4 | , | |||
| F4 | , | |||
| G4 | , | |||
| A4 | , | |||
| B4 | , | |||
| C5 | , | |||
| D5 | , | |||
| E5 | , | |||
| F5 | , | |||
| G5 | ||||
| ) |
| MusimatChapter9Section | ( | C090400 | ) |
Definition at line 2 of file C090400.cpp.
References para1(), and para2().
00002 { 00003 Print("*** 9.4 Program for Guido’s Method ***"); 00004 /***************************************************************************** 00005 00006 9.4 Program for Guido’s Method 00007 00008 With the Musimat programming language we can program a version of Guido’s method. 00009 First, we transform Guido’s vowel sequences to pitches by defining 00010 the PitchList guidoPitches, below. This lists the available pitches in 00011 the vocal gamut of his day. 00012 *****************************************************************************/ 00013 para1(); // Step into this function to continue. 00014 para2(); // Step into this function to continue. 00015 }
| Static Void para1 | ( | ) |
Definition at line 19 of file C090400.cpp.
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 para2 | ( | ) |
Definition at line 51 of file C090400.cpp.
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 }}
1.4.7