Write a method that will blend 3 sounds. Start with one sound for 20,000 samples then blend the first and second sound for 20,000 samples, then the second and third sound for 20,000 samples and then the third sound for 20,000 samples.

What will be an ideal response?


```
/**
* Method to o v e r l a p or b l end 3 sounds . S t a r t
* by copying the f i r s t 20 ,000 samples from sound1 into
* the end sound then copy the sum of half
* of the sound1 v a lue and h a l f o f the sound2 value for
* 20 ,000 samples . Then copy the sum of h a l f o f
* the sound2 v a lue and h a l f o f the sound3 v a lue
* f o r the ne x t 20 ,000 samples end wi th the
* ne x t 20 ,000 samples from sound3 .
*/
public static Sound blend3Sounds ( ) {
Sound endSound = new Sound ( 8 0 0 0 0 ) ;
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" ) ) ;
Sound sound3 =
new Sound ( Fi l eChoos e r . getMediaPath ( "g4 .wav" ) ) ;
int value = 0 ;
// copy the f i r s t 20 ,000 samples from sound1 int o t a r g e t
for ( int index=0; index < 20000; index++)
endSound . setSampleValueAt ( index ,
sound1 . getSampleValueAt ( index ) ) ;
// copy the ne x t 20 ,000 samples from sound1 and b l end t h a t
// wi th the f i r s t 20 ,000 samples from sound2
for ( int index = 0 ; index < 20000; index++) f
value = ( int ) ( ( sound1 . getSampleValueAt ( index + 20000) ¤
0 . 5 ) +
( sound2 . getSampleValueAt ( index ) * 0 . 5 ) ) ;
endSound . setSampleValueAt ( index + 20000 , value ) ;
}
// copy the ne x t 20 ,000 samples from sound2 and b l end t h a t
// wi th the f i r s t 20 ,000 samples from sound3
for ( int index = 0 ; index < 20000; index++) f
value = ( int ) ( ( sound2 . getSampleValueAt ( index + 20000) ¤
0 . 5 ) +
( sound3 . getSampleValueAt ( index ) ¤ 0 . 5 ) ) ;
endSound . setSampleValueAt ( index + 40000 , value ) ;
}
// copy the ne x t 20 ,000 samples from sound3 int o the t a r g e t
for ( int index=20000; index < 40000; index++)
endSound . setSampleValueAt ( index + 40000 ,
sound3 . getSampleValueAt ( index ) ) ;
return endSound ;
}
```

Computer Science & Information Technology

You might also like to view...

If your code contains the following statement:

const int NUMBER_ITEMS = 10; write a statement that creates an array, called initials, of 10 characters:

Computer Science & Information Technology

What is a method that creates a hyperlink in ActionScript?

What will be an ideal response?

Computer Science & Information Technology

The Favorites feature prevents Internet Explorer 11 from storing sensitive information in the browser for that tab or window

Indicate whether the statement is true or false

Computer Science & Information Technology

Audit risk is the probability that the auditor will render an unqualified opinion on financial statements that are materially misstated.

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

Computer Science & Information Technology