Question: C++ Commands and provide comments please Write a function add echo that adds an echo to the samples array. Your function should take four parameters

C++ Commands and provide comments please Write a function add echo thatadds an echo to the samples array. Your function should take fourC++ Commands and provide comments please

Write a function add echo that adds an echo to the samples array. Your function should take four parameters the samples array, the size of the samples array the sampling rate (as an int) and the delay d in seconds (as a double), in this order. The function will not return any value. For each sample in the samples array, add the value from d seconds ago. Examples: add echo (15,8,3,10, 6,21,6,1,1) Sampling rate is 1 (meaning 1 sample per second) and the delay is 1 second. For the echo, we need to add the value from 1 second before, which means the previous position. [5, 8, 3, 10, 6, 2] [5, 8+5 3+8 10+3, 6+10, 2+6] [5, 13, 11, 13, 16, 8] add_echo (15, 8,3,10, 6, 21,6, 1, 2) Sampling rate is 1 (meaning 1 sample per second) and the delay is 2 seconds. For the echo, we need to add the value from the 2 seconds ago. Given the sampling rate of 1 sample per second, this means we need to add the value from two positions before ([5, 8, 3, 10, 6, 2] , 6, 1, 2) [5, 8, 3+5 10+8, 6+3, 2+10] [5, 8, 8, 18, 9, 12] add_echo (15, 8,3,10, 6,2],6,2,2) Sampling rate is 2 (meaning 2 samples per second) and the delay is 2 seconds. For the echo, we need to add the value from the 2 seconds ago. Given the sampling rate of 2 samples per second, this means we need to add the value from four positions before ([5, 8, 3, 10, 6, 2] , 6, 2, 2) [5, 8, 3, 10, 6+5,2+8] [5, 8, 3, 10, 11, 10]

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

To implement the function addecho which adds an echo effect to a sample array based on the given parameters you need to consider a few steps Plan 1 The function takes four parameters An array of sampl... View full answer

blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!