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

Utility software is considered to be system software

Indicate whether the statement is true or false

Computer Science & Information Technology

Font sizes are typically measured in millimeters.

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

Computer Science & Information Technology