Functions

/Users/garethloy/Musimathics/Musimat1.2/MusimatTutorial/B0203.cpp File Reference

#include "MusimatTutorial.h"

Go to the source code of this file.

Functions

 MusimatTutorialSection (B0203)
Real mm (Real beats, Real perMinute)
Static Void para1 ()

Function Documentation

Real mm ( Real  beats,
Real  perMinute 
)

Definition at line 22 of file B0203.cpp.

                                    {
        Return(1.0 / (4.0 * beats) * 60.0 / perMinute);
}
MusimatTutorialSection ( B0203   )

Definition at line 2 of file B0203.cpp.

References para1().

                              {
        Print("*** B.2.3 Tempo ***");
        /*****************************************************************************
         
         B.2.3 Tempo
         
         In common music notation, tempo is expressed using Mälzel's metronome markings (see sec-
         tion 2.6.2). For example, Q = 60MM indicates that the beat or pulse of the music is associated 
         with quarter notes and that there are 60 beats per minute. Thus at Q = 60MM each quarter note 
         lasts 1 second, and at Q = 120MM each quarter note lasts 0.5 second. Thus tempo scales the 
         durations of rhythms.
         
         We can emulate this by calculating a tempo factor based on Mälzel's metronome markings. 
         Rhythms are then multiplied by this coefficient to determine their actual duration. First, we need 
         a function that calculates the tempo factor:
         *****************************************************************************/
        
        para1();  // Step into this function to continue the tutorial
}
Static Void para1 (  )

Definition at line 26 of file B0203.cpp.

References mm().

                    {
        
        /*****************************************************************************
         The beats argument is the rhythmic value that gets the beat, and the perMinute argument is the 
         number of beats per minute. For example, 
         *****************************************************************************/
        
        Real tempoScale = mm( Duration(Quarter), 60.0 );                // 60 quarternotes per minute
        
        /*****************************************************************************
         sets tempoScale to 1.0, and 
         *****************************************************************************/
        
        tempoScale = mm(Duration(Quarter), 120.0);                      // 120 quarternotes per minute
        
        /*****************************************************************************
         sets tempoScale to 0.5. Scaling a list of rhythms with tempoScale adjusts them to the pre-
         vailing tempo. Start with a rhythm list.
         *****************************************************************************/
        
        RhythmList T(Quarter, Eighth, Eighth, Eighth, Sixteenth, Sixteenth, Quarter);
        Print(T);
        
        /*****************************************************************************
         prints {(1,4), (1,8), (1,8), (1,8), (1,16), (1,16), (1,4)}. Now scale it.
         *****************************************************************************/
        
        RhythmList S = T * tempoScale;                                                                          // tempoScale == 0.5
        Print(S);
        
        /*****************************************************************************
         prints {(1,8), (1,16), (1,16), (1,16), (1,32), (1,32), (1,8)}.
         
         Though this explicit approach to managing tempo works fine, in fact Rhythm() has this cal-
         culation conveniently built in. It works in conjunction with a built-in function named Set-
         Tempo() that implicitly scales all rhythmic durations by the specified tempo factor. So, for 
         example, given the preceding definition of RhythmList T,
         *****************************************************************************/
        
        SetTempoScale(mm(Duration(Quarter), 90));                               // set tempo to 90 quarternotes per minute
        Print(T);
        
        /*****************************************************************************
         prints {(1,6), (1,12), (1,12), (1,12), (1,24), (1,24), (1,6)}. All rhythmic values 
         are scaled implicitly by Rhythm().
         *****************************************************************************/
}