Write a new version of Program 104 to use index array notation (with square brackets).

Note: The only major change for this function is that the samples for both the source and the target, and get and assign the values with different functions.


```
def splicePreamble3():
source = makeSound("preamble10.wav")
# This will be the newly spliced sound
target = makeEmptySoundBySeconds (5)
samples = getSamples(target)
sourceSamples = getSamples(source)
targetIndex =0

# Where the word "We The" is in the sound
for sourceIndex in range (8864 , 18235):
value = getSampleValue(sourceSamples[sourceIndex])
setSampleValue(samples[targetIndex] , value)
targetIndex = targetIndex +1

#Silence Second
for silence in range(0, 2250):
setSampleValue(samples[targetIndex] , 0)
targetIndex = targetIndex +1

# Where the word "United" is in the sound
for sourceIndex in range (33414 , 40052):
value = getSampleValue(sourceSamples[sourceIndex])
setSampleValue(samples[targetIndex] , value)
targetIndex = targetIndex +1

#Silence Second
for silence in range(0, 2250):
setSampleValue(samples[targetIndex] , 0)
targetIndex = targetIndex +1

# Where the word "People" is in for source
for sourceIndex in range(17408, 26726):
value = getSampleValue(sourceSamples[sourceIndex])
setSampleValue(samples[targetIndex] , value)
targetIndex = targetIndex + 1

play(target)
return target
```

Computer Science & Information Technology

You might also like to view...

Find the errors in each of the following code segments and explain how to correct them.

a) ``` x = 1; while ( x <= 10 ); x++; } ``` b) ``` for ( y = .1; y != 1.0; y += .1 ) cout << y << endl; ``` c) ``` switch ( n ) { case 1: cout << "The number is 1" << endl; case 2: cout << "The number is 2" << endl; break; default: cout << "The number is not 1 or 2" << endl; break; } ``` d) The following code should print the values 1 to 10. ``` n = 1; while ( n < 10 ) cout << n++ << endl; ```

Computer Science & Information Technology

____________________ is simply the arrangement of text on the page or screen.

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

Computer Science & Information Technology

Which of the following is not a permanent storage option?

A. External hard drive B. Random access memory C. Internal hard drive D. SSD

Computer Science & Information Technology

Pretty Good Privacy (PGP) offers strong protection for email.

a. true b. false

Computer Science & Information Technology