Digital Signal Processing Lab Report 8 Fa19-Bee-106

You might also like

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 5

\

DIGITAL SIGNAL PROCESSING

Name: AHMAR ARSHAD

Registration Number: FA19-BEE-106

TITLE: LAB REPORT 8

Instructor’s Name: MIAN AHMAD YASSER

LAB # 8: To assemble the experiment of Sampling and Quantization of real time


\

Audio Signals on DSP Kit TMS320C6713; analyze the effect of Aliasing and
Quantization Noise
Objectives:
 To perform sampling theorem on a real time signal using DSK 6713.
 To observe the effect of sampling and quantization on the signal on DSK 6713.
Requirements:
Software
 Code Composer Studio
Hardware

 DSK 6713

Methodology:
 I was advised to set up CSS and DSK 6713 by the lab instructor at this lab. I started the
virtual machine first, attached the hardware kit and ran the kit tester. Following this, I
have built-up a new CSS project and before executing any code put up all the
parameters needed.
 I utilized the template given for the kit once the setup was finished. I used audio from a
YouTube link for the first lab activity. My phone was linked to the DSK kit and the
audio was played. I listened to the audio using headphones utilizing audio from the
DSK. The difference between two audio quality was compared.
 I switched the sound between the right and the left of the headphones for the second
challenge of the lab by changing the code.
 I increased the audio sample by a one-and-a-zero sampling train in job 3. The goal was
to generate all additional audio samples.
 I quantified the B number of bits for the last task in which I had 1<B<16. • Make 16-Bit
shifts to the right and left. I could knock a few of bits off so I could quantify this signal
at a lower rate.

Results and Conclusion


I have experienced setup and execution of code on DSK 6713 as a consequence of this lab. After several
fruitless tries I was eventually able to get the kit functioning. I learnt how real-world audio sources can
be sampled and quantified in real time. After the sample and quantification, I have been able to see and
hear the impacts of noise.

Lab Task
\

Task 1:
Solution:
//AHMAR ARSHAD
//FA19-BEE-106
#include<dsk6713.h>
#include<dsk6713_aic23.h>
#include<dsk6713_led.h>
#include<dsk6713_dip.h>
#include<math.h> // to configure codec
DSK6713_AIC23_Config config = { 0x0017, /* 0 - DSK6713_AIC23_LEFTINVOL Left
line input channel volume */ 0x0017, /* 1 - DSK6713_AIC23_RIGHTINVOL Right
line input channel volume */ 0x01f9, /* 2 - DSK6713_AIC23_LEFTHPVOL Left
channel headphone volume */ 0x01f9, /* 3 - DSK6713_AIC23_RIGHTHPVOL Right
channel headphone volume */ 0x0011, /* 4 DSK6713_AIC23_ANAPATH Analog audio
path control */ 0x0000, /* 5 DSK6713_AIC23_DIGPATH Digital audio path
control */ 0x0000, /* 6 DSK6713_AIC23_POWERDOWN Power down control */
0x0043, /* 7 DSK6713_AIC23_DIGIF Digital audio interface format */
0x0081, /* 8 DSK6713_AIC23_SAMPLERATE Sample rate control */ 0x0001 /* 9
DSK6713_AIC23_DIGACT Digital interface activation */ };
void main()
{ DSK6713_AIC23_CodecHandle hCodec;
Uint32 IN,OUT;
Uint16 OUT_L,OUT_R;
DSK6713_init(); // Initialize the DSK6713 board
DSK6713_LED_init();// Initialize the DSK6713 board leds
hCodec = DSK6713_AIC23_openCodec(0, &config); // Start the codec
DSK6713_AIC23_setFreq(hCodec, DSK6713_AIC23_FREQ_8KHZ); // Set codec
frequency to 8KHz
while(1) {
/* Read 32 bit sample from the audio channel */
while (!DSK6713_AIC23_read(hCodec, &IN));
/*Typecasting */
OUT_L = IN;
OUT_R = IN;
/* Read 16-bit samples to right and left audio channel */
while (!DSK6713_AIC23_write(hCodec, OUT_L));
while (!DSK6713_AIC23_write(hCodec, OUT_R));
if(DSK6713_DIP_get(1)==0)
break;}

/* Close the codec */


DSK6713_LED_on(1);
DSK6713_AIC23_closeCodec(hCodec);
}
Task 2:
Solution:
//AHMAR ARSHAD
//FA19-BEE-106

#include<dsk6713.h>
#include<dsk6713_aic23.h>
#include<dsk6713_led.h>
#include<dsk6713_dip.h>
#include<math.h> // to configure codec
DSK6713_AIC23_Config config = { 0x0017, 0x0017,0x01f9, 0x01f9,0x0011,
0x0000, 0x0000, 0x0043, 0x0081, 0x0001 };
#define D 16000 // represents 2 sec at fs = 8 kHz
short d=0; // move these before main()
Uint32 xL, xR, yL, yR;
void main()
\

{ DSK6713_AIC23_CodecHandle hCodec;

DSK6713_init(); // Initialize the DSK6713 board


DSK6713_LED_init();// Initialize the DSK6713 board leds
hCodec = DSK6713_AIC23_openCodec(0, &config); // Start the codec
DSK6713_AIC23_setFreq(hCodec, DSK6713_AIC23_FREQ_8KHZ); // Set codec
frequency to 8KHz
while(1) {
/* Read 32 bit sample from the audio channel */
while (!DSK6713_AIC23_read(hCodec, &xL));
while (!DSK6713_AIC23_read(hCodec, &xR));
/*Typecasting */
yL = (d < D) * xL;
yR = (d >= D) * xR;
if (++d >= 2*D) d=0;
/* Read 16-bit samples to right and left audio channel */
while (!DSK6713_AIC23_write(hCodec, yL));
while (!DSK6713_AIC23_write(hCodec, yR));
if(DSK6713_DIP_get(1)==0)
break;}

/* Close the codec */


DSK6713_LED_on(1);
DSK6713_AIC23_closeCodec(hCodec);
}

Task 3:
Solution:
//AHMAR ARSHAD
//FA19-BEE-106

#include<dsk6713.h>
#include<dsk6713_aic23.h>
#include<dsk6713_led.h>
#include<dsk6713_dip.h>
#include<math.h> // to configure codec
DSK6713_AIC23_Config config = { 0x0017, 0x0017,0x01f9, 0x01f9,0x0011,
0x0000, 0x0000, 0x0043, 0x0081, 0x0001 };

#define D 16000 // represents 2 sec at fs = 8 kHz


Uint32 pulse=0;
short d=0; // move these before main()
Uint32 xL, xR, yL, yR;
void main()
{ DSK6713_AIC23_CodecHandle hCodec;

DSK6713_init(); // Initialize the DSK6713 board


DSK6713_LED_init();// Initialize the DSK6713 board leds
hCodec = DSK6713_AIC23_openCodec(0, &config); // Start the codec
DSK6713_AIC23_setFreq(hCodec, DSK6713_AIC23_FREQ_8KHZ); // Set codec
frequency to 8KHz
while(1) {
/* Read 32 bit sample from the audio channel */
while (!DSK6713_AIC23_read(hCodec, &xL));
while (!DSK6713_AIC23_read(hCodec, &xR));
/*Typecasting */
yL = pulse * xL;
yR = pulse * xR;
\

pulse = (pulse==0);
/* Read 16-bit samples to right and left audio channel */
while (!DSK6713_AIC23_write(hCodec, yL));
while (!DSK6713_AIC23_write(hCodec, yR));
if(DSK6713_DIP_get(1)==0)
break;}

/* Close the codec */


DSK6713_LED_on(1);
DSK6713_AIC23_closeCodec(hCodec);
}

Task 4:
Solution:
//AHMAR ARSHAD
//FA19-BEE-106

#include<dsk6713.h>
#include<dsk6713_aic23.h>
#include<dsk6713_led.h>
#include<dsk6713_dip.h>
#include<math.h> // to configure codec
DSK6713_AIC23_Config config = { 0x0017, 0x0017,0x01f9, 0x01f9,0x0011,
0x0000, 0x0000, 0x0043, 0x0081, 0x0001 };
#define D 16000 // represents 2 sec at fs = 8 kHz
Uint32 pulse=0;
short d=0; // move these before main()
Uint32 xL, xR, yL, yR;
Uint32 L=16;
void main()
{ DSK6713_AIC23_CodecHandle hCodec;

DSK6713_init(); // Initialize the DSK6713 board


DSK6713_LED_init();// Initialize the DSK6713 board leds
hCodec = DSK6713_AIC23_openCodec(0, &config); // Start the codec
DSK6713_AIC23_setFreq(hCodec, DSK6713_AIC23_FREQ_8KHZ); // Set codec
frequency to 8KHz
while(1) {
/* Read 32 bit sample from the audio channel */
while (!DSK6713_AIC23_read(hCodec, &xL));
while (!DSK6713_AIC23_read(hCodec, &xR));
/*Typecasting */
yL = (xL >> L) << L;
yR = (xR >> L) << L;
/* Read 16-bit samples to right and left audio channel */
while (!DSK6713_AIC23_write(hCodec, yL));
while (!DSK6713_AIC23_write(hCodec, yR));
if(DSK6713_DIP_get(1)==0)
break;}

/* Close the codec */


DSK6713_LED_on(1);
DSK6713_AIC23_closeCodec(hCodec);
}

You might also like