ZX Forum #04
19 ноября 1997 |
|
world of sound Spectrum - chapter 4.3: Sound Effects - Management timbre.
4.3. Timbre control To control the timbre of ZX-Spectrum since did not fit as well as for management volume. But, as the volume, it can be controlled within a small range. As you already know, the tone depends on the form of sound waves. As adapted for sound shaping subroutine Volume control is not so easy Made of different waveforms will have to do only two levels of volume. This can be done, for example, by using a subroutine: 1415. 10 DI; ban interrupt 20 LOOP1 LD B, 8; B = rate 30 LOOP2 XOR A; A = border color (0) 40 RLC E; scroll through the tone flag CY 1415. 50 JR NC, NOSIGN; if the flag CY = 0, then go on NOSIGN 60 OR 16; setting bit D4 register A 70 NOSIGN OUT (254), A; output to port A 254 80 LD D, H; D = delay 90 PAUSE DEC D; D = D-1 100 JR NZ, PAUSE; if D <> 0 then loop 110 DJNZ LOOP2; cycle rate 120 LD A, H; A = H 130 ADD A, L; add L to the A 140 LD H, A; H = A 150 DEC C; C = C-1 160 JR NZ, LOOP1; if C <> 0 then loop 170 EI; permission to interrupt 180 RET; Returns 2 Before calling this subroutine to the register C Record length of notes in the register H - frequency, the register L - frequency offset (subject to negative value and nil), and in the case E - timbre. Please note that not all register values E have meaning. Thus, at a value equal to E 255 or 0 You do not hear anything, and Tone 1 and 128 will sound absolutely equally, etc. In essence, it makes sense to use Only the following 19 tones: 1,3,5,7,9,11, 13,15,17,19,21,23,25,27,37,43,45,51 and 85. All other values are treated similarly to hearing it. The above program is only example. You may well write their own, reproducing sound with a 16-bit tone, or timbre, previously recorded in memory to a tape inputs (see Chapter 4.6).
Other articles:
Similar articles:
В этот день... 23 November