The AmplitudeAnalyzer measures (or "tracks") the amplitude of its input
in 128-sample windows.
It sends this measurement directly to a VSS client, or via a
message group other actors.
To use the AmplitudeAnalyzer implementation, load amplAnalyzer.so
and create an actor of type AmplitudeAnalyzer.
To send amplitude measurements directly to a client, the client should
send the message "Analyze" to the AmplitudeAnalyzer (typically from a
.aud file via AUDupdate), and then immediately call actorGetReplyData()
which returns a const char * string. This string can be parsed with
sscanf(..., "%f", ...) or atof() to get the floating-point measurement value.
Analyses will occur once for every "Analyze" message received (unless
a measurement is already in progress).
To send amplitude measurements to another actor,
send a SetMessageGroup message and then
send the SetRate message with a nonzero argument indicating how many times
per second the message group should be called.
The message group will then be called that often, with an argument array
consisting of one element, the measurement value.
In addition to the messages understood by all Generator actors,
the AmplitudeAnalyzer understands the following messages:
- SetRate hActor rate
- Set rate for subsequent analyses (default is zero).
AmplitudeAnalyzer handler messages
In addition to the messages understood by all handlers, the handler for the
AmplitudeAnalyzer algorithm understands the following messages. If the optional
parameter time is specified in any of the following messages,
then the corresponding parameter is linearly modulated from the old value
to the specified value over the duration of time seconds after receipt
of the command.
- SetMessageGroup hActor name
- Specify which message group the analyses are to be regularly sent to.
The format of the analysis is an array with a single element, which
is the maximum amplitude measured in the most recent window of 128 samples
- SetRate hActor rate
- Set the rate in Hz at which the message group should be called with
a new analysis result. Defaults to zero, which means that the message
group is not called at all.
- Analyze hActor
- Measure amplitude right now. The VSS client application should
immediately call actorGetReplyData() after this message is sent,
to get the result of the analysis.