home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
CP/M
/
CPM_CDROM.iso
/
mbug
/
mbug094.arc
/
GENSND.PAS
< prev
next >
Wrap
Pascal/Delphi Source File
|
1979-12-31
|
5KB
|
181 lines
{$U+}
program GENSND;
{Modified by R.K.Hallworth of Donvale Christian School
to accept user interupts U+ and simplify use}
{ Demonstration sound effects program in
Turbo Pascal for the MicroBee, developed
by Bob Burt from his gensnd program on
page 41 of Wildcards Volume 2, written
in MicroWorld BASIC
Demonstrates uses of Play and Sound_Effect procedures
found in sound+.pro}
const
space20 = ' ';
title = '*** Sound Generator Routines ***';
var
x,count,interval,duration : integer;
value,set_tone,end_tone,counter : byte;
up,melodic,many:boolean;
{$I sound+.pro}
procedure scale;
begin
set_tone := 255-count; Sound_effect(set_tone,end_tone,duration,up,melodic,many);
set_tone := 255-count - 2; Sound_effect(set_tone,end_tone,duration,up,melodic,many);
set_tone := 255-count - 8; Sound_effect(set_tone,end_tone,duration,up,melodic,many);
set_tone := 255-count - 6; Sound_effect(set_tone,end_tone,duration,up,melodic,many);
set_tone := 255-count - 4; Sound_effect(set_tone,end_tone,duration,up,melodic,many);
count := count + interval
end; {procedure scale}
procedure rand_notes;
begin
for count := 1 to 60 do
begin
value := random(200) + 55;
set_tone := 255-value;
delay(50);
Sound_effect(set_tone,end_tone,duration,up,melodic,many);
end
end; {procedure rand_notes}
begin {main}
clrscr;
write(space20);
writeln(title);
writeln;
Set_tone:= 100;
write('Gensound '); Sound_effect(set_tone,set_tone,1,true,true,true);
write('Routine '); Sound_effect(set_tone,set_tone,1,true,true,true);
write('commences at '); Sound_effect(set_tone,set_tone,1,true,true,true);
write('memory '); Sound_effect(set_tone,set_tone,1,true,true,true);
write('location '); Sound_effect(set_tone,set_tone,1,true,true,true);
writeln(addr(sound_effect));Sound_effect(set_tone,set_tone,1,true,true,true);
writeln;
delay(1000);
set_tone :=32; {initialise procedure initsnd}
up := true;
duration := 4;
many := true;
Melodic := true;
end_tone:= 0;
writeln('Ascending Slide ..........');
Sound_effect(set_tone,end_tone,duration,up,melodic,many);
delay(1000);
writeln('Descending Slide .........');
set_tone := 240;
up := false;
Sound_effect(set_tone,end_tone,duration,up,melodic,many);
delay(1000);
writeln('Siren ....................');
duration := 1;
for count := 1 to 2 do
begin
set_tone := 8;
up := true;
Sound_effect(set_tone,end_tone,duration,up,melodic,many);
set_tone := 247;
up := false;
Sound_effect(set_tone,end_tone,duration,up,melodic,many);
end;
delay(1000);
writeln('Single Note ..............');
duration := 1200;
set_tone :=230;
many := false;
Sound_effect(set_tone,end_tone,duration,up,melodic,many);
delay(1000);
writeln('Musical Scale of Sorts ...');
duration := 110;
count := 30; interval := -2;
while count > 1 do
scale;
count := 4; interval := 2;
while count < 33 do
scale;
delay(1000);
writeln('Random Notes .............');
duration := 8;
rand_notes;
delay(1000);
writeln('Chipmunk Chatter .........');
duration := 6;
melodic := false;
rand_notes;
melodic := true; {restore balance}
delay(1000);
writeln('Attention ! ..............');
up := true;
end_tone := 254;
many := true; {restore multiple notes}
for count := 1 to 20 do
begin
set_tone := 250-(count)*2 ;
duration := 20 - (count div 2);
Sound_effect(set_tone,end_tone,duration,up,melodic,many);
delay(15)
end;
delay(1000);
writeln('Gobbled Up ! .............');
set_tone := 195;
duration := 1;
for count := 1 to 3 do
begin
Sound_effect(set_tone,end_tone,duration,up,melodic,many);
delay(200)
end;
delay(1000);
writeln('Rapid Fire ! .............');
for count := 1 to 50 do
begin
Sound_effect(set_tone,end_tone,duration,up,melodic,many);
end;
delay(1000);
writeln('Closing In ...............');
melodic := false;
for count := 80 downto 30 do
begin
set_tone := 280-(count)*3 ;
Sound_effect(set_tone,end_tone,duration,up,melodic,many)
end;
melodic := true;
delay(1000);
writeln('You are Surrounded ! .....');
count := 28; interval := -2;
while count > 1 do
scale;
count := 4; interval := 2;
while count < 31 do
scale;
delay(1000);
writeln('Random Laser Fire ........');
duration := 4;
for count := 1 to 30 do
begin
if (count mod 2) = 0 then
melodic := true
else
melodic := false;
set_tone := 245-random(60) ;
Sound_effect(set_tone,end_tone,duration,up,melodic,many)
end;
delay(1000);
writeln('Bird Warble ..............');
counter := 26;
duration := 12;
for count := 1 to 30 do
begin
if counter = 41 then counter := 26;
set_tone := 255-counter;
Sound_effect(set_tone,end_tone,duration,up,melodic,many);
counter := counter + 1
end;
Writeln('Sample uses PLAY');
for x:=1 to 60 do Play(x,2);
end. {main}