 #   T h i s   s c r i p t   c r e a t e s   a   T e x t G r i d   o b j e c t   f o r   a   S o u n d   o b j e c t   a n d   s e t s   b o u n d a r i e s   a t   p a u s e s   
 
 #   o n   t h e   b a s i s   o f   a n   i n t e n s i t y   a n a l y s i s . 
 
 #   T h e   b o u n d a r i e s   w i l l   b e   s e t   e i t h e r   i n   t h e   c e n t r e   t i m e   o f   a   p a u s e   o r   a t   t h e   b e g i n n i n g   
 
 #   a n d   e n d   o f   p a u s e s .   I n   t h e   l a t t e r   c a s e   y o u   c a n   a l s o   g i v e   a   t i m e   m a r g i n   t h a t   w i l l   b e   l e f t   
 
 #   a r o u n d   t h e   s o u n d   s e g m e n t s .   U s e   a   b i g g e r   m a r g i n   i f   t h e   p a u s e   d e t e c t i o n   
 
 #   d o e s   n o t   s e e m   t o   w o r k   a c c u r a t e l y .   D i f f e r e n t   a m o u n t s   o f   b a c k g r o u n d   n o i s e   c a n   c h a n g e   t h e 
 
 #   i d e a l   p a u s e   d e t e c t i o n   p a r a m e t e r s ,   a n d   d i f f e r e n t   s p e a k e r s   h a v e   d i f f e r e n t   p a u s e   d u r a t i o n , 
 
 #   s o   y o u   s h o u l d   a l s o   t r y   t o   m o d i f y   t h e   p a u s e   d e t e c t i o n   p a r a m e t e r s   t o   i m p r o v e   t h e   a c c u r a c y . 
 
 
 
 #   H o w   t o   r u n   t h i s   s c r i p t : 
 
 #   1 .   O p e n   t h e   P r a a t   p r o g r a m 
 
 #   2 .   B e f o r e   r u n n i n g   t h e   s c r i p t ,   y o u   s h o u l d   o p e n   a   S o u n d   f i l e   ( R e a d   m e n u )   
 
 #         a n d   m a k e   s u r e   i t   i s   s e l e c t e d   i n   t h e   O b j e c t   w i n d o w . 
 
 #   3 .   C h o o s e   O p e n   s c r i p t   f r o m   t h e   C o n t r o l   m e n u 
 
 #   4 .   L o o k   f o r   t h i s   t e x t   f i l e . 
 
 #   5 .   T h e n   c h o o s e   R u n   f r o m   t h e   R u n   m e n u   o f   t h e   s c r i p t   w i n d o w . 
 
 #   
 
 #   T h i s   s c r i p t   i s   d i s t r i b u t e d   u n d e r   t h e   G N U   G e n e r a l   P u b l i c   L i c e n s e . 
 
 #   C o p y r i g h t   M i e t t a   L e n n e s   2 5 . 1 . 2 0 0 2 
 
 # 
 
 #   F i x e s : 
 
 #   -   A d d e d   c h e c k s   f o r   e x i s t i n g   b o u n d a r i e s   a n d   o v e r l a p p i n g   p a u s e   r e g i o n s .   M L   2 3 . 1 . 2 0 0 6 
 
 
 
 #   F i x e s : 
 
 #   - C h a n g e d   t h e   r e q u i r e d   f i l e   t y p e   " L o n g S o u n d "   t o   " o r d i n a r y   s o u n d " . 
 
 #   -   A d d e d   c o d e   l i n e s   t o   r e m o v e   t h e   f i r s t   a d d i t i o n a l   b o u n d a r y   a n d   t h e   l a s t   m i s s i n g   b o u n d a r y .   Q i b i n   R a n .   O c t . 4 ,   2 0 1 9 . 
 
 
 
 # * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 
 
 #   D E F A U L T   V A L U E S   ( i n i t i a l i z a t i o n   o f   v a r i a b l e s ) 
 
 #   T h e   n a m e   o f   t h e   s e l e c t e d   S o u n d   o b j e c t   i s   p u t   t o   s t r i n g   s o u n d n a m e $ : 
 
 
 
 f o r m   G i v e   t h e   p a r a m e t e r s   f o r   p a u s e   a n a l y s i s 
 
       c o m m e n t   T h i s   s c r i p t   m a r k s   t h e   p a u s e s   i n   t h e   S o u n d   t o   t h e   I n t e r v a l T i e r   o f   t h e   T e x t G r i d . 
 
       c o m m e n t   G i v e   t h e   t i m e   p e r i o d   y o u   w i s h   t o   i n c l u d e   ( T h e   T e x t G r i d   w i l l   b e   o v e r w r i t t e n ! ) : 
 
       r e a l   S t a r t i n g _ t i m e _ ( s e c o n d s )   0 
 
       r e a l   F i n i s h i n g _ t i m e _ ( 0 = a l l )   0 
 
       c o m m e n t   T h e   f o l l o w i n g   c r i t e r i a   d e f i n e   a   p a u s e : 
 
       p o s i t i v e   M i n i m u m _ d u r a t i o n _ ( s e c o n d s )   0 . 2 
 
       p o s i t i v e   M a x i m u m _ i n t e n s i t y _ ( d B )   5 5 
 
       c o m m e n t   G i v e   t h e   i n t e n s i t y   a n a l y s i s   p a r a m e t e r s : 
 
 	   p o s i t i v e   M i n i m u m _ p i t c h _ ( H z )   8 0 
 
 	   i n t e g e r   T i m e _ s t e p _ ( 0 = a u t o )   0 
 
       c o m m e n t   G i v e   t h e   w i n d o w   s i z e   f o r   t h e   i n t e n s i t y   a n a l y s e s   ( s m a l l e r   w i n d o w   r e q u i r e s   l e s s   m e m o r y ) : 
 
 	   p o s i t i v e   W i n d o w _ s i z e _ ( s e c o n d s )   2 0 
 
 	   c h o i c e   B o u n d a r y _ p l a c e m e n t   2 
 
 	 b u t t o n   O n e   b o u n d a r y   a t   t h e   c e n t e r   o f   e a c h   p a u s e 
 
 	 b u t t o n   T w o   b o u n d a r i e s   w i t h   a   t i m e   m a r g i n   o f : 
 
 	 p o s i t i v e   M a r g i n _ ( s e c o n d s )   0 . 0 0 1 
 
 	 c o m m e n t   ( T h e   m a r g i n   w i l l   n o t   b e   u s e d   i f   t h e   p a u s e   i s   s h o r t e r   t h a n   2   *   m a r g i n . ) 
 
 	 b o o l e a n   M a r k _ p a u s e _ i n t e r v a l s _ w i t h _ x x x   0 
 
       c o m m e n t   S a v e   T e x t G r i d   f i l e   t o   f o l d e r : 
 
 	 t e x t   f o l d e r   C : \ U s e r s \ d e l l \ D e s k t o p \ 2 0 2 0^t 4g 2 1eN
gPe  XeNhlP\ \ 
 
       c o m m e n t   T h e   s c r i p t   w i l l   p a u s e   a f t e r   c a l c u l a t i n g   4   w i n d o w s ,   s o   y o u   c a n   i n t e r r u p t   t h e   s c r i p t   a n d   c h e c k   i f   t h e   p a u s e   d e t e c t i o n   w o r k s   o p t i m a l l y . 
 
 e n d f o r m 
 
 
 
 
 
 s o u n d n a m e $   =   s e l e c t e d $   ( " S o u n d " ) 
 
 T o   T e x t G r i d . . .   s e n t e n c e   
 
 
 
 i f   f i l e R e a d a b l e   ( " ' f o l d e r $ ' ' s o u n d n a m e $ ' . T e x t G r i d " ) 
 
 	 p a u s e   T h e   f i l e   ' f o l d e r $ ' ' s o u n d n a m e $ ' . T e x t G r i d   a l r e a d y   e x i s t s .   D o   y o u   w a n t   t o   o v e r w r i t e   i t ? 
 
 e n d i f 
 
 
 
 s e l e c t   T e x t G r i d   ' s o u n d n a m e $ ' 
 
 	 e n d o f s o u n d   =   G e t   f i n i s h i n g   t i m e 
 
 s e l e c t   S o u n d   ' s o u n d n a m e $ ' 
 
 	 p a u s e n u m b e r   =   0 
 
 	 d u r a t i o n   =   0 
 
 	 c o u n t   =   0 
 
 	 l o o p s   =   0 
 
 	 p a u s e s _ f o u n d   =   0 
 
 	 w i n d o w s t a r t   =   0 
 
 	 w i n d o w e n d   =   0 
 
 	 f r a m e   =   0 
 
 	 f r a m e s   =   0 
 
 	 t i m e   =   0 
 
 	 i n t e n s i t y   =   0 
 
 	 p a u s e d e t e c t e d   =   0 
 
 	 p a u s e s t a r t   =   0 
 
 	 p a u s e e n d   =   0 
 
 	 p a u s e n u m b e r   =   0 
 
 	 h a l f p a u s e   =   0 
 
 #   T h i s   f o r m   p r o m p t s   f o r   p a r a m e t e r s   f o r   t h e   p a u s e   a n a l y s i s : 
 
 i f   f i n i s h i n g _ t i m e   <   0 
 
 e x i t   F i n i s h i n g   t i m e   m u s t   b e   g r e a t e r   t h a n   o r   e q u a l   t o   z e r o !   ( I f   y o u   g i v e   a   z e r o ,   t h e   w h o l e   S o u n d   w i l l   b e   a n a l y s e d . ) 
 
 e n d i f 
 
 i f   f i n i s h i n g _ t i m e   =   0 
 
 f i n i s h i n g _ t i m e   =   e n d o f s o u n d 
 
 e n d i f 
 
 # * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 
 
 #   B E G I N 
 
 # * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 
 
 #   D I V I D E   L O N G S O U N D   I N T O   S H O R T E R   P E R I O D S   A N D   L O O P   T H R O U G H   E A C H 
 
 d u r a t i o n   =   f i n i s h i n g _ t i m e   -   s t a r t i n g _ t i m e 
 
 # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
 
 #   D e f a u l t   n u m b e r   o f   l o o p s   i s   1 
 
 l o o p s   =   1 
 
 #   b u t   i f   t h e   p e r i o d   t o   b e   a n a l y s e d   i s   l o n g e r   t h a n   6 0   s e c o n d s ,   i t   w i l l   b e   d i v i d e d   i n t o   6 0 - s e c o n d 
 
 #   p e r i o d s   f o r   w h i c h   t h e   a n a l y s i s   i s   m a d e : 
 
 i f   d u r a t i o n   >   w i n d o w _ s i z e 
 
 l o o p s   =   c e i l i n g   ( ( d u r a t i o n / w i n d o w _ s i z e ) ) 
 
 e n d i f 
 
 # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
 
 #   S T A R T   L O O P I N G   T H R O U G H   S H O R T   W I N D O W S   H E R E 
 
 c o u n t   =   1 
 
 l a t e s t _ e n d b o u n d a r y   =   0 
 
 w h i l e   c o u n t   < =   l o o p s 
 
 	 i f   c o u n t   =   5 
 
 	 	 p a u s e   C o n t i n u e ? 
 
 	 e n d i f 
 
 	 #   C r e a t e   a   w i n d o w   o f   t h e   S o u n d   a n d   e x t r a c t   i t   f o r   a n a l y s i s 
 
 	 w i n d o w s t a r t   =   s t a r t i n g _ t i m e   +   ( ( c o u n t   -   1 )   *   w i n d o w _ s i z e ) 
 
 	 w i n d o w e n d   =   s t a r t i n g _ t i m e   +   ( c o u n t   *   w i n d o w _ s i z e ) 
 
 	 i f   w i n d o w e n d   >   e n d o f s o u n d 
 
 	 w i n d o w e n d   =   e n d o f s o u n d 
 
 	 e n d i f 
 
 	 i f   w i n d o w e n d   >   f i n i s h i n g _ t i m e 
 
 	 w i n d o w e n d   =   f i n i s h i n g _ t i m e 
 
 	 e n d i f 
 
 	 s e l e c t   S o u n d   ' s o u n d n a m e $ ' 
 
 	 E x t r a c t   p a r t . . .   w i n d o w s t a r t   w i n d o w e n d   r e c t a n g u l a r   1 . 0   y e s 
 
 	 w i n d o w n a m e $   =   " W i n d o w _ "   +   " ' c o u n t ' "   +   " _ o f _ "   +   " ' l o o p s ' " 
 
 	 e c h o   A n a l y s i n g   I n t e n s i t y   w i n d o w   ' c o u n t '   o f   ' l o o p s ' 
 
 	 i f   c o u n t   <   5 
 
 	 	 p r i n t l i n e   T h e   s c r i p t   w i l l   p a u s e   a f t e r   c a l c u l a t i n g   4   w i n d o w s ,   s o   y o u   c a n   c h e c k   t h e   r e s u l t . . . 
 
 	 e n d i f 
 
 	 R e n a m e . . .   ' w i n d o w n a m e $ ' 
 
 	 # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
 
 	 #   C A L C U L A T E   I N T E N S I T Y 
 
 	 T o   I n t e n s i t y . . .   m i n i m u m _ p i t c h   t i m e _ s t e p 
 
 	 f r a m e s   =   G e t   n u m b e r   o f   f r a m e s 
 
 	 # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
 
 	 #   C h e c k   t h e   p a u s e   c r i t e r i a 
 
 	 p a u s e e n d   =   0 
 
 	 f r a m e   =   1 
 
 	 	 # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
 
 	 	 #   L o o p   t h r o u g h   a l l   f r a m e s   i n   t h e   I n t e n s i t y   o b j e c t : 
 
 	 	 w h i l e   f r a m e   < =   f r a m e s 
 
 	 	 	 s e l e c t   I n t e n s i t y   ' w i n d o w n a m e $ ' 
 
 	 	 	 i n t e n s i t y   =   G e t   v a l u e   i n   f r a m e . . .   f r a m e 
 
 	 	 	 t i m e   =   G e t   t i m e   f r o m   f r a m e . . .   f r a m e 
 
 	 	 	 	 i f   i n t e n s i t y   >   m a x i m u m _ i n t e n s i t y 
 
 	 	 	 	 	 #   I f   t h e   e n d   o f   a n   e a r l i e r   d e t e c t e d   p o s s i b l e   p a u s e   h a s   b e e n   r e a c h e d : 
 
 	 	 	 	 	 i f   p a u s e d e t e c t e d   =   1 
 
 	 	 	 	 	 	 i f   f r a m e   -   1   <   1 
 
 	 	 	 	 	 	 p a u s e e n d   =   w i n d o w s t a r t 
 
 	 	 	 	 	 	 e l s e 
 
 	 	 	 	 	 	 p a u s e e n d   =   G e t   t i m e   f r o m   f r a m e . . .   ( f r a m e   -   1 ) 
 
 	 	 	 	 	 	 e n d i f 
 
 	 	 	 	 	 	 p a u s e d e t e c t e d   =   0 
 
 	 	 	 	 	 e n d i f 
 
 	 	 	 	         #   I f   b e l o w   i n t e n s i t y   l i m i t ,   a   p o s s i b l e   n e w   p a u s e   i s   s t a r t e d   i f   o n e   h a s n ' t   b e e n   d e t e c t e d   y e t : 
 
 	 	 	 	         e l s i f   p a u s e d e t e c t e d   =   0 
 
 	 	 	 	 	 	 p a u s e s t a r t   =   G e t   t i m e   f r o m   f r a m e . . .   f r a m e 
 
 	 	 	 	 	 	 p a u s e e n d   =   0 
 
 	 	 	 	 	 	 p a u s e d e t e c t e d   =   1 
 
 	 	 	 	 	 	 p a u s e n u m b e r   =   p a u s e n u m b e r   +   1 
 
 	 	 	 	 #   I f   a   d e t e c t e d   p a u s e   j u s t   c o n t i n u e s ,   d o   n o t h i n g   s p e c i a l . 
 
 	 	 	 	 e n d i f 
 
 	 	 	 # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
 
 	 	 	 #   I F   P A U S E   C R I T E R I A   A R E   F U L F I L L E D ,   A D D   A   B O U N D A R Y   O R   T W O   T O   T E X T G R I D 
 
 	 	 	 i f   p a u s e e n d   >   0 
 
 	 	 	 	 p a u s e d u r a t i o n   =   p a u s e e n d   -   p a u s e s t a r t 
 
 	 	 	 	 i f   p a u s e d u r a t i o n   > =   m i n i m u m _ d u r a t i o n 
 
 	 	 	 	 	 s e l e c t   T e x t G r i d   ' s o u n d n a m e $ ' 
 
 	 	 	 	 	 h a l f p a u s e   =   p a u s e d u r a t i o n   /   2 
 
 	 	 	 	 	 	 i f   b o u n d a r y _ p l a c e m e n t   =   1 
 
 	 	 	 	 	 	 	 b o u n d a r y   =   p a u s e s t a r t   +   h a l f p a u s e 
 
 	 	 	 	 	 	 	 c a l l   B o u n d a r y C h e c k 
 
 	 	 	 	 	 	 	 i f   b o u n d a r y e x i s t s   =   0 
 
 	 	 	 	 	 	 	 	 I n s e r t   b o u n d a r y . . .   1   b o u n d a r y 
 
 	 	 	 	 	 	 	 	 l a t e s t _ e n d b o u n d a r y   =   b o u n d a r y 
 
 	 	 	 	 	 	 	 e n d i f 
 
 	 	 	 	 	 	 e l s e 
 
 	 	 	 	 	 	 	 b o u n d a r y   =   0 
 
 	 	 	 	 	 	 	 i f   p a u s e d u r a t i o n   > =   ( 2   *   m a r g i n ) 
 
 	 	 	 	 	 	 	 	 i f   p a u s e s t a r t   >   m a r g i n 
 
 	 	 	 	 	 	 	 	 	 b o u n d a r y   =   p a u s e s t a r t   +   m a r g i n 
 
 	 	 	 	 	 	 	 	 	 c a l l   B o u n d a r y C h e c k 
 
 	 	 	 	 	 	 	 	 	 i f   b o u n d a r y e x i s t s   =   0   a n d   b o u n d a r y   >   l a t e s t _ e n d b o u n d a r y 
 
 	 	 	 	 	 	 	 	 	 	 I n s e r t   b o u n d a r y . . .   1   b o u n d a r y 
 
 	 	 	 	 	 	 	 	 	 e n d i f 
 
 	 	 	 	 	 	 	 	 	 # I f   t h e   p a u s e   o v e r l a p s   w i t h   t h e   p r e c e d i n g   p a u s e ,   d o   a   m e r g e : 
 
 	 	 	 	 	 	 	 	 	 i f   b o u n d a r y   =   l a t e s t _ e n d b o u n d a r y 
 
 	 	 	 	 	 	 	 	 	 	 R e m o v e   b o u n d a r y   a t   t i m e . . .   1   b o u n d a r y 
 
 	 	 	 	 	 	 	 	 	 e n d i f 
 
 	 	 	 	 	 	 	 	 e n d i f 
 
 	 	 	 	 	 	 	 	 i f   m a r k _ p a u s e _ i n t e r v a l s _ w i t h _ x x x   =   1 
 
 	 	 	 	 	 	 	 	 	 p a u s e i n t e r v a l   =   G e t   i n t e r v a l   a t   t i m e . . .   1   b o u n d a r y 
 
 	 	 	 	 	 	 	 	 	 S e t   i n t e r v a l   t e x t . . .   1   p a u s e i n t e r v a l   x x x 
 
 	 	 	 	 	 	 	 	 e n d i f 
 
 	 	 	 	 	 	 	 	 b o u n d a r y   =   p a u s e e n d   -   m a r g i n 
 
 	 	 	 	 	 	 	 	 c a l l   B o u n d a r y C h e c k 
 
 	 	 	 	 	 	 	 	 i f   b o u n d a r y e x i s t s   =   0   a n d   b o u n d a r y   >   l a t e s t _ e n d b o u n d a r y 
 
 	 	 	 	 	 	 	 	 	 I n s e r t   b o u n d a r y . . .   1   b o u n d a r y 
 
 	 	 	 	 	 	 	 	 	 l a t e s t _ e n d b o u n d a r y   =   b o u n d a r y 
 
 	 	 	 	 	 	 	 	 e n d i f 
 
 	 	 	 	 	 	 	 e l s e 
 
 	 	 	 	 	 	 	 	 i f   p a u s e e n d   <   ( e n d o f s o u n d   -   m a r g i n ) 
 
 	 	 	 	 	 	 	 	 	 b o u n d a r y   =   p a u s e s t a r t   +   h a l f p a u s e 
 
 	 	 	 	 	 	 	 	 	 c a l l   B o u n d a r y C h e c k 
 
 	 	 	 	 	 	 	 	 	 i f   b o u n d a r y e x i s t s   =   0   a n d   b o u n d a r y   >   l a t e s t _ e n d b o u n d a r y 
 
 	 	 	 	 	 	 	 	 	 	 I n s e r t   b o u n d a r y . . .   1   b o u n d a r y 
 
 	 	 	 	 	 	 	 	 	 	 l a t e s t _ e n d b o u n d a r y   =   b o u n d a r y 
 
 	 	 	 	 	 	 	 	 	 e n d i f 
 
 	 	 	 	 	 	 	 	 e n d i f 
 
 	 	 	 	 	 	 	 e n d i f 
 
 	 	 	 	 	 	 e n d i f 
 
 	 	 	 	 	 p a u s e e n d   =   0 
 
 	 	 	 	 	 p a u s e s _ f o u n d   =   p a u s e s _ f o u n d   +   1 
 
 	 	 	 	 	 W r i t e   t o   t e x t   f i l e . . .   ' f o l d e r $ ' ' s o u n d n a m e $ ' . T e x t G r i d 
 
 	 	 	 	 e n d i f 
 
 	 	 	 e n d i f 
 
 	 	 	 f r a m e   =   f r a m e   +   1 
 
 	 	 	 #   W h e n   a l l   f r a m e s   i n   t h e   i n t e n s i t y   a n a l y s i s   h a v e   b e e n   l o o k e d   a t ,   e n d   t h e   f r a m e   l o o p . 
 
 	 	 e n d w h i l e 
 
 	 	 # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
 
 	 s e l e c t   S o u n d   ' w i n d o w n a m e $ ' 
 
 	 R e m o v e 
 
 	 s e l e c t   I n t e n s i t y   ' w i n d o w n a m e $ ' 
 
 	 R e m o v e 
 
 	 #   E N D   L O O P I N G   T H R O U G H   W I N D O W S   H E R E 
 
 	 c o u n t   =   c o u n t   +   1 
 
 e n d w h i l e 
 
 s e l e c t   T e x t G r i d   ' s o u n d n a m e $ ' 
 
 R e m o v e   r i g h t   b o u n d a r y . . .   1   1   
 
 
 
 s e l e c t   S o u n d   ' s o u n d n a m e $ ' 
 
 	 E x t r a c t   p a r t . . .   w i n d o w s t a r t   w i n d o w e n d   r e c t a n g u l a r   1 . 0   y e s 
 
 	 s N a m e $   =   s e l e c t e d $ ( " S o u n d " ) 
 
 	 T o   I n t e n s i t y . . .   m i n i m u m _ p i t c h   t i m e _ s t e p 
 
 	 n f r a m e s   =   G e t   n u m b e r   o f   f r a m e s 
 
 
 
 	 f o r   i i   t o   n f r a m e s 
 
 	 	 x   =   n f r a m e s   +   1   - i i 
 
 	 	 s e l e c t   I n t e n s i t y   ' s N a m e $ ' 
 
 	 	 	 i n t e n s i t y   =   G e t   v a l u e   i n   f r a m e :   x 
 
 	 	 	 i f   i n t e n s i t y   >   m a x i m u m _ i n t e n s i t y 
 
 	 	 	 	 t i m e   =   G e t   t i m e   f r o m   f r a m e :   x 
 
 	 	 	 	 s e l e c t   T e x t G r i d   ' s o u n d n a m e $ ' 
 
 	 	 	 	 I n s e r t   b o u n d a r y . . .   1   t i m e 
 
 	 	 	 	 i i   =   n f r a m e s   +   1 	 	 	 	 
 
 	 	 	 e n d i f 
 
 	 e n d f o r 
 
 
 
 s e l e c t   T e x t G r i d   ' s o u n d n a m e $ ' 
 
 W r i t e   t o   t e x t   f i l e . . .   ' f o l d e r $ ' ' s o u n d n a m e $ ' . T e x t G r i d 
 
 
 
 # s e l e c t   a l l 
 
 # R e m o v e 
 
 
 
 e c h o   R e a d y !   T h e   T e x t G r i d   f i l e   w a s   s a v e d   a s   ' f o l d e r $ ' ' s o u n d n a m e $ ' . T e x t G r i d . 
 
 
 
 # * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 
 
 
 
 p r o c e d u r e   B o u n d a r y C h e c k 
 
 #   T h i s   p r o c e d u r e   c h e c k s   w h e t h e r   a   b o u n d a r y   a l r e a d y   e x i s t s   a t   a   g i v e n   t i m e   ( i n   t i e r   1 ) . 
 
 #   A d d e d   2 3 . 1 . 2 0 0 6 
 
 	 t m p i n t   =   G e t   i n t e r v a l   a t   t i m e . . .   1   b o u n d a r y 
 
 	 t m p s t a r t   =   G e t   s t a r t i n g   p o i n t . . .   1   t m p i n t 
 
 	 i f   t m p s t a r t   < >   b o u n d a r y 
 
 	 	 b o u n d a r y e x i s t s   =   0 
 
 	 e l s e 
 
 	 	 b o u n d a r y e x i s t s   =   1 
 
 	 e n d i f 
 
 e n d p r o c 
 
