00001 #include "MusimatChapter9.h" 00002 MusimatChapter9Section(C091101) { 00003 Print("*** 9.11.1 Precomposition ***"); 00004 /***************************************************************************** 00005 00006 9.11.1 Precomposition 00007 00008 The process of composing atonal music is typically divided into two parts. 00009 00010 o Precomposing: assembling the musical materials 00011 00012 o Composing: applying the assembled materials in a design 00013 00014 Musimat already has a number of data types and operations, but a few more are needed: 00015 00016 o To represent pitches as symbols with integer values, such as: 00017 00018 Integer C = 0, Cs = Db = 1, D = 2, Ds = Eb = 3 . . ., B = 11; 00019 00020 o To represent motives as lists, such as: 00021 00022 IntegerList a = {F, F, G, A}; 00023 IntegerList b = {F, A, G}; 00024 IntegerList c = {F, E}; 00025 IntegerList d = {Bb, A, G, F}; 00026 IntegerList e = {E, C, D, E, F, F}; 00027 00028 o To combine motives and concatenate lists: 00029 00030 IntegerList y = Join(a, b, a, c, a, d, e); 00031 00032 (y is defined as the list of pitches of the tune “Yankee Doodle.”) 00033 00034 The following function transposes a pitch set. 00035 *****************************************************************************/ 00036 para1(); // Step into this function to continue. 00037 para2(); // Step into this function to continue. 00038 para3(); // Step into this function to continue. 00039 } 00040 00041 IntegerList transpose(IntegerList L, Integer t) { 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 } 00046 00047 Static Void para1() { 00048 /***************************************************************************** 00049 Here is an example of transposing a list: 00050 *****************************************************************************/ 00051 00052 Print("*** Transposing a list ***"); 00053 IntegerList L( 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11 ); 00054 Print("Original row:", L); 00055 Print("Row transposed by 6: ", transpose(L, 6) ); 00056 00057 /***************************************************************************** 00058 To invert a pitch set: 00059 *****************************************************************************/ 00060 } 00061 00062 IntegerList invert(IntegerList L) { 00063 For(Integer i = 0; i < Length(L); i = i + 1) 00064 L[i] = Mod(12 - L[i], 12); 00065 Return(L); 00066 } 00067 00068 Static Void para2() { 00069 /***************************************************************************** 00070 Here is an example of inverting a list: 00071 *****************************************************************************/ 00072 Print("*** Inverting a list ***"); 00073 IntegerList L( 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11 ); 00074 Print("Original row:", L); 00075 Print( "Inverted row:", invert(L) ); 00076 00077 /***************************************************************************** 00078 To take the retrograde of a set: 00079 *****************************************************************************/ 00080 } 00081 00082 IntegerList retrograde(IntegerList L) { 00083 Integer n = Length(L); 00084 IntegerList R = L; // make a new list as long as L 00085 For(Integer i = 0; i < n; i = i + 1) 00086 R[i] = L[n - i - 1]; 00087 Return(R); 00088 } 00089 00090 Static Void para3() { 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 }} 00100 00102 /* $Revision: 1.4 $ $Date: 2006/09/12 17:37:25 $ $Author: dgl $ $Name: $ $Id: _c091101_8cpp-source.html,v 1.4 2006/09/12 17:37:25 dgl Exp $ */ 00103 // The Musimat Tutorial © 2006 Gareth Loy 00104 // Derived from Chapter 9 and Appendix B of "Musimathics Vol. 1" © 2006 Gareth Loy 00105 // and published exclusively by The MIT Press. 00106 // This program is released WITHOUT ANY WARRANTY; without even the implied 00107 // warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 00108 // For information on usage and redistribution, and for a DISCLAIMER OF ALL 00109 // WARRANTIES, see the file, "LICENSE.txt," in this distribution. 00110 // "Musimathics" is available here: http://mitpress.mit.edu/catalog/item/default.asp?ttype=2&tid=10916 00111 // Gareth Loy's Musimathics website: http://www.musimathics.com/ 00112 // The Musimat website: http://www.musimat.com/ 00113 // This program is released under the terms of the GNU General Public License 00114 // available here: http://www.gnu.org/licenses/gpl.txt 00115
1.4.7