• Main Page
  • Files
  • File List
  • File Members

/Users/garethloy/Musimathics/Musimat1.2/MusimatChapter9/C091101.cpp

Go to the documentation of this file.
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 function transpose() below 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         }
00045         Return(L);
00046 }
00047 
00048 Static Void para1() {
00049         /*****************************************************************************
00050          Here is an example of transposing a list:
00051          *****************************************************************************/
00052         
00053         Print("*** Transposing a list ***");
00054         IntegerList L( 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11 );
00055         Print("Original row:", L);
00056         Print("Row transposed by 6: ", transpose(L, 6) );
00057         
00058         /*****************************************************************************
00059          To invert a pitch set:
00060          *****************************************************************************/
00061 }
00062 
00063 IntegerList invert(IntegerList L) {
00064         For(Integer i = 0; i < Length(L); i = i + 1) {
00065                 L[i] = Mod(12 - L[i], 12);
00066         }
00067         Return(L);
00068 }
00069 
00070 Static Void para2() {
00071         /*****************************************************************************
00072          Here is an example of inverting a list:
00073          *****************************************************************************/
00074         Print("*** Inverting a list ***");
00075         IntegerList L( 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11 );
00076         Print("Original row:", L);
00077         Print( "Inverted row:", invert(L) );
00078         
00079         /*****************************************************************************
00080          To take the retrograde of a set:
00081          *****************************************************************************/
00082 }
00083 
00084 IntegerList retrograde(IntegerList L) {
00085         Integer n = Length(L);
00086         IntegerList R = L;                                                              // make a new list as long as L
00087         For(Integer i = 0; i < n; i = i + 1) {
00088                 R[i] = L[n - i - 1];
00089         }
00090         Return(R);
00091 }
00092 
00093 Static Void para3() {
00094         /*****************************************************************************
00095          Here is an example of retrograding a list:
00096          *****************************************************************************/
00097         Print("*** Retrograding a list ***");
00098         IntegerList L( 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11 );
00099         Print("Original row:", L);
00100         Print( "Retrograded row:", retrograde(L) );
00101         
00102 }
00103 
00105 /* $Revision: 1.3 $ $Date: 2006/09/05 08:02:45 $ $Author: dgl $ $Name:  $ $Id: C091101.cpp,v 1.3 2006/09/05 08:02:45 dgl Exp $ */
00106 // The Musimat Tutorial © 2006 Gareth Loy
00107 // Derived from Chapter 9 and Appendix B of "Musimathics Vol. 1" © 2006 Gareth Loy 
00108 // and published exclusively by The MIT Press.
00109 // This program is released WITHOUT ANY WARRANTY; without even the implied 
00110 // warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 
00111 // For information on usage and redistribution, and for a DISCLAIMER OF ALL
00112 // WARRANTIES, see the file, "LICENSE.txt," in this distribution.
00113 // "Musimathics" is available here:     http://mitpress.mit.edu/catalog/item/default.asp?ttype=2&tid=10916
00114 // Gareth Loy's Musimathics website:    http://www.musimathics.com/
00115 // The Musimat website:                 http://www.musimat.com/
00116 // This program is released under the terms of the GNU General Public License
00117 // available here:                      http://www.gnu.org/licenses/gpl.txt
00118 

Generated on Fri Nov 26 2010 16:18:24 for Musimat Chapter 9 Code Examples by  doxygen 1.7.2