◄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.