<< Chapter < Page | Chapter >> Page > |
Many audio effects require storing thousands of samples in memory on the DSP. Because there is not enough memory on theDSP microprocessor itself to store so many samples, external memory must be used.
In this exercise, you will use external memory to implement a long audio delay and an audio echo. Refer to Core File: Accessing External Memory on TI TMS320C54x for a description and examples of accessingexternal memory.
You will implement three audio effects: a long, fixed-length delay, a variable-length delay, and a feedback-echo.
First, implement the 131,072-sample delay shown in
[link] using the
READPROG
and
WRITPROG
macros. Use memory locations
010000h
-
02ffffh
in external
Program RAM to do this; you may also want to use the
dld
and
dst
opcodes to store and
retrieve the 32-bit addresses for the accumulators. Notethat these two operations store the words in memory in
big-endian order, with the high-order word first.
Remember that arithmetic operations that act on the
accumulators, such as the
add
instruction,
operate on the complete 32- or 40-bit value. Also keep inmind that since 131,072 is a power of two, you can use
masking (via the
and
instruction) to implement
the circular buffer easily. This delay will be easy toverify on the oscilloscope. (How long, in seconds, do you
expect this delay to be?)
Once you have your fixed-length delay working, make a copy and modify it so that the delay can be changed to any lengthbetween zero (or one) and 131,072 samples by changing the value stored in one double-word pair in memory. You shouldkeep the buffer length equal to 131,072 and change only your addressing of the sample being read back; it is moredifficult to change the buffer size to a length that is not a power of two.
Verify that your code works as expected by timing the delay from input to output and ensuring that it is approximatelythe correct length.
Last, copy and modify your code so that the value taken from the end of the variable delay from Variable-delay implementation is multiplied by a gain factor and then added back into theinput, and the result is both saved into the delay line and sent out to the digital-to-analog converters. [link] shows the block diagram. (It may be necessary to multiply the input by a gain as well toprevent overflow.) This will make a one-tap feedback echo, an simple audio effect that sounds remarkably good. To testthe effect, connect the DSP EVM input to a CD player or microphone and connect the output to a loudspeaker. Verifythat the echo can be heard multiple times, and that the spacing between echoes matches the delay length you havechosen.
Notification Switch
Would you like to follow the 'Dsp laboratory with ti tms320c54x' conversation and receive update notifications?