00001 #include "MusimatTutorial.h" 00002 MusimatTutorialSection(B0201d) { 00003 Print("*** Sruti Scale ***"); 00004 /***************************************************************************** 00005 00006 Sruti Scale 00007 00008 As a final example, we adapt Pitch to handle nondodecaphonic scales by demon- 00009 strating the sruti scale (see figure 3.25). There are 22 degrees in this scale. We start by defining 00010 the ratios of the sruti scale: 00011 *****************************************************************************/ 00012 para1(); // Step into this function to continue the tutorial 00013 } 00014 00015 RealList srutiScale( 00016 1.0/1.0, 256.0/243.0, 16.0/15.0, 10.0/9.0, 9.0/8.0, 32.0/27.0, 6.0/5.0, 00017 5.0/4.0, 81.0/64.0, 4.0/3.0, 27.0/20.0,45.0/32.0, 729.0/512.0, 00018 3.0/2.0, 128.0/81.0, 8.0/5.0, 5.0/3.0, 27.0/16.0, 16.0/9.0, 9.0/5.0, 00019 15.0/8.0, 243.0/128.0 00020 ); 00021 00022 Static Void para1() { 00023 00024 /***************************************************************************** 00025 We want to preserve the reference A440 Hz and use it to find the frequency of the lowest degree 00026 of the scale, as we've done for Pythagorean and natural scales. But which of the 22 degrees should 00027 correspond to A440? The sruti scale contains both the Pythagorean major sixth (27/16) and the 00028 natural major sixth (5/3). Let's choose the simpler 5/3 ratio at degree 17 to correspond to A440. 00029 Then the lowest degree of the sruti scale has the same frequency as the natural chromatic middle 00030 C, 264.0 Hz. 00031 *****************************************************************************/ 00032 00033 Real R = 440.0; 00034 Real srutiRef = R * 3.0/5.0; // 264.00 Hz 00035 00036 /***************************************************************************** 00037 Next, we must inform Pitch of how many degrees there are per octave, which we can do by 00038 finding the length of the list of ratios: 00039 *****************************************************************************/ 00040 00041 SetDegrees(Length(srutiScale)); // set number of degrees in scale 00042 00043 /***************************************************************************** 00044 The built-in SetDegrees( ) function adjusts the internal calculations of Pitch to the spec- 00045 ified number of degrees in the scale. To keep things simple, the degrees of the sruti scale are indi- 00046 cated only by their degree numbers, rather than by trying to extend the Western pitch-naming 00047 system. Then the frequencies of particular sruti degrees are computed as follows: 00048 *****************************************************************************/ 00049 00050 For (Integer i = 0; i < Length(srutiScale); i = i + 1) { 00051 Pitch x( i, 0, 4 ); // pitch, accidental, octave 00052 Real f = pitchToHz(x, srutiRef, srutiScale); 00053 Print(f); 00054 } 00055 00056 /***************************************************************************** 00057 which prints the frequencies of the sruti scale from middle C as follows: 00058 00059 1 2 3 4 5 6 7 8 9 10 11 00060 264.00 278.12 281.60 293.33 297.00 312.89 316.80 330.00 334.13 352.00 356.40 00061 00062 12 13 14 15 16 17 18 19 20 21 22 00063 371.25 375.89 396.00 417.19 422.40 440.00 445.50 469.33 475.20 495.00 501.19 00064 00065 Other scales, such as Partch's scale and the quarter-tone scale, can be constructed in the same 00066 manner. The Bohlen-Pierce scale can also be constructed this way because the SetDegrees() 00067 function only specifies the number of degrees in the scale and makes no assumptions about octave 00068 equivalence. 00069 00070 *****************************************************************************/ 00071 } 00072 00074 /* $Revision: 1.3 $ $Date: 2006/09/05 08:03:08 $ $Author: dgl $ $Name: $ $Id: B0201d.cpp,v 1.3 2006/09/05 08:03:08 dgl Exp $ */ 00075 // The Musimat Tutorial © 2006 Gareth Loy 00076 // Derived from Chapter 9 and Appendix B of "Musimathics Vol. 1" © 2006 Gareth Loy 00077 // and published exclusively by The MIT Press. 00078 // This program is released WITHOUT ANY WARRANTY; without even the implied 00079 // warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 00080 // For information on usage and redistribution, and for a DISCLAIMER OF ALL 00081 // WARRANTIES, see the file, "LICENSE.txt," in this distribution. 00082 // "Musimathics" is available here: http://mitpress.mit.edu/catalog/item/default.asp?ttype=2&tid=10916 00083 // Gareth Loy's Musimathics website: http://www.musimathics.com/ 00084 // The Musimat website: http://www.musimat.com/ 00085 // This program is released under the terms of the GNU General Public License 00086 // available here: http://www.gnu.org/licenses/gpl.txt 00087