Write a function that splices together words and music.

Note: This question does not specify how to splice together the words and music. However, a simple way that emulates a “techno” song would be to repeatedly splice a phrase into a piece of music. The function below accomplishes this, however one could also make use of a less general approach.


```
#music is the base, sound is the phrase to copy into it
#interval is the interval in seconds to copy it
def addStartSilence(sound, music, interval):
target = makeEmptySound(getLength(music))
targetSamples = getSamples(target)
soundSamples = getSamples(sound)
musicSamples = getSamples(music)

#First copy the music to the target
for index in range(0, getLength(music)):
sourceValue = getSampleValue(musicSamples[index])
setSampleValue(targetSamples[index] ,sourceValue)

#Then copy the phrase into the musical at the regular interval
for musicIndex in range(0, getLength(music), getSamplingRate(music)*interval):
for index in range(0, getLength(sound)):
sourceValue = getSampleValue(soundSamples[index])
setSampleValue(targetSamples[musicIndex+index] ,sourceValue)

return target
```

Computer Science & Information Technology

You might also like to view...

How is programming debugging similar to testing with a prototype?

What will be an ideal response?

Computer Science & Information Technology

To convert a report to a Web page, open the report, then click the ____ DATA tab.

A. EXPORT B. IMPORT C. EXTERNAL D. INERNAL

Computer Science & Information Technology

The _____ laptop drive has no moving parts and produces less heat than mechanical drives

Fill in the blank(s) with correct word

Computer Science & Information Technology

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

13. Designers wrestle with the challenge of balancing processor performance with that of main memory and other computer components. 14. A straight comparison of clock speeds on different processors tells the whole story about performance. 15. Measures such as MIPS and MFLOPS have proven adequate to evaluating the performance of processors.

Computer Science & Information Technology