1. Evaluate the segment expression segexpr, using the sampling rate and the length of the current soundfile (see LOAD SOUNDFILE).
SEGMENT segexpr [/S | /?]
- the segment expression to be evaluated
- silent error handling; generate warnings rather than errors.
2. Evaluate the segment expression segexpr, using the specified sampling rate and length.
SEGMENT segexpr sr l [/S | /?]
- sampling rate in Hz
- maximum signal duration in samples
3. Evaluate the segment expression segexpr, using the sampling rate and the segment definitions stored in the xml-file item xitem.
SEGMENT segexpr xmlfile srattr segtag idattr pattr lattr [/S | /?]
- a xml-file item containing the metadata; the selected element must contain soundfile metadata and the segment definitions must be stored as child elements
- the xml attribute of the selected element containing the sampling rate (in Hz)
- the xml element tag used for segment definitions
- idattr, pattr, lattr
- the xml attributes used in the segment definition elements to specifiy the segment id (idattr) and its starting position (pattr) and length (lattr)
bseg eseg lseg- the return value is the begin (bseg), end (eseg) and length (lseg) of the segment specified by the segment expression. The variable
RCis set to 0.
- error: the command returns the empty string and the error- or warning-code is stored in variable
- The segment expression segexpr specifies a position in a signal or the begin and end of a part of a signal.
a position (label) at bexpr
a segment with begin bexpr and end expr
a segment with begin bexpr and length lexpr (end = bexpr+lexpr)
a segment with end eexpr and length lexpr (begin = eexpr-lexpr)
- Each part (bexpr, eexpr and lexpr) of the segment expression specifies a time in samples and may consist of one or more time values which are joined with the operator + (add) or - (subtract).
value description value in samples comment x x samples x xs x seconds x * sr xms x milliseconds x / 1000 * sr xHz periode of a signal with x Hz sr / x xkHz periode of a signal with x kHz sr / (x * 1000) x% x percent of the signal length l * x / 100 usage 1 and 2 only x%% x per mill of the signal length l * x / 1000 usage 1 and 2 only segid:b begin of the segment with id segid usage 3 only segid:e end of the segment with id segid usage 3 only segid:l length of the segment with id segid usage 3 only
STx uses a special syntax to address a segment of a sound file. The syntax allows for the mixed use of segment names and time values in a complex expression known as a "segment expression". Segment expressions can be used in all commands and dialogs where a signal segment (or position/duration) can be specified (exceptions are described in the Command Reference). In dialogs, the supported value formats/types are always described in the control/dialog caption.
A label expression is a position in a sound file (e.g. the begin/end of a segment) or the duration of a segment. A label expression may consist of a sign (+/-) and one or more values formatted as described below and combined with the operators + (add) or – (subtract). If a label expression contains blanks, it must be quoted when used as an argument.
|segmentname:B||start time of segment segmentname|
|segmentname:E||end time of segment segmentname|
|segmentname:L||duration (length) of segment segmentname|
|numberS||time in seconds|
|numberMS||time in milliseconds|
|number||number of samples|
A segment expression addresses a part of a soundfile with a non-zero duration. It can consist of (1) a segment name or (2) two label expressions specifying the beginning and end or (3) two label expressions specifying a position and the duration.
|labelexpression_labelexpression||(beginning and end)|
|labelexpression_+labelexpression||(beginning and duration)|
|labelexpression_-labelexpression||(end and duration)|
addresses 0 samples to 4 seconds
addresses 100 samples after the beginning of SegmentB for a duration of 10 seconds
addresses the beginning of SegmentA to the end of SegmentB
addresses 100 milliseconds before the end of SegmentB to the end of SegmentB
Notes: For some expressions, the values
number% (percentage of the full duration) and
number%% (thousandths of the full duration) can be used, but only if the 'full signal' is available/defined (e.g. for envelopes of sequence signals).A
segmentname can only be used if a sound file or an audio-element of an XML-file is involved in the expression evaluation.Segment names are case sensitive!
- See also