Click4Ai

533.

Medium

Mel Spectrogram

A Mel Spectrogram is a representation of an audio signal in the frequency domain. It's commonly used in music information retrieval and audio classification tasks. The Mel Spectrogram is calculated by applying a Mel-scale filter bank to the short-time Fourier transform of the audio signal.

**Example:** Suppose we have an audio signal with 10 samples: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]. If we apply a Mel-scale filter bank with 10 filters, the output would be a 10x10 matrix representing the Mel Spectrogram.

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

Test Cases

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