#define BUFFER_LEN 8192
#define AMPLITUDE_NORM 0.2511886431509580 /* -12dBFS */
#define AMPLITUDE_MIN 0.00001
+#define DBFSTOAMP(x) pow(10,(x)/20.0)
/** Compute the mean of a set of doubles skipping unset values flagged as -1
*/
if ( use_peak )
normalised_gain = ST_SSIZE_MIN / -peak;
else
- normalised_gain = AMPLITUDE_NORM / rms;
+ {
+ double gain = DBFSTOAMP(-12); // default -12 dBFS
+ char *p = mlt_properties_get( filter_properties, "analysis_level" );
+ if (p)
+ {
+ gain = mlt_properties_get_double( filter_properties, "analysis_level" );
+ if ( strstr( p, "dB" ) )
+ gain = DBFSTOAMP( gain );
+ }
+ normalised_gain = gain / rms;
+ }
// Set properties for serialization
snprintf( effect, sizeof(effect), "vol %f", normalised_gain );
- Some effects have a temporal side-effect that do not work well.
parameters:
- - identifier: argument
+ - identifier: effect
+ argument: yes
title: Effect name and options
type: string
format: effect [options]
The results are put into the level, peak, and gain properties as well
as this effect property as the parameter to the vol effect.
+ - identifier: analysis_level
+ title: Normalization level
+ type: string
+ default: -12dBFS
+ description: >
+ Normalize the volume to the specified amplitude.
+ The normalization may be indicated as a floating point value of the
+ relative volume with 1.0 being maximum.
+ The normalization may also be indicated as a numeric value with the
+ suffix "dB" to set the amplitude in decibels.
+
- identifier: level
title: Signal power level (RMS)
type: float