Click4Ai

532.

Medium

Audio Signal Processing

In audio signal processing, it's common to apply filters to remove noise or enhance specific frequencies. One type of filter is the moving average filter, which replaces each sample in the signal with the average of neighboring samples.

**Example:** Suppose we have an audio signal with 10 samples: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]. If we apply a moving average filter with a window size of 3, the output would be: [2, 3, 4, 5, 6, 7, 8, 9, 10, 10].

**Constraints:** The input is a 1D array representing the audio signal, and the output should be the filtered signal.

Test Cases

Test Case 1
Input: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
Expected: [2, 3, 4, 5, 6, 7, 8, 9, 10, 10]
Test Case 2
Input: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]
Expected: [2, 3, 4, 5, 6, 7, 8, 9, 10, 10.5, 11, 12, 13, 14, 15]
+ 3 hidden test cases