home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
ftp.barnyard.co.uk
/
2015.02.ftp.barnyard.co.uk.tar
/
ftp.barnyard.co.uk
/
cpm
/
walnut-creek-CDROM
/
MBUG
/
MBUG013.ARC
/
PLAY.PRO
< prev
next >
Wrap
Text File
|
1979-12-31
|
896b
|
27 lines
procedure PLAY(note : integer; note_length : byte);
{ Procedure developed in Turbo Pascal for the
MicroBee by Bob Burt, using an algorithm
developed by Alan Burt }
{ This procedure is used in conjunction with
the procedure SOUND.PRO }
var
cycles,frequency,duration : integer;
freq1,freq2,dur1,dur2 : byte;
begin
frequency := round(exp(ln(440)+(note-13)/12*ln(2)));
duration := round(exp(ln(144)+(13-note)/12*ln(2.028)));
cycles := frequency*note_length div 8;
freq1 := cycles;
freq2 := cycles div 256;
dur1 := duration;
dur2 := duration div 256;
mem[addr(sound)+39] := freq1;
mem[addr(sound)+40] := freq2;
mem[addr(sound)+41] := dur1;
mem[addr(sound)+42] := dur2;
sound
end; {procedure play}