Digital Signal Processing (Part 4)
Concluding The Digital To Analogue Programs
Part 4: ZX Spectrum freezes echoes.
A single shot playback routine, "i", is available on the Digisounder 3 cassette and similar considerations apply to this as to the continuous replay described in Part 3. This machine code program is, however, shorter and consequently faster. Thus a shift value of 1 will produce a frequency output of 1668 Hz, from a synthesized waveform, while responses of 10 and 50 will result in frequencies of 606 and 158 Hz.
To play the synthesized sound, or any other sound in memory, then simply press the HOLD button on the D to A Controller. To return to Basic press the REST button on the A to D Controller and keep it pressed until the current sound has finished playing. If the action of the REST switch seems erratic then place a 4k7 resistor between ground and the terminal going to the 8255 PPI.
The other playback routine is a simple sequencer which is accessed by entering "z" and again it will play whatever sound is in memory. You will be prompted by 'Do you want a new sequence? (y/n)' and for the first time the answer must be "y" for yes. The next prompt is for 'length' which is the number of notes in the sequence. Since manual entry of notes is rather tedious, the maximum number of notes has been limited to 50.
The next question is 'speed?' and a value of 30,000 should be entered initially since this produces a satisfactory tempo. A correction factor has been incorporated into the program such that changing the pitch of the note does not alter its playback time. The result of this, however, is that if one enters a low value for speed and uses some high pitch shift values (low frequencies) then spurious sounds may be generated. The limits will be easily established by the user.
The final question is the 'shift' value and this should be a number between 1 and 255. The frequency corresponding to the pitch shift number is the same as in the single shot program. This last prompt will appear for as many times as the length (number of notes) entered earlier. When the last pitch shift value has been entered then this simple sequencer will continuously play the notes entered. The HOLD button is used to stop playback and return you to the menu, while subsequently re-entering "z" and responding "n" to the initial question will re-start the sequence.
The "save" and "load" routines are conventional and the main thing to remember is that saving or loading 30K of memory onto cassette is a slow process. It is compatible with the earlier DIGISCOPE 3 programs and so waveforms may be saved with the latter and then loaded into the DIGISOUNDER 3 program. If such waveforms are replayed using the "h", continuous replay, then the output frequency will be essentially the same as the original input. If, however, it is replayed using the single shot or sequencer routines, then the output frequency will be somewhat higher than the original. It would have been a simple matter to incorporate some delays into the latter routines so as to make all programs operate at the same speed, but it was considered more useful to achieve a maximum rate rather than reduce speed to that of the slowest program.
There are a couple of ways of 'freezing' a sample in memory. First, when the HOLD button is pressed on leaving the echo program the memory will contain a sample equal in length to the delay/expansion factors set. As an example, use the default setting and enter a delay of two seconds. Next connect a microphone to the input of the D to A Controller and enter a word or phrase shorter than two seconds. Press HOLD before the sound is played out through the memory and this captured sound may then be replayed forwards or backwards using one of the techniques described above. Alternatively, one may use the single load, "o", routine which provides for setting the length of memory to be used. After entering this sample length pressing ENTER will start the sampling process and when complete the user is automatically returned to the main menu whereupon one can call up a replay routine.
This concludes the working description of the digital to analogue programs and there is ample opportunity for the user to experiment with, or modify, the routines. In fact this is the main objective of providing user accessible programs. Also, remember that the hardware has been made accessible - one such addition could be a facility to synchronize the single shot playback with an external sequencer. To do this it is only necessary to provide a +5V logical signal to the PPI side of the HOLD button on the digital to analogue controller. We have thus provided a comprehensive capability combined with the opportunity for user experimentation. But it does not end there, since additional software for the system will be added, such as the envelope programs which also appear as this month's special microproject.