#include "MusimatTutorial.h"Go to the source code of this file.
Functions | |
| MusimatTutorialSection (B0203) | |
| Real | mm (Real beats, Real perMinute) |
| Static Void | para1 () |
| Real mm | ( | Real | beats, | |
| Real | perMinute | |||
| ) |
| MusimatTutorialSection | ( | B0203 | ) |
Definition at line 2 of file B0203.cpp.
References para1().
00002 { 00003 Print("*** B.2.3 Tempo ***"); 00004 /***************************************************************************** 00005 00006 B.2.3 Tempo 00007 00008 In common music notation, tempo is expressed using Mälzel’s metronome markings (see sec- 00009 tion 2.6.2). For example, Q = 60MM indicates that the beat or pulse of the music is associated 00010 with quarter notes and that there are 60 beats per minute. Thus at Q = 60MM each quarter note 00011 lasts 1 second, and at Q = 120MM each quarter note lasts 0.5 second. Thus tempo scales the 00012 durations of rhythms. 00013 00014 We can emulate this by calculating a tempo factor based on Mälzel’s metronome markings. 00015 Rhythms are then multiplied by this coefficient to determine their actual duration. First, we need 00016 a function that calculates the tempo factor: 00017 *****************************************************************************/ 00018 para1(); // Step into this function to continue the tutorial 00019 }
| Static Void para1 | ( | ) |
Definition at line 25 of file B0203.cpp.
References mm().
00025 { 00026 /***************************************************************************** 00027 The beats argument is the rhythmic value that gets the beat, and the perMinute argument is the 00028 number of beats per minute. For example, 00029 *****************************************************************************/ 00030 00031 Real tempoScale = mm( Duration(Quarter), 60.0 ); // 60 quarternotes per minute 00032 00033 /***************************************************************************** 00034 sets tempoScale to 1.0, and 00035 *****************************************************************************/ 00036 00037 tempoScale = mm(Duration(Quarter), 120.0); // 120 quarternotes per minute 00038 00039 /***************************************************************************** 00040 sets tempoScale to 0.5. Scaling a list of rhythms with tempoScale adjusts them to the pre- 00041 vailing tempo. Start with a rhythm list. 00042 *****************************************************************************/ 00043 00044 RhythmList T(Quarter, Eighth, Eighth, Eighth, Sixteenth, Sixteenth, Quarter); 00045 Print(T); 00046 00047 /***************************************************************************** 00048 prints {(1,4), (1,8), (1,8), (1,8), (1,16), (1,16), (1,4)}. Now scale it. 00049 *****************************************************************************/ 00050 00051 RhythmList S = T * tempoScale; // tempoScale == 0.5 00052 Print(S); 00053 00054 /***************************************************************************** 00055 prints {(1,8), (1,16), (1,16), (1,16), (1,32), (1,32), (1,8)}. 00056 00057 Though this explicit approach to managing tempo works fine, in fact Rhythm() has this cal- 00058 culation conveniently built in. It works in conjunction with a built-in function named Set- 00059 Tempo() that implicitly scales all rhythmic durations by the specified tempo factor. So, for 00060 example, given the preceding definition of RhythmList T, 00061 *****************************************************************************/ 00062 00063 SetTempoScale(mm(Duration(Quarter), 90)); // set tempo to 90 quarternotes per minute 00064 Print(T); 00065 00066 /***************************************************************************** 00067 prints {(1,6), (1,12), (1,12), (1,12), (1,24), (1,24), (1,6)}. All rhythmic values 00068 are scaled implicitly by Rhythm(). 00069 00070 *****************************************************************************/ 00071 }}
1.4.7