Skip to content

Commit 6bba3de

Browse files
committed
spectrogram now works for r>1
1 parent fbbb361 commit 6bba3de

File tree

6 files changed

+763
-762
lines changed

6 files changed

+763
-762
lines changed

src/periodogram.jl

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,8 @@ function spectrogram(s; n=int(length(s)/8), m=int(n/2), r=1, w=(n)->ones(n,1))
5454
w=w(n)
5555
p=[periodogram(s.*w) for s in arraysplit(s, n, m)]
5656
p=hcat(p...)
57-
t=(0:size(p,2)-1)*(n-m)/r + n/2
57+
p/=r
58+
t=( (0:size(p,2)-1)*(n-m) + n/2) / r
5859
f=(0:size(p,1)-1)/size(p,1)*r
5960
p, t, f
6061
end

test/data/spectrogram_f.txt

Lines changed: 116 additions & 116 deletions
Original file line numberDiff line numberDiff line change
@@ -1,129 +1,129 @@
11
0
2-
.00390625
3-
.0078125
4-
.01171875
5-
.015625
6-
.01953125
7-
.0234375
8-
.02734375
9-
.03125
10-
.03515625
112
.0390625
12-
.04296875
13-
.046875
14-
.05078125
15-
.0546875
16-
.05859375
17-
.0625
18-
.06640625
19-
.0703125
20-
.07421875
213
.078125
22-
.08203125
23-
.0859375
24-
.08984375
25-
.09375
26-
.09765625
27-
.1015625
28-
.10546875
29-
.109375
30-
.11328125
314
.1171875
32-
.12109375
33-
.125
34-
.12890625
35-
.1328125
36-
.13671875
37-
.140625
38-
.14453125
39-
.1484375
40-
.15234375
415
.15625
42-
.16015625
43-
.1640625
44-
.16796875
45-
.171875
46-
.17578125
47-
.1796875
48-
.18359375
49-
.1875
50-
.19140625
516
.1953125
52-
.19921875
53-
.203125
54-
.20703125
55-
.2109375
56-
.21484375
57-
.21875
58-
.22265625
59-
.2265625
60-
.23046875
617
.234375
62-
.23828125
63-
.2421875
64-
.24609375
65-
.25
66-
.25390625
67-
.2578125
68-
.26171875
69-
.265625
70-
.26953125
718
.2734375
72-
.27734375
73-
.28125
74-
.28515625
75-
.2890625
76-
.29296875
77-
.296875
78-
.30078125
79-
.3046875
80-
.30859375
819
.3125
82-
.31640625
83-
.3203125
84-
.32421875
85-
.328125
86-
.33203125
87-
.3359375
88-
.33984375
89-
.34375
90-
.34765625
9110
.3515625
92-
.35546875
93-
.359375
94-
.36328125
95-
.3671875
96-
.37109375
97-
.375
98-
.37890625
99-
.3828125
100-
.38671875
10111
.390625
102-
.39453125
103-
.3984375
104-
.40234375
105-
.40625
106-
.41015625
107-
.4140625
108-
.41796875
109-
.421875
110-
.42578125
11112
.4296875
112-
.43359375
113-
.4375
114-
.44140625
115-
.4453125
116-
.44921875
117-
.453125
118-
.45703125
119-
.4609375
120-
.46484375
12113
.46875
122-
.47265625
123-
.4765625
124-
.48046875
125-
.484375
126-
.48828125
127-
.4921875
128-
.49609375
129-
.5
14+
.5078125
15+
.546875
16+
.5859375
17+
.625
18+
.6640625
19+
.703125
20+
.7421875
21+
.78125
22+
.8203125
23+
.859375
24+
.8984375
25+
.9375
26+
.9765625
27+
1.015625
28+
1.0546875
29+
1.09375
30+
1.1328125
31+
1.171875
32+
1.2109375
33+
1.25
34+
1.2890625
35+
1.328125
36+
1.3671875
37+
1.40625
38+
1.4453125
39+
1.484375
40+
1.5234375
41+
1.5625
42+
1.6015625
43+
1.640625
44+
1.6796875
45+
1.71875
46+
1.7578125
47+
1.796875
48+
1.8359375
49+
1.875
50+
1.9140625
51+
1.953125
52+
1.9921875
53+
2.03125
54+
2.0703125
55+
2.109375
56+
2.1484375
57+
2.1875
58+
2.2265625
59+
2.265625
60+
2.3046875
61+
2.34375
62+
2.3828125
63+
2.421875
64+
2.4609375
65+
2.5
66+
2.5390625
67+
2.578125
68+
2.6171875
69+
2.65625
70+
2.6953125
71+
2.734375
72+
2.7734375
73+
2.8125
74+
2.8515625
75+
2.890625
76+
2.9296875
77+
2.96875
78+
3.0078125
79+
3.046875
80+
3.0859375
81+
3.125
82+
3.1640625
83+
3.203125
84+
3.2421875
85+
3.28125
86+
3.3203125
87+
3.359375
88+
3.3984375
89+
3.4375
90+
3.4765625
91+
3.515625
92+
3.5546875
93+
3.59375
94+
3.6328125
95+
3.671875
96+
3.7109375
97+
3.75
98+
3.7890625
99+
3.828125
100+
3.8671875
101+
3.90625
102+
3.9453125
103+
3.984375
104+
4.0234375
105+
4.0625
106+
4.1015625
107+
4.140625
108+
4.1796875
109+
4.21875
110+
4.2578125
111+
4.296875
112+
4.3359375
113+
4.375
114+
4.4140625
115+
4.453125
116+
4.4921875
117+
4.53125
118+
4.5703125
119+
4.609375
120+
4.6484375
121+
4.6875
122+
4.7265625
123+
4.765625
124+
4.8046875
125+
4.84375
126+
4.8828125
127+
4.921875
128+
4.9609375
129+
5

0 commit comments

Comments
 (0)