Programmer Guide/Command Reference/EVAL/aseg1: Difference between revisions

From STX Wiki
Jump to navigationJump to search
No edit summary
No edit summary
 
(6 intermediate revisions by 3 users not shown)
Line 5: Line 5:
:;<var>x</var>: data vector (usally rms track in dB)
:;<var>x</var>: data vector (usally rms track in dB)
:;<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 &le; 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]); with: i=0..nrow(''x'')</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
Line 23: Line 23:
|}
|}
::with: i=0..<code>nrow(''r'')</code>
::with: i=0..<code>nrow(''r'')</code>
----
----
;Usage 2:<code>fft(<var>x</var>)</code>
;Usage 2:<code>aseg1(<var>x</var>, 1, <var>n</var>, <var>m</var>, <var>xmax</var>, <var>xmin</var>)</code>
:;<var>x</var>: signal vector or matrix; if ''x'' is a matrix a spectrum of each column is computed
:;<var>x</var>: data vector (usally rms track in dB)
;Result 2:A matrix ''y'' with [[../ncol|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|npow2(nrow(''x''))]].
:;<var>n</var>: minimum length of a signal segment in frames; 0 < n < <code>nrow(''x'')</code>
----
:;<var>m</var>: smoothing length; 0 &le; m</code>; if ''m'' is greater than zero, the segmentation is performed on a smoothed data vector ''xs''.
;Usage 3:<code>fft(<var>x</var>, <var>n</var> {, <var>ytype</var>, <var>poffset</var>, <var>prange</var>, <var>aref</var>})</code>
:::<code>''xs''[i] = avr(''x''[i-m], .., ''x''[i+m]); with: i=0..nrow(''x'')</code>
:;<var>x</var>: signal vector or matrix; if ''x'' is a matrix a spectrum of each column is computed
:;<var>xmax</var>: maximum threshold; the maximum value of a segment must be greater than ''xmax''
:;<var>n</var>: desired length of analysis window;
:;<var>xmin</var>: minimum threshold; all values of a segment must be greater than ''xmin''
::*If <code>''n'' < nrow(''x'')</code>, the analysis window length L is set to nrow(''x''), otherwise L is set to ''n''.
;Description: segment detection:
::*If the analysis window length L is a power of 2 (L=2^M), the '''fft''' algorithm is used, otherwise the '''dft''' is used.
:#find a position ''i'' with ''x''[i]>''xmax''
::*If L is greater than [[../nrow|nrow(''x'')]], zero padding is applied to the signal.
:#go backward while ''x''[i-j]>''xmin; last index i-j is the segment begin
:;<var>ytype</var>: select the type and format of the computed spectrum (default=0) -> see '''Result 3'''
:#go forward while ''x''[i+k]>''xmin; last index i+k is the segment end
:;<var>poffset</var>: offset in samples to the signal begin or the selected ''zero phase'' position (default=0)
;Result 2: A matrix ''r'' with 2 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''.
:::{|class="keinrahmen"
|''poffset''='''0''' ||-> <code>phase[i] = atan2(im[i], re[i])</code>
|-
|otherwise ||-> <code>phase[i] = (atan2(im[i], re[i]) - 2*pi*i/L * ''poffset'') % (2 * pi)</code>
|}
:;<var>prange</var>: selects the range of phase values (default=0)
:::{|class="keinrahmen"
|''prange''='''0''' ||-> <code>0 <= phase[i] < 2*pi</code>
|-
|otherwise ||-> <code>-pi <= phase[i] < pi</code>
|}
:;<var>aref</var>: reference amplitude if the log. spectrum (''ytype''=4) is requested (default=1)
;Result 3: A matrix ''y'' with [[../ncol|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''.
::{|class="einrahmen"
::{|class="einrahmen"
!''ytype'' !! description !! content of ''y''[*,j] !! nrow(''y'')
|''r''[0,i] || beginning of the segment i
|-
|-
|'''0'''
|''r''[1,i] || end of the segment i
|complex spectrum in cartesian format
|<code>{ re<sub>0</sub>, im<sub>0</sub>, re<sub>1</sub>, im<sub>1</sub>, ... }</code>
|L+2
|-
|'''1'''
|complex spectrum in polar format
|<code>{ amp<sub>0</sub>, phase<sub>0</sub>, amp<sub>1</sub>, phase<sub>1</sub>, ... }<BR>with: amp<sub>i</sub>=sqrt(re<sub>i</sub><sup>2</sup> + im<sub>i</sub><sup>2</sup>),<BR>phase<sub>i</sub> see ''poffset''</code>
|L+2
|-
|'''2'''
|amplitude spectrum
|<code>{ amp<sub>0</sub>, amp<sub>1</sub>, ... }</code>
|L+1
|-
|'''3'''
|power spectrum
|<code>{ amp<sub>0</sub><sup>2</sup>, amp<sub>1</sub><sup>2</sup>, ... }</code>
| L+1
|-
|'''4'''
|logarithmic amplitude spectrum
|<code>{ lev<sub>0</sub>, lev<sub>1</sub>, ... }<BR>with: lev<sub>i</sub>=20*log<sub>10</sub>(amp<sub>i</sub>/''aref'')</code>
| L+1
|}
|}
::with: i=0..<code>nrow(''r'')</code>
----
----
;See also: [[Programmer_Guide/Command_Reference/EVAL/ifft|ifft]], [[Programmer_Guide/Command_Reference/EVAL/dft|dft]], [[Programmer_Guide/Command_Reference/EVAL/dct|dct]], [[Programmer_Guide/Command_Reference/EVAL/cepstrum|cepstrum]], [[Programmer_Guide/Command_Reference/EVAL/lpc|lpc]], [[Programmer_Guide/Command_Reference/EVAL/complex arithmetic|complex arithmetic]]
[[Programmer_Guide/Command_Reference/EVAL#Functions|<function list>]]
=====aseg1=====
Automatically segment a signal. Apply automatic segmentation to the vector <var>x</var>.
=====Usage:=====
<code>aseg1(<var>x</var>, <var>xmin</var>, <var>omin</var>, <var>omax</var>, <var>nmin</var>, <var>navr</var>)</code>
=====Parameters:=====
;<var>x</var>
:A data vector (e.g. an rms function).
;<var>xmin</var>
:The pause threshold.
;<var>omin</var>
:The offset for segment detection. E.g. <var>x</var><code>[i] ></code> <var>xmin</var><code>+</code><var>omin</var>.
;<var>omax</var>
:The offset for the segment center detection. E.g. <var>x</var><code>[i] > max("segment")-</code><var>omax</var>.
;<var>nmin</var>
:The minimum segment duration in frames. A segment is assigned if the segment condition is true for at least <var>nmin</var> frames.
;<var>navr</var>
:The averaging length. If <var>navr</var> is greater than <code>0</code> then all elements <var>x</var><code>[i]</code> are replaced by <code>avr(</code><var>x</var><code>[i-</code><var>navr</var> <code>.. i+</code><var>navr</var><code>])</code>.
=====Result:=====


A matrix (or vector) <code>y</code> with 4 rows and one column for each detected segment. Note that all values of <code>y</code> are frame indices.
[[../#Functions|<function list>]]

Latest revision as of 09:05, 6 June 2013

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
  1. A segment is a continuous range of x, where all values are greater than xmin
  2. 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)

Usage 2
aseg1(x, 1, n, m, xmax, xmin)
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)
xmax
maximum threshold; the maximum value of a segment must be greater than xmax
xmin
minimum threshold; all values of a segment must be greater than xmin
Description
segment detection:
  1. find a position i with x[i]>xmax
  2. go backward while x[i-j]>xmin; last index i-j is the segment begin
  3. go forward while x[i+k]>xmin; last index i+k is the segment end
Result 2
A matrix r with 2 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] end of the segment i
with: i=0..nrow(r)

<function list>

Navigation menu

Personal tools