Try rewriting the Program so that you have a linear increase in volume to halfway through the sound, then linearly decrease the volume down to zero in the second half.
What will be an ideal response?
```
public void linear IncreaseDecrease (double maxChange )
{
int length = this . getLength ( ) ;
int half = length / 2 ;
double change = maxChange / half ;
double totalChange = change ;
int value = 0 ;
// loop increasing each time to half
for ( int i = 0 ; i < h a l f ; i++)
{
value = this . getSampleValueAt ( i ) ;
value = ( int ) ( value * totalChange ) ;
totalChange = totalChange + change ;
this . setSampleValueAt ( i , value ) ;
}
// loop decreasing each time to end
for ( int i = h a l f ; i < this . getLength ( ) ; i++)
{
value = this . getSampleValueAt ( i ) ;
totalChange = totalChange - change ;
value = ( int ) ( value ยค totalChange ) ;
this . setSampleValueAt ( i , value ) ;
}
}
```
You might also like to view...
The term ________ means criminal activity on the Internet
Fill in the blank(s) with correct word
A nontaxable bond pays interest at 5 percent a year. What interest rate would a taxable bond need to pay to yield the same after-tax income as the non-taxable bond? The tax rate is 28 percent
Its easier to work this problem with the rates in decimal form. So at the beginning divide the given rates by 100. At the end, convert the result to a percent by multiplying by 100. Let v = the value of taxable bond. Letp = the interest rate of the taxable bond. Interest on the nontaxable bond = 0.05v Interest on the taxable bond pv Tax on taxable interest = 0.28pv After-tax income = taxable interest โ =pv โ 0.28pv =(1 โ 0.28)pv after factoring out pv after subtracting = 0.72pv tax on taxable interest