On 05-Dec-97, Dan Chak wrote to All about PC speaker.
DC> I was wondering if anyone knows of something someone may have
DC> already written that relates pc speaker tones (from dos.h) to
DC> musical notes?
Sorry moderator, he has not provided a private address...
I don't think this "code" needs explanation at all...
Disclaimer: I didn't write it, don't shout at me :-P
/* (NOTES.PAS)
unit notes;
(*******************************)interface(*********************************)
uses
crt;
procedure note(octave, note : byte);
(****************************)implementation(*******************************)
Const
allNotes : array[0..8, 1..12] Of Word = (
{ C C#,D- D D#,E- E F F#,G- G G#,A- A
A#,B- B }
(0016, 0017, 0018, 0019, 0021, 0022, 0023, 0025, 0026, 0028,
0029, 0031),
(0033, 0035, 0037, 0039, 0041, 0044, 0046, 0049, 0052, 0055,
0058, 0062),
(0065, 0069, 0073, 0078, 0082, 0087, 0093, 0098, 0104, 0110,
0117, 0123),
(0131, 0139, 0147, 0156, 0165, 0175, 0185, 0196, 0208, 0220,
0233, 0247),
(0262, 0277, 0294, 0311, 0330, 0349, 0370, 0392, 0415, 0440,
0466, 0494),
(0523, 0554, 0587, 0622, 0659, 0698, 0740, 0784, 0831, 0880,
0932, 0987),
(1047, 1109, 1175, 1245, 1329, 1397, 1480, 1568, 1661, 1760,
1865, 1976),
(2093, 2217, 2349, 2489, 2637, 2794, 2960, 3136, 3322, 3520,
3729, 3951),
(4186, 4435, 4699, 4978, 5274, 5588, 5920, 6272, 6645, 7040,
7459, 7902)
);
procedure note;
begin
sound(allNotes[octave, note]);
end;
end.
*/
.!. Sorry moderator, I'll go back on topic, I swear!
___ T-TAG 1.10 [*UnReg*]
--- Terminate 5.00/Pro
---------------
* Origin: The King of The Ring (4:900/748.3)
|