Write a method that will play half of one sound and then the second half of the first sound added to the first half of another sound and then the last half of the second sound.

What will be an ideal response?


```
/**
* Method to o v e r l a p or b l end two sounds at the hal fway
* p o int in sound1 . St a r t
* by copying the f i r s t h a l f of the samples from
* sound1 int o the cur r ent sound then copy the
* sum of h a l f o f sound1 and sound2 f o r the r e s t
* of sound1 and end wi th the r e s t of sound2
*/
public void blendSoundsAtHal f ( ) f
Sound sound1 =
new Sound ( Fi l eChoos e r . getMediaPath ( "aah .wav" ) ) ;
Sound sound2 =
new Sound ( Fi l eChoos e r . getMediaPath ( " bassoon¡c4 .wav" ) ) ;
int value = 0 ;
int ha l fPo int = sound1 . getLength ( ) / 2 ;
// copy the f i r s t h a l f of sound1 int o t a r g e t
for ( int index=0; index < ha l fPo int ; index++)
this . setSampleValueAt ( index ,
sound1 . getSampleValueAt ( index ) ) ;
// copy the r e s t of sound1 and b l end t h a t
// wi th the f i r s t par t o f sound2
int sound2Index = 0 ;
for ( int index = ha l fPo int ;
index < sound1 . getLength ( ) ;
index++, sound2Index++) f
value = ( int ) ( ( sound1 . getSampleValueAt ( index ) *
0 . 5 ) +
( sound2 . getSampleValueAt ( sound2Index ) ¤ 0 . 5 ) ) ;
this . setSampleValueAt ( index , value ) ;
]
// copy the r e s t of sound2 int o the t a r g e t
for ( int i = sound1 . getLength ( ) ;
i < this . getLength ( ) &&
sound2Index < sound2 . getLength ( ) ;
i++,sound2Index++)
this . setSampleValueAt ( i ,
sound2 . getSampleValueAt ( sound2Index ) ) ;
}
```

Computer Science & Information Technology

You might also like to view...

The preprocessor directives used with the assertion macros is/are

a) #include b) #define NDBUG c) #include d) #include e) #include

Computer Science & Information Technology

You are doing a binary search of the dictionary for page where a word should be, using the recursive binary search. What is done to guarantee that the successive dictionaries to be searched are smaller?

a) Search a dictionary with one less page. b) Search a dictionary with one less word. c) Search a dictionary with half the words. d) Recursively search the half the dictionary where the word should be.

Computer Science & Information Technology

In the following code segment: final int SIZE = 20; // line 1 int groupSize; // line 2 groupSize = SIZE; // line 3 groupSize = groupSize * 2; // line 4 what is the value of groupSize in line 2?

a) 0 b) null c) 20 d) 40

Computer Science & Information Technology

_________ will integrate with the operating system of a host computer and monitor program behavior in real time for malicious actions.

A. Fingerprint-based scanners B. Behavior-blocking software C. Generic decryption technology D. Heuristic scanners

Computer Science & Information Technology