C-programming.  The program is to view a sequence of 30 points of speech data.  The display will be shown in 5 columns with 6 data each.  Then the program will show the statistic of its average power, average magnitude and how many zero crossings. Zero crossing is the event when the multiplication of two consecutive data result in negative number.  /*––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––*/ /*  Homework #9 program                                       */ /*                                                            */ /*  This program computes average power, average magnitude    */ /*  and zero crossings from a speech signal.                  */ #include #include #define MAXIMUM 50 int main(void) {    /*  Declare variables   */    int k=0, npts=30;    double speech[MAXIMUM]={0.000000,-0.023438,-0.031250,-0.031250,-0.039063,-0.039063,-0.023438,0.000000,0.023438,0.070313,-0.039063,-0.039063,0.046875,0.101563,0.117188,0.101563,0.070313,0.054688,0.023438,0.000000,-0.031250,-0.039063,-0.070313,-0.070313,-0.070313,-0.070313,-0.062500,-0.046875,-0.039063,-0.031250};    /* Declare the function prototypes */                     /*  Compute and print statistics.  */    printf("\n SPEECH DATA ");    print(,,);//complete the statement    printf("\n");    printf(" SPEECH STATISTICS : \n");    printf(" average power: %f \n",);//complete the statement    printf(" average magnitude: %f \n",);//complete the statement    printf(" zero crossings: %d \n",);//complete the statement    /*  Exit program.  */    return 0; } /*   This function prints the data in the number of desired */ /*   column numcols                                         */ void print(double x[], int npts, int numcols) {    int i,j;    printf("\n ");    for(j=0;j

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question

C-programming

The program is to view a sequence of 30 points of speech data.  The display will be shown in 5 columns with 6 data each.  Then the program will show the statistic of its average power, average magnitude and how many zero crossings.

Zero crossing is the event when the multiplication of two consecutive data result in negative number. 

/*––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––*/
/*  Homework #9 program                                       */
/*                                                            */
/*  This program computes average power, average magnitude    */
/*  and zero crossings from a speech signal.                  */

#include <stdio.h>
#include <math.h>
#define MAXIMUM 50

int main(void)
{
   /*  Declare variables   */
   int k=0, npts=30;
   double speech[MAXIMUM]={0.000000,-0.023438,-0.031250,-0.031250,-0.039063,-0.039063,-0.023438,0.000000,0.023438,0.070313,-0.039063,-0.039063,0.046875,0.101563,0.117188,0.101563,0.070313,0.054688,0.023438,0.000000,-0.031250,-0.039063,-0.070313,-0.070313,-0.070313,-0.070313,-0.062500,-0.046875,-0.039063,-0.031250};
   /* Declare the function prototypes */
   
   
   
  
 
   /*  Compute and print statistics.  */
   printf("\n SPEECH DATA ");
   print(,,);//complete the statement
   printf("\n");
   printf(" SPEECH STATISTICS : \n");
   printf(" average power: %f \n",);//complete the statement
   printf(" average magnitude: %f \n",);//complete the statement
   printf(" zero crossings: %d \n",);//complete the statement


   /*  Exit program.  */
   return 0;
}

/*   This function prints the data in the number of desired */
/*   column numcols                                         */
void print(double x[], int npts, int numcols)
{
   int i,j;
   printf("\n ");
   for(j=0;j<numcols;j++)
       printf("-----------");
   printf("\n");
   for(j=0;j<numcols;j++)
   {
      printf("   %2d to %2d",((npts/numcols)*j)+1,((npts/numcols)*j)+(npts/numcols));
   }
   printf("\n ");
   for(j=0;j<numcols;j++)
       printf("-----------");
   printf("\n");
   for(i=0;i<npts/numcols;i++)
   {
       for(j=0;j<numcols;j++)
           printf("%11.6lf",x[((npts/numcols)*j)+i]);
       printf("\n");
   }
}
/*––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––*/
/*  This function returns the average power of an array x     */
/*  with npts elements.                                       */

double ave_power(double x[],int npts)
{
   /*  Declare and initialize variables.  */
   int k;
   double sum=0;

   /*  Determine average power.  */
   for (k=0; k<=npts-1; k++)
      sum += x[k]*x[k];

   /*  Return average power.  */
   return sum/npts;
}
/*––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––*/
/*  This function returns the average magnitude of an array x */
/*  with npts elements.                                       */

double ave_magn(double x[],int npts)
{
   /*  Declare and initialize variables.  */
   int k;
   double sum=0;

   /*  Determine average power.  */
   for (k=0; k<=npts-1; k++)
      sum += fabs(x[k]);

   /*  Return average magnitude.  */
   return sum/npts;
}


/*––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––*/
/*  This function returns a count of the number of zero       */
/*  crossings in an array x with npts values.                 */

int crossings(double x[],int npts)
{
   /*  Declare and initialize variables.  */
   int count=0, k;

   /*  Determine number of zero crossings.  */
   for (k=0; k<=npts-2; k++)
      if (x[k]*x[k+1] < 0)
         count++;

   /*  Return number of zero crossings.  */
   return count;
}
/*––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––*/

 

### Speech Data Analysis

#### Speech Data Matrix

The matrix below represents segments of speech data, categorized into intervals:

|    | 1 to 6  | 7 to 12 | 13 to 18 | 19 to 24 | 25 to 30 |
|----|---------|---------|----------|----------|----------|
| 1  | 0.000000 | -0.023438 | 0.046875 | 0.023438 | -0.070313 |
| 2  | -0.023438 | 0.000000 | 0.101563 | 0.000000 | -0.070313 |
| 3  | -0.031250 | 0.023438 | 0.117188 | -0.031250 | -0.062500 |
| 4  | -0.031250 | 0.070313 | 0.101563 | -0.039063 | -0.046875 |
| 5  | -0.039063 | -0.039063 | 0.070313 | -0.070313 | -0.039063 |
| 6  | -0.039063 | -0.039063 | 0.054688 | -0.070313 | -0.031250 |

#### Speech Statistics

The following statistics provide insights into the properties of this speech data:

- **Average Power:** 0.003019
- **Average Magnitude:** 0.046875
- **Zero Crossings:** 2

This data analysis helps in understanding the dynamics of speech patterns, essential for fields like speech recognition, signal processing, and acoustic studies.
Transcribed Image Text:### Speech Data Analysis #### Speech Data Matrix The matrix below represents segments of speech data, categorized into intervals: | | 1 to 6 | 7 to 12 | 13 to 18 | 19 to 24 | 25 to 30 | |----|---------|---------|----------|----------|----------| | 1 | 0.000000 | -0.023438 | 0.046875 | 0.023438 | -0.070313 | | 2 | -0.023438 | 0.000000 | 0.101563 | 0.000000 | -0.070313 | | 3 | -0.031250 | 0.023438 | 0.117188 | -0.031250 | -0.062500 | | 4 | -0.031250 | 0.070313 | 0.101563 | -0.039063 | -0.046875 | | 5 | -0.039063 | -0.039063 | 0.070313 | -0.070313 | -0.039063 | | 6 | -0.039063 | -0.039063 | 0.054688 | -0.070313 | -0.031250 | #### Speech Statistics The following statistics provide insights into the properties of this speech data: - **Average Power:** 0.003019 - **Average Magnitude:** 0.046875 - **Zero Crossings:** 2 This data analysis helps in understanding the dynamics of speech patterns, essential for fields like speech recognition, signal processing, and acoustic studies.
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps with 1 images

Blurred answer
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY