Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

*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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Transactions On Large Scale Data And Knowledge Centered Systems Xxiv Special Issue On Database And Expert Systems Applications Lncs 9510

Authors: Abdelkader Hameurlain ,Josef Kung ,Roland Wagner ,Hendrik Decker ,Lenka Lhotska ,Sebastian Link

1st Edition

366249213X, 978-3662492130

More Books

Students also viewed these Databases questions