-
Notifications
You must be signed in to change notification settings - Fork 7
/
mfcc.jl
50 lines (41 loc) · 1.15 KB
/
mfcc.jl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
import SPTK: mfcc
function test_mfcc(len, order)
srand(98765)
dummy = rand(len)
# By default, c0 is not contained
cc = mfcc(dummy, order, czero=true, power=true)
# @test length(cc) == order
if any(isnan.(cc))
@show cc
end
@test all(isfinite.(cc))
end
function test_mfcc_options()
srand(98765)
dummy = rand(512)
try mfcc(dummy, 19, numfilterbunks=20) catch @test false end
@test_throws ArgumentError mfcc(dummy, 20, numfilterbunks=20)
# with c0
println("-- test c0 is expected")
cc = mfcc(dummy, 12; czero=true)
@test length(cc) == 13
# with c0 + power
println("-- test c0 and power are expected")
cc = mfcc(dummy, 12; czero=true, power=true)
@test length(cc) == 14
# with power
println("-- test power is expected")
cc = mfcc(dummy, 12; czero=false, power=true)
@test length(cc) == 13
end
# TODO: Update binary dependency for windows
if !is_windows()
println("-- test_mfcc")
for len in [256, 512, 1024, 2048]
for order in [12, 14, 16, 18]
println(" where len = $len, order = $order")
test_mfcc(len, order)
end
end
test_mfcc_options()
end