- Main Page
- Namespaces
- Files

- File List
- File Members

# C:/Musimathics_local/Musimat/MusimatTutorial/B0201d.cpp

Go to the documentation of this file.

    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 We want to preserve the reference A440 Hz and use it to find the frequency of the lowest degree
    00025 of the scale, as we’ve done for Pythagorean and natural scales. But which of the 22 degrees should
    00026 correspond to A440? The sruti scale contains both the Pythagorean major sixth (27/16) and the
    00027 natural major sixth (5/3). Let’s choose the simpler 5/3 ratio at degree 17 to correspond to A440.
    00028 Then the lowest degree of the sruti scale has the same frequency as the natural chromatic middle
    00029 C, 264.0 Hz.
    00030 *****************************************************************************/
    00031
    00032 Real            R = 440.0;
    00033 Real            srutiRef = R * 3.0/5.0; // 264.00 Hz
    00034
    00035 /*****************************************************************************
    00036 Next, we must inform Pitch of how many degrees there are per octave, which we can do by
    00037 finding the length of the list of ratios:
    00038 *****************************************************************************/
    00039
    00040 SetDegrees(Length(srutiScale));                 // set number of degrees in scale
    00041
    00042 /*****************************************************************************
    00043 The built-in SetDegrees( ) function adjusts the internal calculations of Pitch to the spec-
    00044 ified number of degrees in the scale. To keep things simple, the degrees of the sruti scale are indi-
    00045 cated only by their degree numbers, rather than by trying to extend the Western pitch-naming
    00046 system. Then the frequencies of particular sruti degrees are computed as follows:
    00047 *****************************************************************************/
    00048
    00049 For (Integer i = 0; i < Length(srutiScale); i = i + 1) {
    00050         Pitch x( i, 0, 4 ); // pitch, accidental, octave
    00051         Real f = pitchToHz(x, srutiRef, srutiScale);
    00052         Print(f);
    00053 }
    00054
    00055 /*****************************************************************************
    00056 which prints the frequencies of the sruti scale from middle C as follows:
    00057
    00058 1       2       3       4       5       6       7       8       9       10      11
    00059 264.00  278.12  281.60  293.33  297.00  312.89  316.80  330.00  334.13  352.00  356.40
    00060
    00061 12      13      14      15      16      17      18      19      20      21      22
    00062 371.25  375.89  396.00  417.19  422.40  440.00  445.50  469.33  475.20  495.00  501.19
    00063
    00064 Other scales, such as Partch’s scale and the quarter-tone scale, can be constructed in the same
    00065 manner. The Bohlen-Pierce scale can also be constructed this way because the SetDegrees()
    00066 function only specifies the number of degrees in the scale and makes no assumptions about octave
    00067 equivalence.
    00068
    00069 *****************************************************************************/
    00070 }}
    00071
    00073 /* $Revision: 1.1 $ $Date: 2006/09/08 19:11:34 $ $Author: dgl $ $Name:  $ $Id: _b0201d_8cpp-source.html,v 1.1 2006/09/08 19:11:34 dgl Exp $ */
    00074 // The Musimat Tutorial © 2006 Gareth Loy
    00075 // Derived from Chapter 9 and Appendix B of "Musimathics Vol. 1" © 2006 Gareth Loy
    00076 // and published exclusively by The MIT Press.
    00077 // This program is released WITHOUT ANY WARRANTY; without even the implied
    00078 // warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
    00079 // For information on usage and redistribution, and for a DISCLAIMER OF ALL
    00080 // WARRANTIES, see the file, "LICENSE.txt," in this distribution.
    00081 // "Musimathics" is available here:     http://mitpress.mit.edu/catalog/item/default.asp?ttype=2&tid=10916
    00082 // Gareth Loy's Musimathics website:    http://www.musimathics.com/
    00083 // The Musimat website:                 http://www.musimat.com/
    00084 // This program is released under the terms of the GNU General Public License
    00085 // available here:                      http://www.gnu.org/licenses/gpl.txt
    00086