Compose a sentence that no one ever said by combining words from other sounds into a grammatically correct new sound. Write a function named audioSentence to generate a sentence out of individual words. Use at least three words in your sentence. You can use the words in the mediasource folder from the Web site or record your own words. Be sure to include a tenth (1/10) of a second pause between the words. (Hint 1: Remember that zeroes for the sample values generate silence. Hint 2: Remember that the sampling rate is the number of samples per second. From there, you should be able to figure out how many samples need to be made zero to generate a tenth of a second of silence.) Be sure to access your sounds in your Media Folder using getMediaPath so that it will work for users of your progr

What will be an ideal response?


```
def audioSentence():
source1 = makeSound("trying.wav")
source1Samples = getSamples(source1)
source2 = makeSound("to.wav")
source2Samples = getSamples(source2)
source3 = makeSound("impress.wav")
source3Samples = getSamples(source3)
source4 = makeSound("the.wav")
source4Samples = getSamples(source4)
source5 = makeSound("pig.wav")
source5Samples = getSamples(source5)

s1L = getLength(source1)
s2L = getLength(source2)
s3L = getLength(source3)
s4L = getLength(source4)
s5L = getLength(source5)

tenthOfSecondLength = getSamplingRate(source1)/10
tenthOfSecondLength = int(tenthOfSecondLength)
target = makeEmptySound(s1L+s2L+s3L+s4L+s5L+4*tenthOfSecondLength) targetSamples = getSamples(target)
targetIndex=0
#Source 1 Copy Over
for index in range(0, getLength(source1)):
sourceValue = getSampleValue(source1Samples[index])
setSampleValue(targetSamples[targetIndex] ,sourceValue)
targetIndex = targetIndex+1
for silenceIndex in range(0, tenthOfSecondLength):
setSampleValue(targetSamples[targetIndex] ,0)
targetIndex = targetIndex+1

#Source 2 Copy Over
for index in range(0, getLength(source2)):
sourceValue = getSampleValue(source2Samples[index])
setSampleValue(targetSamples[targetIndex] ,sourceValue)
targetIndex = targetIndex+1
for silenceIndex in range(0, tenthOfSecondLength):
setSampleValue(targetSamples[targetIndex] ,0)
targetIndex = targetIndex+1

#Source 3 Copy Over
for index in range(0, getLength(source3)):
sourceValue = getSampleValue(source3Samples[index])
setSampleValue(targetSamples[targetIndex] ,sourceValue)
targetIndex = targetIndex+1
for silenceIndex in range(0, tenthOfSecondLength):
setSampleValue(targetSamples[targetIndex] ,0)
targetIndex = targetIndex+1
#Source 4 Copy Over
for index in range(0, getLength(source4)):
sourceValue = getSampleValue(source4Samples[index])
setSampleValue(targetSamples[targetIndex] ,sourceValue)
targetIndex = targetIndex+1
for silenceIndex in range(0, tenthOfSecondLength):
setSampleValue(targetSamples[targetIndex] ,0)
targetIndex = targetIndex+1
#Source 5 Copy Over
for index in range(0, getLength(source5)):
sourceValue = getSampleValue(source5Samples[index])
setSampleValue(targetSamples[targetIndex] ,sourceValue)
targetIndex = targetIndex+1

play(target)
return target
```

Computer Science & Information Technology

You might also like to view...

____ refer to the relative width and height of the video frame.

A. Display sizes B. Frame rates C. Resolutions D. Aspect ratios

Computer Science & Information Technology

Darwin uses ____ as the primary network infrastructure while still supporting AppleTalk.

A. NetBIOS B. IPX/SPX C. ICMP D. TCP/IP

Computer Science & Information Technology

Each _____ determines where the slide number is displayed in the footer.

A. layout B. style C. theme D. slide

Computer Science & Information Technology

If no existing type will adequately represent an object, build a ____ to create a new type.

A. method B. class C. function D. library

Computer Science & Information Technology