Programmer Guide/Command Reference/EVAL/aseg1: Difference between revisions
From STX Wiki
< Programmer Guide | Command Reference | EVAL
Jump to navigationJump to search
No edit summary |
No edit summary |
||
Line 6: | Line 6: | ||
:;<var>n</var>: minimum length of a signal segment in frames; 0 < n < <code>nrow(''x'')</code> | :;<var>n</var>: minimum length of a signal segment in frames; 0 < n < <code>nrow(''x'')</code> | ||
:;<var>m</var>: smoothing length; 0 <= m</code>; if ''m'' is greater than zero, the segmentation is performed on a smoothed data vector ''xs''. | :;<var>m</var>: smoothing length; 0 <= m</code>; if ''m'' is greater than zero, the segmentation is performed on a smoothed data vector ''xs''. | ||
::<code>''xs''[i] = avr(''x''[i-m], .., ''x''[i+m])</code> | :::<code>''xs''[i] = avr(''x''[i-m], .., ''x''[i+m]); with: i=0..nrow(''x'')</code> | ||
:;<var>xmin</var>: segment threshhold | :;<var>xmin</var>: segment threshhold | ||
:;<var>omax</var>: offset for segment center; 0 < omax | :;<var>omax</var>: offset for segment center; 0 < omax |
Revision as of 15:02, 12 April 2011
This function implements a simple automatic signal segmentation based on the energy (rms) track of the signal.
- Usage 1
aseg1(x, 0, n, m, xmin, omax)
- x
- data vector (usally rms track in dB)
- n
- minimum length of a signal segment in frames; 0 < n <
nrow(x)
- m
- smoothing length; 0 <= m; if m is greater than zero, the segmentation is performed on a smoothed data vector xs.
xs[i] = avr(x[i-m], .., x[i+m]); with: i=0..nrow(x)
- xmin
- segment threshhold
- omax
- offset for segment center; 0 < omax
- Description
-
- A segment is a continuous range of x, where all values are greater than xmin
- The center of a segment is a continuous range of values inside a segment, where all values are greater than xmax-omax (with: xmax is the maximum value inside the segment).
- Result 1
- A matrix r with 4 rows. Each column of r defines one segment. Note that all values of r are frame indices (or row indices) of the data vector x.
r[0,i] beginning of the segment i r[1,i] beginning of the center of the segment i r[2,i] end of the center of the segment i r[3,i] end of the segment i
- with: i=0..
nrow(r)
- with: i=0..
- Usage 2
fft(x)
- x
- signal vector or matrix; if x is a matrix a spectrum of each column is computed
- Result 2
- A matrix y with ncol(x) columns and L+2 rows, where each column y[*,j] contains the complex spectrum of the column (channel) x[*,j]. The transformation length L is set to npow2(nrow(x)).
- Usage 3
fft(x, n {, ytype, poffset, prange, aref})
- x
- signal vector or matrix; if x is a matrix a spectrum of each column is computed
- n
- desired length of analysis window;
- If
n < nrow(x)
, the analysis window length L is set to nrow(x), otherwise L is set to n. - If the analysis window length L is a power of 2 (L=2^M), the fft algorithm is used, otherwise the dft is used.
- If L is greater than nrow(x), zero padding is applied to the signal.
- If
- ytype
- select the type and format of the computed spectrum (default=0) -> see Result 3
- poffset
- offset in samples to the signal begin or the selected zero phase position (default=0)
poffset=0 -> phase[i] = atan2(im[i], re[i])
otherwise -> phase[i] = (atan2(im[i], re[i]) - 2*pi*i/L * poffset) % (2 * pi)
- prange
- selects the range of phase values (default=0)
prange=0 -> 0 <= phase[i] < 2*pi
otherwise -> -pi <= phase[i] < pi
- aref
- reference amplitude if the log. spectrum (ytype=4) is requested (default=1)
- Result 3
- A matrix y with ncol(x) columns, where each column y[*,j] contains the spectrum of the column (channel) x[*,j]. The type and the length of the spectra is selected by the argument ytype.
ytype description content of y[*,j] nrow(y) 0 complex spectrum in cartesian format { re0, im0, re1, im1, ... }
L+2 1 complex spectrum in polar format { amp0, phase0, amp1, phase1, ... }
with: ampi=sqrt(rei2 + imi2),
phasei see poffsetL+2 2 amplitude spectrum { amp0, amp1, ... }
L+1 3 power spectrum { amp02, amp12, ... }
L+1 4 logarithmic amplitude spectrum { lev0, lev1, ... }
with: levi=20*log10(ampi/aref)L+1
Contents
aseg1
Automatically segment a signal. Apply automatic segmentation to the vector x.
Usage:
aseg1(x, xmin, omin, omax, nmin, navr)
Parameters:
- x
- A data vector (e.g. an rms function).
- xmin
- The pause threshold.
- omin
- The offset for segment detection. E.g. x
[i] >
xmin+
omin.
- omax
- The offset for the segment center detection. E.g. x
[i] > max("segment")-
omax.
- nmin
- The minimum segment duration in frames. A segment is assigned if the segment condition is true for at least nmin frames.
- navr
- The averaging length. If navr is greater than
0
then all elements x[i]
are replaced byavr(
x[i-
navr.. i+
navr])
.
Result:
A matrix (or vector) y
with 4 rows and one column for each detected segment. Note that all values of y
are frame indices.