Write a method to quadruple the frequency of a sound.

What will be an ideal response?

```
/**
* Method to quadruple the frequency of a sound by taking
* every fourth sample. The result will be a higher
* sound.
*/
public void quadFreq ( )
f
// make a copy of the original sound
Sound s = new Sound ( this.getFileName ( ) ) ;
/* loop through the sound and increment target index
* by one but source index by 4 and settargetvalue
* to the copy of the original sound
*/
int target Index = 0 ;
for ( int source Index=0;
source Index < this.getLength ( ) ;
source Index=sour c e Index+4, t a r g e t Index++)
this. setSampleValueAt ( targe t Index ,
s.getSampleValueAt ( source Index ) ) ;
// clear out the rest of this sound
for ( int i = target Index ;
i < this.getLength ( ) ;
i++)
this . setSampleValueAt ( i , 0 ) ;
}
```

Computer Science & Information Technology

You might also like to view...

A symbol that specifies a mathematical operation, such as addition or subtraction, is called a(n) ________ operator

Fill in the blank(s) with correct word

Computer Science & Information Technology

The ________ is the area of the File Explorer interface which allows a user to interact with the operating system using tabs at the top of the screen instead of menus

A) Quick Access Toolbar B) Navigation pane C) title bar D) Ribbon

Computer Science & Information Technology