| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657 |
- Listing:
- 1 MODULE prog3;
- 2 (* This program plays musical scales *)
- 3 FROM Lib IMPORT Speaker, Delay;
- 4 FROM MATHLIB IMPORT Exp,Log;
- 5
- 6 CONST MiddleC = 131.0;
- 7 TYPE NoteType = SHORTINT;
- 8 TYPE ScaleType = ARRAY [1..8] OF NoteType;
- ***** ^ not supported yet
- ***** ^ not supported yet
- 9 CONST major = ScaleType(0,2,4,5,7,9,11,12);
- ***** ^ not supported yet
- 10 CONST minor = ScaleType(0,2,3,5,7,8,11,12);
- ***** ^ not supported yet
- 11
- 12 PROCEDURE PlayScale(mode : ScaleType; key : NoteType);
- 13 VAR
- 14 i:[1..8];
- 15 note:NoteType;
- 16 freq:LONGREAL;
- 17 BEGIN
- 18 FOR i := 1 TO 8 DO
- 19 note := key + mode[i];
- ***** ^ not supported yet
- ***** ^ not supported yet
- 20 freq := MiddleC * Exp(LONGREAL(note) * (Log(2.0)/12.0));
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 21 Speaker(CARDINAL(freq),200);
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 22 END;
- 23 Delay(500);
- ***** ^ not supported yet
- ***** ^ not supported yet
- 24 END PlayScale;
- ***** ^ not supported yet
- 25
- 26 BEGIN
- 27 PlayScale(major, 0); (* C major *)
- ***** ^ not supported yet
- ***** ^ not supported yet
- 28 PlayScale(minor, 2); (* D minor *)
- ***** ^ not supported yet
- ***** ^ not supported yet
- 29 END prog3.
- 30
- 21 errors
|