Sage-ST ä

Musiclib

Documentation

ClearKey NameToNumber NumberToFrequency PlayLine
PlayNote PlayTune SetKey SetTempo




  procedure NumberToFrequency
             (noteNum   : in     ModSys.S_Natural;
              frequency :    out ModSys.S_Natural);

  --*
  --  NumberToFrequency - Change a note number to a frequency in Hertz.
  --
  --
  --  This procedure converts a note number to a frequency  measured
  --  in Hertz.
  --
  --  CALLING SEQUENCE -
  --
  --    NumberToFrequency (noteNum, frequency)
  --
  --  ENTRY -
  --
  --    noteNum : ModSys.S_Natural
  --      The note number where 1=the A three below middle C,
  --      2=A sharp (B flat), 3=B, etc.  There are 13 notes in
  --      an octave from A to A, C to C, etc.
  --
  --  EXIT -
  --
  --    frequency : ModSys.S_Natural
  --      The frequency (in Hertz) of the given note.
  --




  procedure NameToNumber
             (noteName : in     string;
              noteNum  :    out ModSys.S_Natural);

  --*
  --  NameToNumber - Convert a notes name to a number.
  --
  --
  --  This procedure converts a note's name to a note number.
  --
  --  CALLING SEQUENCE -
  --
  --    NameToNumber (noteName, noteNum)
  --
  --  ENTRY -
  --
  --    noteName : string
  --      Name of the note.  Example are
  --      1A    - A 3 below middle C.
  --      3As   - A Sharp 1 below middle C.
  --      3C    - Middle C
  --      3Ef   - E flat 1 above middle C.
  --      4Fn   - F natural 2 above middle C  (the natural setting
  --                is only useful if a prior SetKey causes F
  --                to be flat or sharp).
  --      R     - A rest
  --
  --      note - The number preceding the note tells the
  --      octave in which the note resides.  No octave number
  --      will default to 3.  An "s" or "f" may follow the note
  --      signifying a sharp or flat.
  --
  --  EXIT -
  --
  --    noteNum : ModSys.S_Natural
  --      The note number where 1=the A three below middle C,
  --      2=A sharp (B flat), 3=B, etc.  There are 13 notes in
  --      an octave from A to A, C to C, etc.
  --




  procedure SetKey
             (note    : in     character;
              setting : in     KeySet);

  --*
  --  SetKey - Define a notes flat or sharp for the current key.
  --
  --
  --  This procedure allows definition of a note's flat or sharp for
  --  the a musical key.   For example, in the  key of C, all  notes
  --  are set to Natural (see ClearKey),  in the key of G, F  is set
  --  to Sharp, in the key of D the SetKey procedure is called twice
  --  to set both F and C to sharp, etc.
  --
  --  CALLING SEQUENCE -
  --
  --    SetKey (note, setting)
  --
  --  ENTRY -
  --
  --    note : character
  --      The note to set ("A" .."G").
  --
  --    setting : KeySet
  --      Flat, Natural, or Sharp.
  --




  procedure ClearKey;

  --*
  --  ClearKey - Clear the key settings to the key of C.
  --
  --
  --  This procedure clears  the key settings  so that all  keys are
  --  natural or in the key of C.
  --




  procedure SetTempo
             (beatsPerMinute : in     ModSys.S_Natural);

  --*
  --  SetTempo - Set the music tempo.
  --
  --
  --  This procedure allows the setting  of the number of beats  per
  --  minute.
  --
  --  CALLING SEQUENCE -
  --
  --    SetTempo (beatsPerMinute)
  --
  --  ENTRY -
  --
  --    beatsPerMinute : ModSys.S_Natural
  --      Number of beats per minute.  When playing a note, each
  --      beat is equivalent to one count.
  --




  procedure PlayNote
             (noteNum : in     ModSys.S_Natural;
              Count   : in     ModSys.S_Float32);

  --*
  --  PlayNote - Play a note.
  --
  --
  --  This  procedure  plays  the  specified  note  for the required
  --  number of counts.  The length of a count is dependant upon the
  --  current tempo (see SetTempo procedure).
  --
  --  CALLING SEQUENCE -
  --
  --    PlayNote (noteNum, count)
  --
  --  ENTRY -
  --
  --    noteNum : ModSys.S_Natural
  --      The note number where 1=the A three below middle C,
  --      2=A sharp (B flat), 3=B, etc.  There are 13 notes in
  --      an octave from A to A, C to C, etc.  0 is a rest.
  --
  --    count : ModSys.S_Float32
  --      The count (or length of duration) of the note to be
  --      played.  If the tempo was defined as 60 beats/minute
  --      and the count was 1.0 then the note would be played
  --      for 1 second.
  --




  procedure PlayLine
             (musicLine    : in     string;
              keyInterrupt : in     boolean;
              interrupted  :    out boolean);

  --*
  --  PlayLine - Play a line of music.
  --
  --
  --  This procedure plays a tune or commands as stored on a file.
  --  The line may contain pairs of data which represent the note
  --  (or rest) to be played and its duration.  It also contains
  --  the key to play in and the tempo definition.
  --  Special keywords may begin a line such as,
  --  "TEMPO", "FLAT", or "SHARP".  The Open-Paren and Asterick
  --  pair of characters will begin a comment and the
  --  Asterick and Close-Paren pair will end it.
  --
  --    "1A  2    3C  .5     4D  1.5"
  --
  --  CALLING SEQUENCE -
  --
  --    PlayTune (fileName, keyInterrupt)
  --
  --  ENTRY -
  --
  --    musicLine : string
  --      Array containing music instructions.
  --
  --    keyInterrupt : boolean
  --      Tune will quite when the user presses any key (TRUE).
  --
  --  EXIT -
  --
  --    interrupted : boolean
  --      Music interrupted by a user keystroke.
  --




  procedure PlayTune
             (FileName     : in     string;
              keyInterrupt : in     boolean);

  --*
  --  PlayTune - Play a tune as stored on a file.
  --
  --
  --  This procedure  plays a  tune as  stored on  a file.  The file
  --  contains pairs of data which  represent the note (or rest)  to
  --  be played and its duration.  It also contains the key to  play
  --  in and  the tempo  definition.  Special  keywords may  begin a
  --  line  such  as,  "TEMPO",   "FLAT",  or  "SHARP".
  --  The Open-Paren and Asterick pair of characters will begin a
  --  comment and the Asterick and Close-Paren pair will end it.
  --
  --  TEMPO  96                     -- 96 beats/minute
  --  SHARP  F C                    -- F & C are sharp - key of D
  --  1A  2    3C  .5     4D  1.5
  --  R   4    3C  1
  --
  --  CALLING SEQUENCE -
  --
  --    PlayTune (fileName, keyInterrupt)
  --
  --  ENTRY -
  --
  --    fileName : string
  --      Name of file containing tune code.
  --
  --    keyInterrupt : boolean
  --      Tune will quite when the user presses any key (TRUE).
  --




Send mail to   warren.merrill@inl.gov with questions or comments about this web site.
Copyright © 1989-2006 Battelle Energy Alliance