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...

____________________, or unsolicited commercial bulk e-mail, has become a major nuisance to corporate users as well as individuals.?

Fill in the blank(s) with the appropriate word(s).

Computer Science & Information Technology

The only goal of subnetting is efficient use of all the IP addresses.

Answer the following statement true (T) or false (F)

Computer Science & Information Technology