Digital Signal Processing Reference
In-Depth Information
Run the MATLAB program and verify Figure 10.14 b as the spectrogram of
a chirp signal. It illustrates the increase in frequency of the swept sinusoidal
signal over time. You can readily test other .wav files on the CD, such as
speech_RTDSP.wav (on the CD) with the spoken words “Real-Time Digital
Signal Processing.”
10.8.2 Spectrogram with RTDX Using MATLAB
This version of the project makes use of RTDX with MATLAB for transferring data
from the DSK to the PC host. Section 9.1 introduces the use of a configuration
( .cdb ) file and Section 9.2 illustrates RTDX with MATLAB.
Figure 10.15 a shows the core source program spectrogram_rtdx_mtl.c that
runs on the DSK and can be readily completed using the program FFT256c.c in
Chapter 6 (the complete executable file is on the CD). It calls the C-coded FFT
function used in Chapter 6 and enables an RTDX output channel to write/send the
// Partial_Spectrogram_rtdx_mtl.c Core program for Time-Frequency
//analysis with spectrogram using RTDX-MATLAB
. . . See FFT256c.c
#include <rtdx.h>
//RTDX support file
#include "hamming.cof"
//Hamming window coefficients
RTDX_CreateOutputChannel(ochan);
//create output channel C6x->PC
main()
{
//. . . calculate twiddle constants
comm_intr(); //init DSK, codec, McBSP
while(!RTDX_isOutputEnabled(&ochan)) //wait for PC to enable RTDX
puts("\n\n Waiting . . . "); //while waiting
while(1)
//infinite loop
{
. . .
for (i = 0 ; i < PTS ; i++) //swap buffers
{
samples[i].real=h[i]*iobuffer[i];//multiply by Hamming coeffs
iobuffer[i] = x1[i]; //process frame to iobuffer
}
. . . use FFT magnitude squared
RTDX_write(&ochan,x1,sizeof(x1)/2);//send 128 samples to PC
} //end of infinite loop
}
//end of main
interrupt void c_int11()
//ISR
{. . . as in FFT256c.c }
( a )
FIGURE 10.15. Spectrogram using RTDX with MATLAB: ( a ) core program to calculate
FFT and transfer FFT data from the DSK to the PC; ( b ) spectrogram plot of an external
chirp input signal; ( c ) spectrogram plot of a 500-Hz square wave input signal.
Search WWH ::




Custom Search