4.7. Reverberation
Speaking human language, the reverb - it's an echo.
The program, which implements this interesting
effect, is essentially a reunion of the two fragments of the
first type from the previous chapter. That is, the program
simultaneously play and record sound in its place a new one.
Here it is:
1415.
10 DI; ban interrupt
20 LOOP1 LD HL, 25000; HL = address of buffer
30 LD DE, 2560; DE = delayed echo
40 LOOP2 LD B, 8; B = bit counter
50 LOOP3 XOR A; A = border color (0)
1960 RRC (HL); scrolling through the data flag
CY
70 JR NC, NOOUT; if CY = 0, then go to
NOOUT
80 OR 16; setting bit D4 register A
90 NOOUT OUT (254), A; output to port A 254
100 RES 7, (HL); reset bit D7 in the memory
110 XOR A; A = 0 (a survey of the entire keyboard)
120 IN A, (254); input values of port 254
130 BIT 6, A; check bit recorder
140 JR Z, NOINP; if 0, then go to NOINP
150 SET 7, (HL); set bit D7 in the memory
160 NOINP CPL; key
170 AND 31; pressed?
180 JR NZ, EXIT; if yes, then go to EXIT
190 LD C, 2; C = delay
200 PAUSE DEC C; C = C-1
210 JR NZ, PAUSE; if C <> 0 then loop
220 DJNZ LOOP3; continue the loop
Byte
230 INC HL; HL = HL +1
240 DEC DE; DE = DE-1
250 LD A, D; DE =
260 OR E; 0?
270 JR NZ, LOOP2; if not, go to
LOOP2
280 JR LOOP1; go to LOOP1
290 EXIT EI; permission to interrupt
300 RET; Returns
2
This routine will run until
as long as you do not press any key. And since it is very
sensitive to this kind of action, cause its better with little
utilities in BASIC:
10 FOR I = 1 TO 10: NEXT I
20 RANDOMIZE USR A
where A - address sub reverb.
If you want to, regardless of
location routines buffer was immediately behind her, then enter
the following lines:
1415.
20 LD HL, BUFFER
310 BUFFER NOP; there is a buffer
2
The line 190 contains a delay value between the samples the
signal. Changing it, You can adjust the ratio of "sound quality
- the amount of memory."
By changing the value in line 30, you can change the delay
of the echo.
One last thing: if you enter
sound output from any device,
echo will be heard once. If using a microphone, you can set
the number of repetitions, adjusting the volume
reproduced sound and the recording level
recorder. If at least one of these
parameters will be below the required level,
then echo sound once. The higher these
parameters, the greater the number of repetitions you
hear (their volume will be, as in life, from time to time to
decline). However, should not get carried away. If you overdo,
then the program samovozbuditsya and all that she will play,
then going to sound terrible contradiction in the background
noise. If this happens, turn off the volume or the microphone
for a few seconds and everything will return to their seats.