Programmer Guide/Command Reference/SEGMENT: Difference between revisions

From STX Wiki
Jump to navigationJump to search
No edit summary
No edit summary
Line 1: Line 1:
{{DISPLAYTITLE:{{SUBPAGENAME}}}}
{{DISPLAYTITLE:{{SUBPAGENAME}}}}
Evaluate a segment expression.
#Evaluate the segment expression <var>segexpr</var>, using the sampling rate and the length of the current soundfile (see [[../LOAD|LOAD SOUNDFILE]]).
 
:<code>SEGMENT <var>segexpr</var> [/S | /?]</code>
;Usage 1:<code>SEGMENT <var>segexpr</var> [/S | /?]</code>
:;<var>segexpr</var>:the segment expression to be evaluated
:;<var>segexpr<var>:the segment expression to be evaluated
:;<code>/S</code>, <code>/?</code>:silent error handling; generate warnings rather than errors.
:;<code>/S</code>, <code>/?</code>:silent error handling; generate warnings rather than errors.
:This command evaluates the segment expression <var>segexpr</var>, using the sampling rate (''sr'' in Hz) and the length (''l'' in samples) of the current soundfile (see [[../LOAD|LOAD SOUNDFILE]]).
#Evaluate the segment expression <var>segexpr</var>, using the specified sampling rate and length.
 
:<code>SEGMENT <var>segexpr sr l</var> [/S | /?]</code>
;Usage 2:<code>SEGMENT <var>segexpr sr l</var> [/S | /?]</code>
:;<var>sr</var>:sampling rate in Hz
:;<var>sr</var>:sampling rate in Hz
:;<var>l</var>:maximum signal duration in samples
:;<var>l</var>:maximum signal duration in samples
:This command evaluates the segment expression <var>segexpr</var>, using the specified parameters <var>sr</var> and <var>l</var>.
#Evaluate the segment expression <var>segexpr</var>, using the sampling rate and the segment definitions stored in the [[Programmer_Guide/Shell_Items/File|xml-file item]].
 
:<code>SEGMENT <var>segexpr xmlfile srattr segtag idattr pattr lattr</var></code>
;Usage 3:<code>SEGMENT <var>segexpr xmlfile srattr segtag idattr pattr lattr</var></code>
:;<var>xmlfile</var>:a [[Programmer_Guide/Shell_Items/File|xml-file item]] containing the metadata; the selected element must contain soundfile metadata and the segment definitions must be stored as child elements
:;<var>xmlfile<var>:a [[Programmer_Guide/Shell_Items/File|xml-file item]] containing the metadata; the selected element must contain soundfile metadata and the segment definitions must be stored as child elements
:;<var>srattr</var>:the xml attribute of the selected element containing the sampling rate (in Hz)
:;<var>srattr</var>:the xml attribute of the selected element containing the sampling rate (in Hz)
:;<var>segtag</var>:the xml element tag used for segment definitions
:;<var>segtag</var>:the xml element tag used for segment definitions
:;<var>idattr, pattr, lattr</var>:the xml attributes used in the segment definition elements to specifiy the segment id (<var>idattr</var>) and its starting position (<var>pattr</var>) and length (<var>lattr</var>)
:;<var>idattr, pattr, lattr</var>:the xml attributes used in the segment definition elements to specifiy the segment id (<var>idattr</var>) and its starting position (<var>pattr</var>) and length (<var>lattr</var>)
:This command evaluates the segment expression <var>segexpr</var>, using the sampling rate and the segment definitions stored in the [[Programmer_Guide/Shell_Items/File|xml-file item]].





Revision as of 08:11, 27 April 2011

  1. Evaluate the segment expression segexpr, using the sampling rate and the length of the current soundfile (see LOAD SOUNDFILE).
SEGMENT segexpr [/S | /?]
segexpr
the segment expression to be evaluated
/S, /?
silent error handling; generate warnings rather than errors.
  1. Evaluate the segment expression segexpr, using the specified sampling rate and length.
SEGMENT segexpr sr l [/S | /?]
sr
sampling rate in Hz
l
maximum signal duration in samples
  1. Evaluate the segment expression segexpr, using the sampling rate and the segment definitions stored in the xml-file item.
SEGMENT segexpr xmlfile srattr segtag idattr pattr lattr
xmlfile
a xml-file item containing the metadata; the selected element must contain soundfile metadata and the segment definitions must be stored as child elements
srattr
the xml attribute of the selected element containing the sampling rate (in Hz)
segtag
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)


|use |-

segexpr
segment expression (see description)
Result 1
begin end length (evaluated expression in samples) or an empty string (on error)
Description 1
The expression is evaluated using the sampling rate and length of the current soundfile. If no soundfile is selected (see LOAD SOUNDFILE or the expression is ill-formed, the command fails.

SEGMENT

Convert a segment expression into it's equivalent in samples or extract a segment expression from a segment element in an XML file item. If an XML file is specified, then the currently selected audio set is searched for an element with the tag segTag and the id idAttr.

Usage:

var := SEGMENT segmentExpression [ samplingRate sampleCount ] [ /S ]

var := SEGMENT segmentExpression xmlFile srAttr segTag idAttr pAttr lAttr [ /S ]

Parameters:
segmentExpression
A valid segment expression. If samplingRate and sampleCount are specified, segmentExpression cannot contain segment names. See Specifying Signal Segments for details about valid segment expressions. Note that if this is the only argument, the parameters of the current soundfile are used for calculations.
samplingRate
The sampling rate to use for calculations. If this parameter is specified, it takes precedence over the sampling rate of the current soundfile.
sampleCount
The number of samples.
xmlFile
An XML file item id. The file's selected element must be an audio set. The status and context of the file are not changed by the SEGMENT command.
srAttr
The name of the sampling rate attribute in the currently selected audio set. E.g. 'SR' for an STx AFile element.
segTag
The XML tag containing the segment data in the currently selected audio set. E.g 'ASeg'.
idAttr
The id of the segment to evaluate.
pAttr
The name of the attribute containing the starting address in samples. E.g. 'P' in an ASeg element.
lAttr
The name of the attribute containing the length of the segment in samples. E.g. 'L' in an ASeg element.
/S
If specified, errors will generate warning messages rather than error messages. See The Silent Flag for details.
Result:

Returns a string in the following format:

'beginning end length'

All values are in samples.

Navigation menu

Personal tools