form positive Interval_(time_interval_to_be_sampled) 0.02 positive CompressionRatio_(0= 1 exit CompressionRatio to high, must be < 1 endif if compressionRatio <= 0 exit CompressionRatio to small, must be > 0 endif #This script compresses all selected sounds by "sampling" time intervals #specified by the variable Interval and cutting off the ratio #of the interval specified by the Compression Ratio #So if the interval is 0.2 and the compression ratio 0.1 #the first 200 ms will be taken, the last 20ms will be deleted #and concanated with the interval 200-380 (the next interval - 10 percent) #and so on ratio = compressionRatio interval2 = interval interval = interval2 - ratio * interval2 n = numberOfSelected("Sound") if n <1 exit select at least one Sound!! endif for s from 1 to n snd's' = selected("Sound",'s') snd's'$ = selected$("Sound",'s') endfor for s from 1 to n snd = snd's' snd$ = snd's'$ select snd Copy... now To TextGrid... w t = Get total duration steps = 2 * (floor(t/interval2)) for i from 1 to steps if ((i mod 2) == 0) tijd = interval2 * i/2 else tijd = interval2 * (i-1)/2 + interval endif Insert boundary... 1 'tijd' Set interval text... 1 'i' 'i' endfor Set interval text... 1 'i' 'i' plus Sound now Extract intervals where... 1 no "is equal to" 1 Rename... latest for i from 1 to steps if ((i mod 2) == 1) select Sound now plus TextGrid now Extract intervals where... 1 no "is equal to" 'i' Rename... this plus Sound latest Concatenate select Sound latest plus Sound this Remove select Sound chain Rename... latest endif endfor select Sound latest Rename... 'snd$'_compressed select Sound now plus TextGrid now Remove endfor