Sage-ST ä

Musiclib

Documentation

ClearKey NameToNumber NumberToFrequency PlayLine
PlayNote PlayTune STRNameToNumber STRPlayLine
STRPlayTune SetKey SetTempo




  procedure NumberToFrequency
             (const noteNum   : cardinal;
              var   frequency : cardinal); stdcall;

  exports NumberToFrequency name 'MusicLib_NumberToFrequency';

  //*
  //  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 : cardinal
  //      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 : cardinal
  //      The frequency (in Hertz) of the given note.
  //




  procedure NameToNumber
             (const noteName : array of char;
              var   noteNum  : cardinal); overload; stdcall;

  exports NameToNumber (const noteName : array of char;
                        var   noteNum  : cardinal) name 'MusicLib_NameToNumber';

  //*
  //  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 : array of char
  //      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 : cardinal
  //      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 NameToNumber
             (const noteName : string;
              var   noteNum  : cardinal); overload; stdcall;

  exports NameToNumber (const noteName : string;
                        var   noteNum  : cardinal) name 'MusicLib_STRNameToNumber';

  //*
  //  STRNameToNumber - See documentation of NameToNumber.
  //




  procedure SetKey
             (const note    : char;
              const setting : KeySet); stdcall;

  exports SetKey name 'MusicLib_SetKey';

  //*
  //  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 : char
  //      The note to set ('A' ..'G').
  //
  //    setting : KeySet
  //      Flat, Natural, or Sharp.
  //




  procedure ClearKey; stdcall;

  exports ClearKey name 'MusicLib_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
             (const beatsPerMinute : cardinal); stdcall;

  exports SetTempo name 'MusicLib_SetTempo';

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




  procedure PlayNote
             (const noteNum : cardinal;
              const Count   : ModSys.FLOAT32); stdcall;

  exports PlayNote name 'MusicLib_PlayNote';

  //*
  //  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 : cardinal
  //      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 : cardinal
  //      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
             (const musicLine    : array of char;
              const keyInterrupt : boolean;
              var   interrupted  : boolean); overload; stdcall;

  exports PlayLine (const musicLine    : array of char;
                    const keyInterrupt : boolean;
                    var   interrupted  : boolean) name 'MusicLib_PlayLine';

  //*
  //  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 two characters ' (' and '*'
  //  together start a comment and the two characters '*' and ')'
  //  together end a comment.
  //
  //    '1A  2    3C  .5     4D  1.5'
  //
  //  CALLING SEQUENCE -
  //
  //    PlayTune (fileName, keyInterrupt)
  //
  //  ENTRY -
  //
  //    musicLine : array of char
  //      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 PlayLine
             (const musicLine    : string;
              const keyInterrupt : boolean;
              var   interrupted  : boolean); overload; stdcall;

  exports PlayLine (const musicLine    : string;
                    const keyInterrupt : boolean;
                    var   interrupted  : boolean) name 'MusicLib_STRPlayLine';

  //*
  //  STRPlayLine - See documentation of PlayLine.
  //




  procedure PlayTune
             (const FileName     : array of char;
              const keyInterrupt : boolean); overload; stdcall;

  exports PlayTune (const FileName     : array of char;
                    const keyInterrupt : boolean) name 'MusicLib_PlayTune';

  //*
  //  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 two
  //  characters ' (' and '*' together start a comment and the two
  //  characters '*' and ')' together end a comment.
  //
  //  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 : array of char
  //      Name of file containing tune code.
  //
  //    keyInterrupt : boolean
  //      Tune will quite when the user presses any key (True).
  //




  procedure PlayTune
             (const FileName     : string;
              const keyInterrupt : boolean); overload; stdcall;

  exports PlayTune (const FileName     : string;
                    const keyInterrupt : boolean) name 'MusicLib_STRPlayTune';

  //*
  //  STRPlayTune - See documentation of PlayTune.
  //




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