Upload
sudhir-rawat
View
230
Download
0
Embed Size (px)
Citation preview
8/2/2019 Spgram Tut
http://slidepdf.com/reader/full/spgram-tut 1/9
s p g r a m b w : P l o t S p e c t r o g r a m s i n M A T L A B
M i k e B r o o k e s
1 2 t h M a y 2 0 1 1
C o n t e n t s
1 I n t r o d u c t i o n 1
2 F u n c t i o n c a l l 2
3 C o l o u r m a p s 2
4 F r e q u e n c y a x i s 3
4 . 1 N o n l i n e a r f r e q u e n c y s c a l i n g . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
4 . 2 F r e q u e n c y r a n g e a n d s t e p s i z e . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
5 A n a l y s i s b a n d w i d t h 4
6 T i m e A x i s 4
7 I n t e n s i t y s c a l i n g 5
8 W a v e f o r m a n d t r a n s c r i p t i o n 6
9 O u t p u t A r g u m e n t s 6
1 0 M O D E s t r i n g o p t i o n s 6
1 1 M A T L A B C o d e f o r g u r e s 7
1 I n t r o d u c t i o n
T h i s d o c u m e n t d e s c r i b e s t h e s p g r a m b w f u n c t i o n w h i c h i s p a r t o f t h e v o i c e b o x t o o l b o x a v a i l a b l e a t h t t p : / /
w w w . e e . i c . a c . u k / h p / s t a f f / d m b / v o i c e b o x / v o i c e b o x . h t m l [ B r o 9 7 ] . W e w i l l u s e a s a n e x a m p l e , t h e f o l l o w i n g
s e n t e n c e S i x p l u s t h r e e e q u a l s n i n e f o r w h i c h a s p e c t r o g r a m i s s h o w n b e l o w i n c u l d i n g t h e s p e e c h w a v e f o r m
a n d a t i m e - a l i g n e d p h o n e t i c a n n o t a t i o n .
Time (s)
F r e q u e n c y ( k H z )
1: MODE='pJcwat'
s k s p l s r i i k w z n a n
0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 1.8
0
1
2
3
4
5
6
7
8
9
10
P o w e r / D e c a d e ( d B )
25
30
35
40
45
50
55
60
1
8/2/2019 Spgram Tut
http://slidepdf.com/reader/full/spgram-tut 2/9
2 F u n c t i o n c a l l
T h e b a s i c c a l l t o t h e f u n c t i o n i s :
[ T , F , B ] = s p g r a m b w ( S , F S , M O D E , B W , F M A X , D B , T I N C , A N N )
w h e r e a l l b u t t h e r s t t w o i n p u t a r g u m e n t s a r e o p t i o n a l . T h e i n p u t a r g u m e n t s a r e :
S i n p u t s p e e c h w a v e f o r m
F S s a m p l e r a t e o f s p e e c h w a v e f o r m
M O D E t e x t s t r i n g s p e c i f y i n g a l a r g e r a n g e o f o p t i o n s
B W t h e b a n d w i d t h o f t h e s p e c t r o g r a m . T h i s a r g u m e n t d e t e r m i n e s t h e t r a d e o b e t w e e n t i m e a n d f r e q u e n c y
r e s o l u t i o n .
F M A X s p e c i e s t h e r a n g e a n d r e s o l u t i o n o f t h e f r e q u e n c y a x i s
D B s p e c i e s t h e r a n g e o f p o w e r s p e c t r a l d e n s i t y d i s p l a y e d
T I N C s p e c i e s t h e r a n g e a n d r e s o l u t i o n o f t h e t i m e a x i s
A N N g i v e s a n o p t i o n a l a n n o t a t i o n l e c o n t a i n i n g w o r d s o r p h o n e m e s .
I f a l l y o u w a n t t o d o i s d r a w a s p e c t r o g r a m , t h e n t h e f u n c t i o n s h o u l d b e c a l l e d w i t h o u t a n y o u t p u t a r g u m e n t s .
I f o u t p u t a r g u m e n t s a r e s p e c i e d , t h e n n o s p e c t r o g r a m w i l l b e d r a w n u n l e s s t h e ' g ' m o d e o p t i o n i s a l s o g i v e n .
T h e o u t p u t a r g u m e n t s a r e
T g i v e s t h e t i m e o f e a c h t i m e - a x i s s a m p l e p o i n t
F g i v e s t h e f r e q u e n c y o f e a c h f r e q u e n c y - a x i s s a m p l e p o i n t
B a 2 - d i m e n s i o n a l a r r a y g i v i n g t h e s p e c t r a l d e n s i t y a t e a c h t i m e - f r e q u e n c y p o i n t .
I n t h e p l o t s s h o w n i n t h i s d o c u m e n t , t h e t i t l e ( a b o v e t h e s p e c t r o g r a m ) s h o w s t h e g u r e n u m b e r ( w r i t t e n { n }
i n t h e t e x t ) , t h e v a l u e o f t h e M O D E a r g u m e n t a n d t h e v a l u e o f a n y o t h e r a r g u m e n t s t h a t a r e n o t n u l l .
3 C o l o u r m a p s
T h e d e f a u l t o u t p u t i s a m o n o c h r o m e s p e c t r o g r a m s h o w n a s { 2 } . S p e c i f y i n g t h e ` j ' m o d e o p t i o n u s e s t h e j e t
c o l o u r m a p i n s t e a d w h i c h i s c o l o u r f u l a n d i n t u i t i v e { 3 } . H o w e v e r i t d o e s n o t r e p r o d u c e a c c u r a t e l y i f v i e w e d
o r p r i n t e d i n m o n o c h r o m e a n d s o I n o r m a l l y u s e t h e ` J ' o p t i o n i n s t e a d w h i c h i s l e s s a g g r e s s i v e a n d c o n v e r t s
a c c u r a t e l y t o m o n o c h r o m e { 4 } . N o t i c e t h a t I h a v e a l s o u s e d t h e ` c ' o p t i o n i n e a c h c a s e i n o r d e r t o i n c l u d e a
c o l o u r b a r g i v i n g t h e i n t e n s i t y s c a l e i n d e c i b e l s .
Time(s)
F r e q u e n c y ( k H z )
2: MODE='pc'
0.5 1 1.5
0
1
2
3
4
5
6
7
8
9
10
P o w e r / D e c a d e ( d B )
25
30
35
40
45
50
55
60
Time(s)
F r e q u e n c y ( k H z )
3: MODE='pjc'
0.5 1 1.5
0
1
2
3
4
5
6
7
8
9
10
P o w e r / D e c a d e ( d B )
25
30
35
40
45
50
55
60
Time(s)
F r e q u e n c y ( k H z )
4: MODE='pJc'
0.5 1 1.5
0
1
2
3
4
5
6
7
8
9
10
P o w e r / D e c a d e ( d B )
25
30
35
40
45
50
55
60
2 : M o n o c h r o m e 3 : ` j ' = J e t 4 : ` J ' = T h e r m a l
A d d i n g t h e ` i ' o p t i o n i n v e r t s t h e c o l o u r m a p s o t h a t d a r k a r e a s n o w c o r r e s p o n d t o h i g h i n t e n s i t y . F o r t h e s e
e x a m p l e s , I h a v e o m i t t e d t h e ` c ' o p t i o n s o t h e c o l o u r b a r i s m i s s i n g .
2
8/2/2019 Spgram Tut
http://slidepdf.com/reader/full/spgram-tut 3/9
Time (s)
F r e q u e n c y
( k H z )
5: MODE='pi'
0.5 1 1.5
0
1
2
3
4
5
6
7
8
9
10
Time (s)
F r e q u e n c y
( k H z )
6: MODE='pji'
0.5 1 1.5
0
1
2
3
4
5
6
7
8
9
10
Time (s)
F r e q u e n c y
( k H z )
7: MODE='pJi'
0.5 1 1.5
0
1
2
3
4
5
6
7
8
9
10
5 : ` i ' = I n v e r t e d M o n o c h r o m e 6 : ` i j ' = I n v e r t e d J e t 7 : ` i J ' = I n v e r t e d T h e r m a l
4 F r e q u e n c y a x i s
4 . 1 N o n l i n e a r f r e q u e n c y s c a l i n g
T h e d e f a u l t f r e q u e n c y a x i s i s l i n e a r i n H z a s s e e n i n t h e e x a m p l e s a b o v e . S p e e c h s c i e n t i s t s u s u a l l y p r e f e r a
n o n l i n e a r f r e q u e n c y s c a l e i n w h i c h h i g h f r e q u e n c i e s a r e c o m p r e s s e d . T h e r e a r e s e v e r a l w i d e l y u s e d f r e q u e n c y
s c a l e s a n d t h e s e a r e p l o t t e d b e l o w ( s c a l e d t o c o i n c i d e a t 1 k H z ) [ M G 8 3 , G h i 9 4 , S V N 3 7 , Z w i 6 1 , Z T 8 0 ] . T h e l o g
s c a l e { 8 } p r o v i d e s t h e m o s t c o m p r e s s i o n a t h i g h f r e q u e n c i e s b u t i t i s m o r e u s u a l t o u s e o n e o f t h e p h y s i o l o g i c a l
o r p s y c h o a c o u s t i c a l s c a l e s : E r b - r a t e { 9 } , M e l { 1 0 } o r B a r k { 1 1 } . T h e s c a l e i s s e l e c t e d b y t h e M O D E o p t i o n s
` l ' , ` e ' , ` m ' o r ` b ' . I n a l l c a s e s , i t i s p o s s i b l e t o a d d a l s o t h e ` f ' o p t i o n w h i c h c a u s e s t h e f r e q u e n c y a x i s l a b e l s t o
b e w r i t t e n i n H z a s i n { 1 2 } . I n a l l t h e p l o t s b e l o w , I h a v e r e d u c e d t h e b a n d w i d t h t o 8 0 H z ( s e e s e c t i o n 5 ) t o
g i v e b e t t e r f r e q u e n c y r e s o l u t i o n .
0 1 2 3 4 5 60
0.5
1
1.5
2
2.5
3
Frequency (kHz)
S c a l e r e l a t i v e t o 1
k H z
Frequency scales
lin
log
mel
bark
erb-rate
Time(s)
F r e q u e n c y ( l o g 1 0
H z )
8: MODE='pJcl', BW=80
0.5 1 1.5
1.6
1.8
2
2.2
2.4
2.6
2.8
3
3.2
3.4
3.6
3.8
4
P o w e r / D e c a d e ( d B )
25
30
35
40
45
50
55
60
Time(s)
F r e q u e n c y ( E r b - r a t e )
9: MODE='pJce', BW=80
0.5 1 1.5
0
2
4
6
8
10
12
14
16
18
20
22
24
26
28
30
32
P o w e r / D e c a d e ( d B )
25
30
35
40
45
50
55
60
F r e q u e n c y s c a l e s 8 : ` l ' = L o g s c a l e d 9 : ` e ' = E r b - r a t e s c a l e d
Time(s)
F r e q u e n c y ( k M e l )
10: MODE='pJcm', BW=80
0.5 1 1.5
0
0.2
0.4
0.6
0.8
1
1.2
1.4
1.6
1.8
2
2.2
2.4
2.6
2.8
3
P o
w e r / D e c a d e ( d B )
25
30
35
40
45
50
55
60
Time(s)
F
r e q u e n c y ( B a r k )
11: MODE='pJcb', BW=80
0.5 1 1.5
0
2
4
6
8
10
12
14
16
18
20
22
P o
w e r / D e c a d e ( d B )
25
30
35
40
45
50
55
60
Time(s)
B a r k - s
c a l e d f r e q u e n c y ( H z )
12: MODE='pJcbf', BW=80
0.5 1 1.5
0
500
1k
2k
5k
10k
P o
w e r / D e c a d e ( d B )
25
30
35
40
45
50
55
60
1 0 : ` m ' = M e l s c a l e d 1 1 : ` b ' = B a r k s c a l e d 1 2 : ` b f ' = B a r k + H z l a b e l s
4 . 2 F r e q u e n c y r a n g e a n d s t e p s i z e
B y d e f a u l t t h e f r e q u e n c y a x i s e n c o m p a s s e s t h e e n t i r e r a n g e f r o m 0 H z t o t h e N y q u i s t f r e q u e n c y ,
1
2f s , b u t t h i s
i s o f t e n t o o l a r g e . T h e F M A X i n p u t p a r a m e t e r a l l o w s y o u t o s p e c i f y t h e d e s i r e d f r e q u e n c y r a n g e . S e t t i n g
F M A X = 4 0 0 0 { 1 3 } r e s t r i c t s t h e f r e q u e n c y r a n g e t o a m a x i m u m o f 4 k H z w h i l e F M A X = [ 2 0 0 0 4 0 0 0 ] s e t s t h e
r a n g e t o 2 k H z t o 4 k H z { 1 4 } . N o r m a l l y t h e f r e q u e n c y s t e p s i z e i s
1
256o f t h e d i s p l a y e d r a n g e , b u t y o u c a n a l s o
s p e c i f y t h e s t e p s i z e e x p l i c i t l y : F M A X = [ 2 0 0 0 2 0 0 4 0 0 0 ] g o e s f r o m 2 k H z t o 4 k H z i n s t e p s o f 2 0 0 H z { 1 5 } . I f a
n o n l i n e a r f r e q u e n c y s c a l i n g h a s b e e n s e l e c t e d b y t h e ` l ' , ` e ' , ` m ' o r ` b ' o p t i o n s , t h e n F M A X m u s t b e s p e c i e d i n
s c a l e d u n i t s u n l e s s t h e ` h ' o p t i o n i s g i v e n , i n w h i c h c a s e t h e y a r e i n H z a s n o r m a l . N o t e t h a t s e l e c t i n g a v e r y
3
8/2/2019 Spgram Tut
http://slidepdf.com/reader/full/spgram-tut 4/9
s m a l l s t e p s i z e d o e s n o t m a k e t h e s p e c t r o g r a m a n y l e s s b l u r r y ; t h e f r e q u e n c y r e s o u l u t i o n i s d e t e r m i n e d b y t h e
a n a l y s i s b a n d w i d t h , B W , d e s c r i b e d i n s e c t i o n 5 .
Time(s)
F r e q u e n c y ( k H z )
13: MODE='hpJc', FMAX=4000
0.5 1 1.5
0
0.5
1
1.5
2
2.5
3
3.5
4
P o w e r / D e c a d
e ( d B )
25
30
35
40
45
50
55
60
Time(s)
F r e q u e n c y ( k H z )
14: MODE='hpJc', FMAX=[2000 4000]
0.5 1 1.5
2
2.2
2.4
2.6
2.8
3
3.2
3.4
3.6
3.8
4
P o w e r / D e c a d
e ( d B )
25
30
35
40
45
50
55
60
Time(s)
F r e q u e n c y ( k H z )
15: MODE='hpJc', FMAX=[2000 200 4000]
0.5 1 1.5
2
2.2
2.4
2.6
2.8
3
3.2
3.4
3.6
3.8
4
P o w e r / D e c a d
e ( d B )
20
25
30
35
40
45
50
55
1 3 : 0 t o 4 k H z 1 4 : 2 t o 4 k H z 1 5 : 2 0 0 H z r e s o l u t i o n
5 A n a l y s i s b a n d w i d t h
T h e r e i s a n u n a v o i d a b l e t r a d e o b e t w e e n t i m e r e s o l u t i o n a n d f r e q u e n c y r e s o l u t i o n t h a t i s o f t e n k n o w n a s t h e
u n c e r t a i n t y p r i n c i p l e . T h e B W i n p u t p a r a m e t e r s p e c i e s t h e −6d B a n a l y s i s b a n d w i d t h w h i c h i s t h e f r e q u e n c y
s e p a r a t i o n a t w h i c h t w o t o n e s w i l l d e n i t e l y g i v e d i s t i n c t p e a k s . F r o m t h e p o i n t o f v i e w o f f r e q u e n c y r e s o l u t i o n ,
i t f o l l o w s t h a t t h e s m a l l e r B W t h e b e t t e r . H o w e v e r s e l e c t i n g a s m a l l v a l u e o f B W m e a n s t h a t r a p i d a m p l i t u d e
v a r i a t i o n s w i t h i n a n y s i n g l e f r e q u e n c y b i n w i l l b e a t t e n u a t e d a n d , i n p a r t i c u l a r , a m p l i t u d e v a r i a t i o n s f a s t e r t h a n
1
2B W w i l l b e a t t e n u a t e d b y m o r e t h a n −6
d B r e s u l t i n g i n p o o r t i m e r e s o l u t i o n .
Time(s)
F r e q u e n c y ( k H z )
16: MODE='pJcwat', BW=50
s I k s p l V s T r i: i: k w@ z n aI n 0
0.5 1 1.50
1
2
3
4
5
6
7
8
9
10
P o w e r / D e c a d e ( d B )
25
30
35
40
45
50
55
60
Time(s)
F r e q u e n c y ( k H z )
17: MODE='pJcwat'
s I k s p l V s T r i: i : k w@ z n aI n 0
0.5 1 1.50
1
2
3
4
5
6
7
8
9
10
P o w e r / D e c a d e ( d B )
25
30
35
40
45
50
55
60
Time(s)
F r e q u e n c y ( k H z )
18: MODE='pJcwat', BW=400
s I k s p l V s T r i : i: k w@ z n aI n 0
0.5 1 1.50
1
2
3
4
5
6
7
8
9
10
P o w e r / D e c a d e ( d B )
20
25
30
35
40
45
50
55
1 6 : B W = 5 0 H z 1 7 : B W = 2 0 0 H z ( d e f a u l t ) 1 8 : B W = 4 0 0 H z
I n t h i s s p e e c h e x a m p l e , w h i c h i s b y a f e m a l e t a l k e r , t h e l a r y n x f r e q u e n c y v a r i e s f r o m 3 0 0 H z d o w n t o
1 5 0 H z . I f B W i s c h o s e n t o b e b e l o w t h e f u n d a m e n t a l f r e q u e n c y , e . g . B W = 5 0 H z i n { 1 6 } , t h e h a r m o n i c s o f t h e
l a r y n x f r e q u e n c y a r e c l e a r l y v i s i b l e a s q u a s i - h o r i z o n t a l s t r i p e s , h o w e v e r t h e t i m e r e s o l u t i o n i s r e l a t i v e l y p o o r .
I n a b r o a d b a n d s p e c t r o g r a m , i n c o n t r a s t , t h e b a n d w i d t h i s c h o s e n t o b e h i g h e r t h a n t h e l a r y n x f r e q u e n c y , e . g .
B W = 4 0 0 H z i n { 1 8 } , a n d t h e i n d i v i d u a l h a r m o n i c s a r e n o l o n g e r r e s o l v e d . T h e t i m e r e s o l u t i o n i s h o w e v e r m u c h
i m p r o v e d a n d i t i s p o s s i b l e t o r e s o l v e t h e i n d i v i d u a l a c o u s t i c e x c i t a t i o n s a r i s i n g f r o m e a c h l a r y n x p u l s e ; t h e s e
a r e v i s i b l e a s v e r t i c a l s t r i a t i o n s d u r i n g t h e / a I / p h o n e m e o f n i n e a t a t i m e o f a r o u n d 1 . 5 s e c o n d s . T h e d e f a u l t
b a n d w i d t h i s B W = 2 0 0 H z { 1 7 } w h i c h i s o f t e n t o o l a r g e t o r e s l v e t h e l a r y n x f r e q u e n c y h a r m o n i c s b u t w h i c h
m a k e s t h e v o c a l t r a c t r e s o n a n c e s , o r f o r m a n t s , e a s y t o s e e .
6 T i m e A x i s
A s d i s c u s s e d i n s e c t i o n 5 , t h e t i m e r e s o l u t i o n i s d e t e r m i n e d b y t h e B W p a r a m e t e r , a n d m o d u l a t i o n f r e q u e n c i e s
a b o v e
1
2B W a r e n o t s h o w n i n t h e s p e c t r o g r a m . F o r t h i s r e a s o n , t h e d e f a u l t t i m e - s t e p i s t a k e n a s
0.45
B W
a n d , f o r
s m a l l v a l u e s o f B W , t h i s m a y g i v e a b l o c k y a p p e a r a n c e { 1 9 } . T o a v o i d t h i s y o u c a n e x p l i c i t l y s e t a s m a l l e r t i m e
s t e p u s i n g t h e T I N C p a r a m e t e r a s s h o w n i n { 2 0 } ; n o t e t h a t a l t h o u g h t h i s r e s u l t s i n a s m o o t h e r a p p e a r a n c e , i t
d o e s n o t i m p r o v e t h e t i m e r e s o l u t i o n w h i c h i s s t i l l d e t e r m i n e d b y t h e B W p a r a m e t e r ( s e e s e c t i o n 5 ) .
4
8/2/2019 Spgram Tut
http://slidepdf.com/reader/full/spgram-tut 5/9
Time(s)
F r e q u e n c y ( k H z )
19: MODE='pJcwat', BW=20
s I k s p l V s T r i: i: k w@ z n aI n 0
0.5 1 1.50
1
2
3
4
5
6
7
8
9
10
P o w e r / D e c a d e ( d B )
25
30
35
40
45
50
55
60
Time(s)
F r e q u e n c y ( k H z )
20: MODE='pJcwat', BW=20, TINC=0.005
s I k s p l V s T r i: i: k w@ z n aI n 0
0.5 1 1.50
1
2
3
4
5
6
7
8
9
10
P o w e r / D e c a d e ( d B )
25
30
35
40
45
50
55
60
Time(s)
F r e q u e n c y ( k H z )
21: MODE='pJcwat', BW=20, TINC=[1.1 0.001 1.4]
k w @ z n
1.1 1.15 1.2 1.25 1.3 1.35 1.40
1
2
3
4
5
6
7
8
9
10
P o w e r / D e c a d e ( d B )
15
20
25
30
35
40
45
50
1 9 : B W = 2 0 H z 2 0 : B W = 2 0 , T I N C = 0 . 0 0 5 2 1 : T I N C = [ 1 . 1 0 . 0 0 1 1 . 4 ]
Y o u c a n r e s t r i c t t h e d i s p l a y t o a s p e c i c t i m e i n t e r v a l b y s e t t i n g T I N C = [tmin tmax] o r T I N C = [tmin tstep tmax]i f y o u w a n t t o s p e c i y t h e t i m e - s t e p a s w e l l { 2 1 } . N o t i c e i n { 2 1 } t h a t t h e w a v e f o r m a n d a n n o t a t i o n s r e m a i n
c o r r e c t l y a l i g n e d .
T h e s a m p l e t i m e o f S (1) i s a s s u m e d b y d e f a u l t t o b e
T 1 = 1
FS, b u t y o u c a n s e t i t t o a n y o t h e r v a l u e b y
m a k i n g t h e s e c o n d i n p u t a r g u m e n t a v e c t o r : [ F S T 1 ] .
7 I n t e n s i t y s c a l i n g
T h e d e f a u l t s p e c t r o g r a m s h o w s t h e s p e c t r a l d e n s i t y i n u n i t s o f p o w e r p e r H z { 2 2 } . B e c a u s e m o s t s p e e c h
e n e r g y i s c o n c e n t r a t e d a t l o w f r e q u e n c i e s , t h i s c a n m a k e i t d i c u l t t o s e e d e t a i l i n t h e d i s p l a y a t b o t h l o w a n d
h i g h f r e q u e n c i e s . T o a v o i d t h i s , y o u c a n u s e t h e ` p ' o p t i o n t o d i s p l a y p o w e r p e r d e c a d e i n s t e a d : t h i s o p t i o n
m u l t i p l i e s t h e p o w e r b y a v a l u e p r o p o r t i o n a l t o t h e f r e q u e n c y a n d s o e m p h a s i s e s h i g h f r e q u e n c i e s { 2 3 } . I f y o u
a r e u s i n g o n e o f t h e n o n - l i n e a r f r e q u e n c y s c a l i n g o p t i o n s d e s c r i b e d i n s e c t i o n 4 . 1 , y o u h a v e a t h i r d o p t i o n w h i c h
i s t o s h o w p o w e r p e r b a r k / e r b / . . . { 2 4 } .
Time(s)
F r e q u e n c y ( k H
z )
22: MODE='Jc'
0.5 1 1.5
0
1
2
3
4
5
6
7
8
9
10
P o w e r / H z ( d B
)
-10
-5
0
5
10
15
20
25
Time(s)
F r e q u e n c y ( k H
z )
23: MODE='pJc'
0.5 1 1.5
0
1
2
3
4
5
6
7
8
9
10
P o w e r / D e c a d e ( d B )
25
30
35
40
45
50
55
60
Time(s)
B a r k - s c a l e d f r e q u e n
c y ( H z )
24: MODE='PJcbf'
0.5 1 1.5
0
500
1k
2k
5k
10k
P o w e r / B a r k ( d B
)
10
15
20
25
30
35
40
45
1
2 2 : P o w e r / H z 2 3 : ` p ' = P o w e r / D e c a d e 2 4 : ` P ' = P o w e r p e r B a r k
N o r m a l l y , t h e d i s p l a y s h o w s a r a n g e o f 4 0 d B f r o m t h e m a x i m u m p o w e r a n y w h e r e i n t h e s p e c t r r o g r a m
{ 2 5 } . Y o u c a n c h a n g e t h i s t o a d i e r e n t r a n g e b y s e t t i n g t h e D B p a r a m e t e r e i t h e r t o t h e d e s i r e d r a n g e { 2 6 }
o r a l t e r n a t i v e l y t o t h e m i n i m u m a n d m a x i m u m p o w e r s t o d i s p l a y : D B = [P min P max] { 2 7 } . T h i s o p t i o n
i s e s p e c i a l l y u s e f u l i f y o u w a n t t o h a v e s e v e r a l s p e c t r i o g r a m s w i t h i d e n t i c a l d i s p l a y e d p o w e r r a n g e s . V a l u e s
o u t s i d e t h e s e l e c t e d r a n g e w i l l b e s e t t o e i t h e r t h e m i n i m u m o r m a x i m u m .
Time(s)
F r e q u e n c y ( k H z )
25: MODE='Jc'
0.5 1 1.5
0
1
2
3
4
5
6
7
8
9
10
P o w e r / H z ( d B )
-10
-5
0
5
10
15
20
25
Time(s)
F r e q u e n c y ( k H z )
26: MODE='Jc', DB=60
0.5 1 1.5
0
1
2
3
4
5
6
7
8
9
10
P o w e r / H z ( d B )
-30
-20
-10
0
10
20
Time(s)
F r e q u e n c y ( k H z )
27: MODE='Jc', DB=[-25 0]
0.5 1 1.5
0
1
2
3
4
5
6
7
8
9
10
P o w e r / H z ( d B )
-25
-20
-15
-10
-5
0
2 5 : 4 0 d B r a n g e ( d e f a u l t ) 2 6 : D B = 6 0 2 7 : D B = [ - 2 5 0 ]
5
8/2/2019 Spgram Tut
http://slidepdf.com/reader/full/spgram-tut 6/9
8 W a v e f o r m a n d t r a n s c r i p t i o n
I t i s o f t e n h e l p f u l t o d i s p l a y t h e t i m e - d o m a i n w a v e f o r m o n t h e s p e c t r o g r a m a n d y o u c a n d o s o w i t h t h ` w ' o p t i o n
{ 2 5 } . I f y o u h a v e a t r a n s c r i p t i o n o r o t h e r t i m e - a l i g n e d a n n o t a t i o n , y o u c a n s p e c i f y i t a s t h e A N N i n p u t . E a c h
r o w o f t h e A N N c e l l a r r a y i s o f t h e f o r m {[tstart tend] ‘t e x t ' }. B y d e f a u l t , t h e a n n o t a t i o n s a r e l e f t - a l i g n e d w i t h i n
t h e i r t i m e i n t e r v a l s w i t h o u t a n y t i m e m a r k e r s { 2 6 } . I f y o u w a n t t o d i s p l a y p h o n e t i c c h a r a c t e r s , y o u w i l l n e e d
t o i n s t a l l a n o n - u n i c o d e I P A f o n t s u c h a s t h e S I L 9 3 f o n t s ( a v a i l a b l e f o r d o w n l o a d f r o m t h e V o i c e b o x w e b s i t e ) .
Y o u c a n s p e c i f y t h e f o n t o f e a c h a n n o t a t i o n e n t r y b y i n c l u d i n g a t h i r d c o l u m n ; e a c h r o w o f A N N i s n o w o f t h e
f o r m {[tstart tend] ‘t e x t ' ` f o n t ' }. E x a m p l e { 2 7 } u s e s t h e ` S I L D o u l o s I P A 9 3 ' f o n t a n d a l s o i n c l u d e s t h e o p t i o n s ` a '
w h i c h c e n t r e s t h e a n n o t a t i o n s i n t h e i r t i m e i n t e r v a l a n d ` t ' w h i c h i n c l u d e s t i m e m a r k e r s .
Time(s)
F r e q u e n c y ( k H z )
28: MODE='Jcw'
0.5 1 1.5
0
1
2
3
4
5
6
7
8
9
10
P o w e r / H z ( d B )
-10
-5
0
5
10
15
20
25
Time(s)
F r e q u e n c y ( k H z )
29: MODE='Jc'
s I k s p lV s T r i: i: k w@ z n aI n 0
0.5 1 1.50
1
2
3
4
5
6
7
8
9
10
P o w e r / H z ( d B )
-10
-5
0
5
10
15
20
25
Time(s)
F r e q u e n c y ( k H z )
30: MODE='Jcwat'
s k s p l s r i i k w z n a n
0.5 1 1.50
1
2
3
4
5
6
7
8
9
10
P o w e r / H z ( d B )
-10
-5
0
5
10
15
20
25
2 5 : ' w ' = s h o w w a v e f o r m 2 6 : A N N i n p u t 2 7 : ` w a t ' + A N N f o n t
9 O u t p u t A r g u m e n t s
S p e c i f y i n g o u t p u t a r g u m e n t s n o r m a l l y s u p p r e s s e s t h e s p e c t r o g r a m p l o t u n l e s s t h e ` g ' o p t i o n i s g i v e n . N o t e t h a t ,
p e r h a p s u n e x p e c t e d l y , t h e s p e c t r o g r a m a r r a y i s t h e t h i r d o u t p u t r a t h e r t h a n t h e r s t .
I f y o u s a v e t h e B o u t p u t ( w i t h a l i n e a r f r e q u e n c y s c a l e a n d w i t h o u t t h e ` p ' o r ` P ' o p t i o n s ) , y o u c a n u s e i t a s
t h e i n p u t t o a s u b s e q u e n t c a l l t o s p g r a m b w i n s t e a d o f a t i m e - d o m a i n w a v e f o r m . I n t h i s c a s e F S = [ F S T 1 F I N C
F 1 ] w h e r e F S i s n o w t h e f r a m e r a t e ( e a c h f r a m e i s o n e r o w o f B ) , T 1 i s t h e t i m e o f t h e r s t r o w o f B , F I N C i s
t h e f r e q u e n c y i n c r e m e n t a n d F 1 i s t h e f r e q u e n c y o f t h e r s t c o l u m n i n B .
1 0 M O D E s t r i n g o p t i o n s
a c e n t r e - a l i g n a n n o t a t i o n s r a t h e r t h a n l e f t - a l i g n i n g t h e m
b b a r k s c a l e
c i n c l u d e a c o l o u r b a r a s a n i n t e n s i t y s c a l e
d g i v e t h e B o u p u t i n d e c i b e l s r a t h e r t h a n i n p o w e r .
D c l i p t h e o u t p u t B a r r a y t o t h e l i m i t s s p e c i e d b y t h e " d b " i n p u t
e e r b s c a l e ]
f l a b e l f r e q u e n c y a x i s i n H z r a t h e r t h a n m e l / b a r k / . . .
g d r a w a g r a p h e v e n i f o u t p u t a r g u m e n t s a r e p r e s e n t
h u n i t s o f t h e F M A X i n p u t a r e i n H z i n s t e a d o f m e l / b a r k / . . . I n t h i s c a s e , t h e F s t e p p a r a m e t e r i s u s e d o n l y t o
d e t e r m i n e t h e n u m b e r o f l t e r s .
H e x p r e s s t h e F o u t p u t i n H z i n s t e a d o f m e l / b a r k / . . .
i i n v e r t e d c o l o u r m a p " ( w h i t e b a c k g r o u n d )
j j e t c o l o u r m a p
J t h e r m a l c o l o u r m a p t h a t i s l i n e a r i n g r a y s c a l e . B a s e d o n O l i v e r W o o d f o r d ' s % r e a l 2 r g b a t h t t p : / / w w w . m a t h w o r k s . c o m / m a t
l l o g 1 0 H z f r e q u e n c y s c a l e
m m e l s c a l e
6
8/2/2019 Spgram Tut
http://slidepdf.com/reader/full/spgram-tut 7/9
p c a l c u l a t e p o w e r p e r d e c a d e r a t h e r t h a n p o w e r p e r H z . T h i s e e c t i v e l y i n c r e a s e s t h e p o w e r l e v e l a t h i g h
f r e q u e n c i e s a n d s o m a e s t h e m m o r e v i s i b l e
P c a l c u l a t e p o w e r p e r e r b / m e l / . . . r a t h e r t h a n p o w e r p e r H z .
t a d d t i m e m a r k e r s w i t h a n n o t a t i o n s
w d r a w t h e s p e e c h w a v e f o r m a b o v e t h e s p e c t r o g r a m
1 1 M A T L A B C o d e f o r g u r e s
T h e f o l l o w i n g c o d e w a s u s e d t o g e n e r a t e a l l t h e g u r e s i n t h i s d o c u m e n t :
% d e m o n s t r a t i o n s f o r t h e s p g r a m b w t u t o r i a l
p = { 1 2 . 5 ' p J c w a t ' [ ] [ ] [ ] [ ] 2 ;
2 1 . 3 3 ' p c ' [ ] [ ] [ ] [ ] 0 ;
3 1 . 3 3 ' p j c ' [ ] [ ] [ ] [ ] 0 ;
4 1 . 3 3 ' p J c ' [ ] [ ] [ ] [ ] 0 ;
5 1 . 3 3 ' p i ' [ ] [ ] [ ] [ ] 0 ;
6 1 . 3 3 ' p j i ' [ ] [ ] [ ] [ ] 0 ;
7 1 . 3 3 ' p J i ' [ ] [ ] [ ] [ ] 0 ;
8 1 . 3 3 ' p J c l ' 8 0 [ ] [ ] [ ] 0 ;
9 1 . 3 3 ' p J c e ' 8 0 [ ] [ ] [ ] 0 ;
1 0 1 . 3 3 ' p J c m ' 8 0 [ ] [ ] [ ] 0 ;
1 1 1 . 3 3 ' p J c b ' 8 0 [ ] [ ] [ ] 0 ;
1 2 1 . 3 3 ' p J c b f ' 8 0 [ ] [ ] [ ] 0 ;
1 3 1 . 3 3 ' h p J c ' [ ] [ 4 0 0 0 ] [ ] [ ] 0 ;
1 4 1 . 3 3 ' h p J c ' [ ] [ 2 0 0 0 4 0 0 0 ] [ ] [ ] 0 ;
1 5 1 . 3 3 ' h p J c ' [ ] [ 2 0 0 0 2 0 0 4 0 0 0 ] [ ] [ ] 0 ;
1 6 1 . 3 3 ' p J c w a t ' [ 5 0 ] [ ] [ ] [ ] 1 ;
1 7 1 . 3 3 ' p J c w a t ' [ ] [ ] [ ] [ ] 1 ;
1 8 1 . 3 3 ' p J c w a t ' [ 4 0 0 ] [ ] [ ] [ ] 1 ;
1 9 1 . 3 3 ' p J c w a t ' [ 2 0 ] [ ] [ ] [ ] 1 ;
2 0 1 . 3 3 ' p J c w a t ' [ 2 0 ] [ ] [ ] [ 0 . 0 0 5 ] 1 ;
2 1 1 . 3 3 ' p J c w a t ' [ 2 0 ] [ ] [ ] [ 1 . 1 0 . 0 0 1 1 . 4 ] 1 ;
2 2 1 . 3 3 ' J c ' [ ] [ ] [ ] [ ] 0 ;
2 3 1 . 3 3 ' p J c ' [ ] [ ] [ ] [ ] 0 ;
2 4 1 . 3 3 ' P J c b f ' [ ] [ ] [ ] [ ] 0 ;
2 5 1 . 3 3 ' J c ' [ ] [ ] [ ] [ ] 0 ;
2 6 1 . 3 3 ' J c ' [ ] [ ] [ 6 0 ] [ ] 0 ;
2 7 1 . 3 3 ' J c ' [ ] [ ] [ − 2 5 0 ] [ ] 0 ;
2 8 1 . 3 3 ' J c w ' [ ] [ ] [ ] [ ] 0 ;
2 9 1 . 3 3 ' J c ' [ ] [ ] [ ] [ ] 1 ;
3 0 1 . 3 3 ' J c w a t ' [ ] [ ] [ ] [ ] 2 } ;
y f i g = 4 2 0 ; % h e i g h t o f f i g u r e s
e m f = 1 ; % s e t t o 1 t o p r i n t
a r g s = { ' B W ' ' F M A X ' ' D B ' ' T I N C ' } ;
% r e a d t h e S F S − f o r m a t s p e e c h f i l e
f n = ' . . / d a t a / a t 0 5 f 0 . s f s ' ;
[ s p , f s ] = r e a d s f s ( f n , 1 , 1 ) ; % s p e e c h s i g n a l
[ p t , f w ] = r e a d s f s ( f n , 5 , 2 ) ; % p h o n e t i c t r a n s c r i p t i o n
a n n = [ m a t 2 c e l l ( [ c e l l 2 m a t ( p t ( : , 1 ) ) c e l l 2 m a t ( p t ( : , 1 : 2 ) ) ∗ [ 1 ; 1 ] ] / f w , o n e s ( 1 , s i z e ( p t , 1 ) ) ) p t ( : , 3 )
i p a = a n n ( : , [ 1 2 2 ] ) ;
i p a ( : , 2 ) = { ' s ' ' I ' ' k ' ' s ' ' p ' ' l ' ' Ã ' ' s ' ' T ' ' r ' ' i ' ' i ' ' k ' ' w ' ' ' ' z ' ' n ' ' a I ' ' n ' ' '
i p a ( : , 3 ) = r e p m a t ( { ' S I L D o u l o s I P A 9 3 ' } , s i z e ( i p a , 1 ) , 1 ) ;
f o r i = 1 : s i z e ( p , 1 )
i f p { i , 1 } > 0
f i g u r e ( p { i , 1 } )
7
8/2/2019 Spgram Tut
http://slidepdf.com/reader/full/spgram-tut 8/9
s e t ( g c f , ' P o s i t i o n ' , [ 1 0 0 1 0 0 r o u n d ( y f i g ∗ p { i , 2 } ) y f i g ] , ' I n v e r t H a r d c o p y ' , ' o f f ' ) ;
s w i t c h p { i , 8 }
c a s e 0
s p g r a m b w ( s p , f s , p { i , 3 } , p { i , 4 } , p { i , 5 } , p { i , 6 } , p { i , 7 } ) ;
c a s e 1
s p g r a m b w ( s p , f s , p { i , 3 } , p { i , 4 } , p { i , 5 } , p { i , 6 } , p { i , 7 } , a n n ) ;
c a s e 2
s p g r a m b w ( s p , f s , p { i , 3 } , p { i , 4 } , p { i , 5 } , p { i , 6 } , p { i , 7 } , i p a ) ;
e n d
s s = s p r i n t f ( ' % d : M O D E = ' ' % s ' ' ' , p { i , 1 } , p { i , 3 } ) ;
f o r j = 4 : 7
i f n u m e l ( p { i , j } ) = = 1
s s = s p r i n t f ( ' % s , % s = % g ' , s s , a r g s { j − 3 } , p { i , j } ) ;
e l s e i f n u m e l ( p { i , j } ) > 1
s s = s p r i n t f ( ' % s , % s = [ % s ' , s s , a r g s { j − 3 } , s p r i n t f ( ' % g ' , p { i , j } ) ) ;
s s = [ s s ( 1 : e n d − 1 ) ' ] ' ] ;
e n d
e n d
t i t l e ( s s ) ;
i f e m f , e v a l ( s p r i n t f ( ' p r i n t −d m e t a % s ' , s p r i n t f ( ' % s % d ' , m f i l e n a m e , r o u n d ( g c f ) ) ) ) ; e n d
i f i > 1 & & i < 2 8
c l o s e ( i ) ;
e n d
e n d
e n d
% n o w p l o t o t h e r g r a p h s
f o r i = 2 0 1 : 2 0 1
f i g u r e ( i )
s w i t c h i
c a s e 2 0 1
f a x = l i n s p a c e ( 0 , 6 0 0 0 , 2 0 0 ) ' ;
y = [ f a x [ n a n ; l o g 1 0 ( f a x ( 2 : e n d ) ) ] f r q 2 m e l ( f a x ) f r q 2 b a r k ( f a x ) f r q 2 e r b ( f a x ) ] ;
[ v , i v ] = m i n ( a b s ( f a x − 1 0 0 0 ) ) ;
y = y . / r e p m a t ( y ( i v , : ) , l e n g t h ( f a x ) , 1 ) ;
p l o t ( f a x / 1 0 0 0 , y ) ;
s e t ( g c a , ' y l i m ' , [ 0 3 ] ) ;
x l a b e l ( ' F r e q u e n c y ( k H z ) ' ) ;
y l a b e l ( ' S c a l e r e l a t i v e t o 1 k H z ' ) ;
t i t l e ( ' F r e q u e n c y s c a l e s ' )
t x t = { 2 . 8 2 . 7 ' l i n ' ; 5 1 . 1 ' l o g ' ; 4 . 7 2 . 5 ' m e l ' ; 5 . 2 2 . 1 5 ' b a r k ' ; 4 . 5 1 . 7 ' e r b − r
f o r j = 1 : 5
t e x t ( t x t { j , 1 } , t x t { j , 2 } , t x t { j , 3 } )
e n d
f i g b o l d e n
e n d
i f e m f , e v a l ( s p r i n t f ( ' p r i n t −d m e t a % s ' , s p r i n t f ( ' % s % d ' , m f i l e n a m e , r o u n d ( g c f ) ) ) ) ; e n d
c l o s e ( i ) ;
e n d
R e f e r e n c e s
[ B r o 9 7 ] D . M . B r o o k e s , V O I C E B O X : A s p e e c h p r o c e s s i n g t o o l b o x f o r M A T L A B , 1 9 9 7 . [ O n l i n e ] . A v a i l a b l e :
h t t p : / / w w w . e e . i m p e r i a l . a c . u k / h p / s t a / d m b / v o i c e b o x / v o i c e b o x . h t m l
[ G h i 9 4 ] O . G h i t z a , A u d i t o r y m o d e l s a n d h u m a n p e r f o r m a n c e i n t a s k s r e l a t e d t o s p e e c h c o d i n g a n d s p e e c h
r e c o g n i t i o n , I E E E T r a n s . S p e e c h A u d i o P r o c e s s . , v o l . 2 , p p . 1 1 5 1 3 2 , J a n . 1 9 9 4 .
[ M G 8 3 ] B . C . J . M o o r e a n d B . R . G l a s b e r g , S u g g e s t e d f o r m u l a e f o r c a l c u l a t i n g a u d i t o r y - l t e r b a n d w i d t h s
a n d e x c i t a t i o n p a t t e r n s , J . A c o u s t . S o c . A m . , v o l . 7 4 , p p . 7 5 0 7 5 3 , 1 9 8 3 .
8
8/2/2019 Spgram Tut
http://slidepdf.com/reader/full/spgram-tut 9/9
[ S V N 3 7 ] S . S . S t e v e n s , J . V o l k m a n , a n d E . B . N e w m a n , A s c a l e f o r t h e m e a s u r e m e n t o f t h e p s y c h o l o g i c a l
m a g n i t u d e o f p i t c h , J . A c o u s t . S o c . A m . , v o l . 8 , p p . 1 8 5 1 9 , 1 9 3 7 .
[ Z T 8 0 ] E . Z w i c k e r a n d E . T e r h a r d t , A n a l y t i c a l e x p r e s s i o n s f o r c r i t i c a l - b a n d r a t e a n d c r i t i c a l b a n d w i d t h a s a
f u n c t i o n o f f r e q u e n c y , J . A c o u s t . S o c . A m . , v o l . 6 8 , n o . 5 , p p . 1 5 2 3 1 5 2 5 , N o v . 1 9 8 0 .
[ Z w i 6 1 ] E . Z w i c k e r , S u b d i v i s i o n o f a u d i b l e f r e q u e n c y r a n g e i n t o c r i t i c a l b a n d s , J . A c o u s t . S o c . A m . , v o l . 3 3 ,
p . 2 4 8 , 1 9 6 1 .
9