MCPcopy Create free account
hub / github.com/ddbourgin/numpy-ml / test_mfcc

Function test_mfcc

numpy_ml/tests/test_preprocessing.py:150–193  ·  view source on GitHub ↗

Broken

(N=1)

Source from the content-addressed store, hash-verified

148
149
150def test_mfcc(N=1):
151 """Broken"""
152 np.random.seed(12345)
153
154 i = 0
155 while i < N:
156 N = np.random.randint(500, 1000)
157 fs = np.random.randint(50, 100)
158 n_mfcc = 12
159 window_len = 100
160 stride_len = 50
161 n_filters = 20
162 window_dur = window_len / fs
163 stride_dur = stride_len / fs
164 signal = np.random.rand(N)
165
166 mine = mfcc(
167 signal,
168 fs=fs,
169 window="hann",
170 window_duration=window_dur,
171 stride_duration=stride_dur,
172 lifter_coef=0,
173 alpha=0,
174 n_mfccs=n_mfcc,
175 normalize=False,
176 center=True,
177 n_filters=n_filters,
178 replace_intercept=False,
179 )
180
181 theirs = lr_mfcc(
182 signal,
183 sr=fs,
184 n_mels=n_filters,
185 n_mfcc=n_mfcc,
186 n_fft=window_len,
187 hop_length=stride_len,
188 htk=True,
189 ).T
190
191 np.testing.assert_almost_equal(mine, theirs, decimal=4)
192 print("PASSED")
193 i += 1
194
195
196def test_framing(N=15):

Callers

nothing calls this directly

Calls 1

mfccFunction · 0.90

Tested by

no test coverage detected