Digital Signal Processing Reference
In-Depth Information
// Sine_stereo.c Sine generation with output to both channels
#include "dsk6713_aic23.h" //codec-DSK support file
Uint32 fs=DSK6713_AIC23_FREQ_8KHZ; //set sampling rate
#define LEFT 0
//reversed in init file
#define RIGHT 1
union {Uint32 combo; short channel[2];} AIC23_data;
short loop = 0, gain = 10;
short sine_table[8]={0,707,1000,707,0,-707,-1000,-707};//sine values
interrupt void c_int11()
//interrupt service routine
{
AIC23_data.channel[RIGHT]=sine_table[loop]*gain; //for right channel
AIC23_data.channel[LEFT]=sine_table[loop]*gain; //for left channel
output_sample(AIC23_data.combo); //output to both channels
if (++loop > 7) loop = 0;
//reint index if @ end of table
}
void main()
{
comm_intr(); //init DSK, codec, McBSP
while(1) ;
//infinite loop
}
FIGURE 2.7. Sine generation with stereo outputs ( sine_stereo.c ).
two adapters are required to verify that the output from the right channel is the
2-kHz sine wave from the right input channel. You can also use one adapter at the
input side to capture the two different signals and one stereo cable at the output
side.
Experiment with this project, inputting different signals into each channel and
outputting from each channel using adapters and stereo cable. Verify that you can
select each input and output channel independently.
Sine Generation with Stereo Output ( sine_stereo )
Figure 2.7 shows the C source file sine _ stereo.c , included in the folder sine _ stereo ,
to illustrate further the codec as a stereo device. Build and run this project as
sine _ stereo . Verify that the generated 1 kHz sinusoid is through both output chan-
nels, using an adapter or stereo cable at the output side of the DSK.
Example 2.4: Sine Generation with Two Sliders for Amplitude and
Frequency Control ( sine2sliders )
The polling-based program sine2sliders.c in Figure 2.8 generates a sine wave. Two
sliders are used to vary both the amplitude (gain) and the frequency of the sinusoid
Search WWH ::




Custom Search