Question: *C++ Write a function normalize to normalize a sound. Its parameters should be the same as those for reverse() . Normalizing the sound samples array

*C++

Write a function normalize to normalize a sound. Its parameters should be the same as those for reverse() . Normalizing the sound samples array is a two step process. Find the maximum (highest) value in the samples array. Multiply all values in the samples array by 36773 and divide by the maximum value.

Examples

[0, 1, 2, 3] --> [0, 1*36773/3, 2*36773/3, 3*36773/3]

[3, 2, 1, 0] --> [3*36773/3, 2*36773/3, 1*36773/3, 0]

[5, 8, 10] --> [5*36773/10, 8*36773/10, 10*36773/10]

This is the reverse function:

void reverse(int* samples, int size)

{

int i=0, j=size-1;

while(i<=j)

{ int temp = samples[i];

samples[i] = samples[j];

samples[j] = temp; i++;

j--;

}

}

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!