qp.hlp (Table of Contents; Topic list)
Important Notice
The pages on this site contain documentation for very old MS-DOS software, purely for historical purposes. If you're looking for up-to-date documentation, particularly for programming, you should not rely on the information found here, as it will be woefully out of date.
PIANO.PAS
  Example Contents Index                                    Back
 
PROGRAM piano;
 
{ PIANO.PAS uses the following procedures to illustrate use of
  the speaker:
 
      Abs    NoSound    Ord    ReadKey    Sound
 
  It also uses the IN set operator.
}
 
USES
    Crt;
 
CONST
    program_name = 'PIANO ';
    program_desc = ' echoes a tone for each character you type.';
    rest         = 220;
 
VAR
    ch : Char;
 
BEGIN
 
    Writeln( program_name, program_desc );
    Writeln;
 
    Writeln( 'Type any characters you like. Press ESC to quit.' );
    REPEAT
        ch := ReadKey;
        IF (ch IN [' ', #13, #0, #9]) THEN
            NoSound
        ELSE Sound( Abs( 880 + 60 * (Ord( ch ) - 100) ) );
        Write( ch );
    UNTIL (ch = #27);
    NoSound;
 
END.