Write a method to triple the frequency of a sound.

What will be an ideal response?

```
/**
* Method to t r i p l e the f r e quenc y of a sound by t a k ing
* e v e ry t h i r d sample . The r e s u l t w i l l be a h i g h e r
* sound .
*/
public void t r i p l eFr e q ( )
{
// make a copy of the o r i g i n a l sound
Sound s = new Sound ( this . getFi leName ( ) ) ;
/* loop through the sound and increment t a r g e t inde x
* by one but source inde x by 3 and s e t t a r g e t v a lue
* to the copy of the o r i g i n a l sound
*/
int t a r g e t Index = 0 ;
for ( int sour c e Index=0;
sour c e Index < this . getLength ( ) ;
sour c e Index=sour c e Index+3, t a r g e t Index++)
this . setSampleValueAt ( targe t Index ,
s . getSampleValueAt ( sour c e Index ) ) ;
// c l e a r out the r e s t of t h i s sound
for ( int i = t a r g e t Index ;
i < this . getLength ( ) ;
i++)
this . setSampleValueAt ( i , 0 ) ;
}
```

Computer Science & Information Technology

You might also like to view...

Deleting a style will remove its formatting options from any text where the style has been applied

Indicate whether the statement is true or false

Computer Science & Information Technology

The least important task that Windows XP does is managing your electronic files

Indicate whether the statement is true or false

Computer Science & Information Technology