unit noiz; { NOIZ.PAS Copyright (c) 1990 DSoft Specialties } interface { Sound routines for the Tandy 1000 and/or PCJr } { All I ask is if you use any of these routines in your program please mention DSoft in the docs or in a copyright message } const inturbo: boolean = true; { true=shorter delay in wait(dtime) } type voices = 0..3; { voices for the TI chip } attenuations = 0..15; { volume level } styles = 1..4; { for the PLAY routine } const { Musical Notes A1 - GS10, use these instead of frequencies } A1 = 27; A2 = 55; A3 = 110; A4 = 220; A5 = 440; A6 = 880; A7 = 1760; B1 = 31; B2 = 62; B3 = 123; B4 = 247; B5 = 494; B6 = 988; B7 = 1976; C1 = 33; C2 = 65; C3 = 131; C4 = 262; C5 = 523; C6 = 1047; C7 = 2093; D1 = 37; D2 = 74; D3 = 147; D4 = 294; D5 = 588; D6 = 1175; D7 = 2349; E1 = 41; E2 = 83; E3 = 165; E4 = 330; E5 = 660; E6 = 1320; E7 = 2640; F1 = 44; F2 = 88; F3 = 175; F4 = 350; F5 = 700; F6 = 1400; F7 = 2800; G1 = 49; G2 = 98; G3 = 196; G4 = 392; G5 = 784; G6 = 1568; G7 = 3136; A8 = 3520; A9 = 7040; A10 = 14080; B8 = 3952; B9 = 7904; B10 = 15808; C8 = 4160; C9 = 8320; C10 = 16640; D8 = 4704; D9 = 9408; D10 = 18816; E8 = 5280; E9 = 10560; F8 = 5600; F9 = 11200; G8 = 6272; G9 = 12544; AS1 = 29; AS2 = 58; AS3 = 116; AS4 = 231; AS5 = 466; AS6 = 928; AS7 = 1856; CS1 = 34; CS2 = 69; CS3 = 139; CS4 = 277; CS5 = 554; CS6 = 1108;CS7 = 2240; DS1 = 39; DS2 = 78; DS3 = 156; DS4 = 311; DS5 = 622; DS6 = 1244;DS7 = 2496; FS1 = 46; FS2 = 93; FS3 = 185; FS4 = 370; FS5 = 740; FS6 = 1480;FS7 = 2960; GS1 = 26; GS2 = 52; GS3 = 208; GS4 = 415; GS5 = 830; GS6 = 1660;GS7 = 3320; AS8 = 3712; AS9 = 7424; AS10 = 14848; CS8 = 4480; CS9 = 8960; CS10 = 17920; DS8 = 4992; DS9 = 9984; DS10 = 19968; FS8 = 5920; FS9 = 11840; GS8 = 6640; GS9 = 13280; const { these are for the NOTE1 and NOTE4 routines } stacatto: boolean = false; legato: boolean = false; zetto: boolean = false; xetto: boolean = false; dtime: integer = 80; procedure wait(time: longint); { like CRT units delay routine } procedure sound(freq: word); { like CRT units sound routine } procedure nosound; { like CRT units NoSound routine } procedure sound_off; { shut all voices off } procedure extsound(freq,dur: integer;level: attenuations;voice: voices); { freq = the note to play dur = the duration level = the volume level voice = the voice (1 - 3) } procedure plays(freq,dur: word;attack,decay: integer;voice: voices); { freq = the note to play dur = the duration attack = the time it takes note to reach max volume decay = how long it takes note to fade out from max volume voice = the voice (1 - 3) } procedure chord(freq1,freq2,freq3,dur,level: integer); { - does a 3 note chord - freq1 = a note freq2 = another note freq3 = one more note dur = duration level = volume level } procedure play(freq,dur: integer;v: voices;style: styles); procedure noise(ch: char;sr,atten,dur: word); procedure note1(freq,dura: word); procedure note4(note,dura: integer); procedure dubend(freq1,freq2,dt: integer); procedure bend(tone,tone1,tonedur,dur,reps: integer); procedure scale(freq1,freq2,freq3: integer;a,b,c,d,e,f,g,aa: integer); procedure scale2(a,b,c,d,e,f,g,z: integer;dtime,attack,decay: integer; v: voices); procedure quiet; { turns all 3 voices and normal PC sound off. Also, turns noise off } function fkey: char; { like CRT's ReadKey, but if its a function key add 128 to the value of fkey NOTE: #187 = F1 #196 = F10 Syntax: ch:=upcase(fkey); case ch of '1':; #187: writeln('F1 hit'); #196: halt; end; } function keyhit: boolean; { like CRT's KeyPressed } implementation