Question: Name: make _ echo _ samples Parameter ( s ) : A list of zero or more numbers, an echo offset integer, and an echo
Name: makeechosamples
Parameters: A list of zero or more numbers, an echo offset integer, and an echo weight in that order. Your code can assume, and does not need to check, that the list is at least as long as the offset integer. This means that if the offset is your code can assume the list has or more values.
Description: Make a new list with an echo added to the list. An echo is a weakened copy of a sound delayed from bouncing off a distant object. For example, if you yell near a cliff I first hear your original sound. Then, I hear your continuing sound plus a softer copy the echo of your initial sound. When you stop, I only hear the softer, delayed sound of the echo. In this function the list of numbers is the original sound, the offset is the delay before the echo starts, and the echo weight is how much the echo is weakened in volume. From a problemsolving perspective, we want to create a new list using three parts:
The first values in the new list are the same as the values in the original list, from index up to but not including the offset index.The values in the new list starting at the offset index and going to the length of the original list are the values from the original list plus the value offset spaces back in the original list scaled by multiplied by the echo weight. Convert each new number to an integer using the int conversion function.Added to the end of the new list are offset number of values copied from the end of the original list and scaled by multiplied by the echo weight. Convert each new number to an integer using the int conversion function.
Return: A new list with the echo added to the original list.
Example: Calling makeechosamplesshould return Using the three steps outlined above:
From index up to but not including the offset index the values in the new list are copied from the original list. In this case, that is just the value at index so is added to the new list.From the offset index to the end of the original list length is the value from the original list plus the value offset places back in the original list times the echo weight. At index we have the value index back times the weight: So At index we have the value index back times the weight: At index we have Finally, at the end of the new list we added the offset number value from the end of the original list times the weight. The last item in the original list is so we take that and multiply it by the weight so is added to the end of our new list.
If the offset is the echo comes from spots back instead of and values are added to the end of the new list. So calling makeechosampleswould return Notice the list is values longer as the echo lasts for samples since the offset is in the new list comes from the second to last value in the original list times the weight: and comes from the last value in the original list times the weight: Work through both of these examples by hand to confirm you understand the process before coding.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
