# 8.16 In method normalize that will on find page the 281, smallest w...

## Transcribed Text

8.16 In method normalize that will on find page the 281, smallest we found value the in largest the sound value and in print the sound it out, Write a method if increase a volume too far? Explore that and by creating 8.17 What happens then you increase the volume once, and again, again. Docs it Sound always object, keep getting louder? Or does something else happen? Can you 8.18 Instead of multiplying samples by a multiplier (like 2 or 0.5), try adding a explain why? value to them. What happens to a sound if you add 100 to every sample? What happens if you add 1,000 to every sample? counde What hannanter 9.1 What does each of the following mean: Clip Splice Reverse Mirror 9.2 What will be output from the following code: public void test10 { for (int x = 5; x > 0; x--) { System.out.println(x); } }

## Solution Preview

These solutions may offer step-by-step problem-solving explanations or good writing examples that include modern styles of formatting and construction of bibliographies out of text citations and references. Students may use these solutions for personal skill-building and practice. Unethical use is strictly forbidden.

8.16 In method normalize on page 281, we found the largest value in the sound. Write a method that will find the smallest value in the sound and print it out.
public void normalize(){
int smallest = 999999;
int minIndex = 0;
SoundSample[] sampleArray = this.getSamples();
SoundSample sample = null;
int value = 0;

for (int i=0; i <sampleArray.length; i++){
sample = sampleArray[i];
value = Math.abs(sample.getValue());
if(value < smallest){
smallest = value;
minIndex = i;
}
}

double multiplier = 32767.0 / smallest;
System.out.println("The smallest value was " + smallest +
" at index " + minIndex);
System.out.println("The multiplier is " + multiplier);

for(int i=0; i < sampleArray.length; i++){
sample = sampleArray[i];
sample.setValue((int) (sample.getValue() * multiplier));
}
}...

By purchasing this solution you'll be able to access the following files:
Solution.docx.

\$45.00
for this solution

PayPal, G Pay, ApplePay, Amazon Pay, and all major credit cards accepted.

### Find A Tutor

View available Java Programming Tutors

Get College Homework Help.

Are you sure you don't want to upload any files?

Fast tutor response requires as much info as possible.