Make an audio collage. Make it at least five seconds long, and include at least two different sounds (e.g., come from di®erent ¯les). Make a copy of one of those di®erent sounds and modify it using any of the techniques described in this chapter (e.g., mirroring, splicing, and volume manipulations). Splice together the original two sounds and the modified sound to make the complete collage.
What will be an ideal response?
```
public static Sound createCollage ( )
{
int samplesPerSec = 22050;
Sound s0 = new Sound ( samplesPerSec * 6 ) ;
Sound s1 =
new Sound ( Fi l eChooser. getMediaPath ( " guzdial.wav" ) ) ;
Sound s2 =
new Sound ( FileChooser . getMediaPath ( " guzdial.wav" ) ) ;
int total = 0 ;
int pauseLength = samplesPerSec / 1 0 ;
// copy s1 into the current sound
s0 . s pl ce ( s1 , 0 , s1 . getLength ( ) , 0 ) ;
total = s1. getLength ( ) ;
// put 1/10 sec of silence
for ( int i = 0 ; i < pauseLength ; i++)
s0 . setSampleValueAt ( total + i , 0 ) ;
total = total + pauseLength ;
// increase the volume
s1 . increaseVolume ( ) ;
// copy s1 into the current sound
s0 . splice ( s1 , 0 , s1 . getLength ( ) , total ) ;
total = total + s1 . getLength ( ) ;
// put 1/10 sec of silence
for ( int i = 0 ; i < pauseLength ; i++)
s0 . setSampleValueAt ( total + i , 0 ) ;
total = total + pauseLength ;
// change the frequency of the sound
s1 . doubleFreq ( ) ;
// copy s1 int o the current sound
s0 . s p l i c e ( s1 , 0 , s1 . getLength ( ) , t o t a l ) ;
t o t a l = t o t a l + s1 . getLength ( ) ;
// put 1/10 s e c of s i l e n c e
for ( int i = 0 ; i < pauseLength ; i++)
s0 . setSampleValueAt ( t o t a l + i , 0 ) ;
t o t a l = t o t a l + pauseLength ;
// lower the sound
s2 . halveFreq ( ) ;
// copy s2 int o the current sound
s0 . s p l i c e ( s2 , 0 , s2 . getLength ( ) , t o t a l ) ;
t o t a l = t o t a l + s2 . getLength ( ) ;
// put 1/10 s e c of s i l e n c e
for ( int i = 0 ; i < pauseLength ; i++)
s0 . setSampleValueAt ( t o t a l + i , 0 ) ;
t o t a l = t o t a l + pauseLength ;
// r e v e r s e s1 and add i t
s1 . r e v e r s e ( ) ;
s0 . s p l i c e ( s1 , 0 , s1 . getLength ( ) , t o t a l ) ;
t o t a l = t o t a l + s1 . getLength ( ) ;
return s0 ;
}
```
You might also like to view...
What is the value of the following expression?
true || false a. true b. false c. -1 d. +1 e. None of these
Which language is the most popular language for writing Apple OS X applications?
A) HTML B) C++ C) Objective C D) Java
You can press the _________________________ key to quit Range Finder.
Fill in the blank(s) with the appropriate word(s).
Which of the following will list the destination MAC addresses?
A. arp B. ping C. dig D. nbtstat