|
HART
0.2.0
High level Audio Regression and Testing
|
Checks whether the audio true-peaks below specific level. More...
#include <hart_true_peaks_below.hpp>
Public Types | |
| enum | FilterQuality { low = 12 , medium = 24 , high = 96 } |
| Number of taps of the internal poly-phase IIR filter. More... | |
| enum class | Strictness { relaxed , strict } |
| Strictness to when it comes to decision on whether the signal is below a specific dB TP target. More... | |
Public Member Functions | |
| TruePeaksBelow (double thresholdDbTP, Oversampling oversamplingRatio=Oversampling::x4, FilterQuality filterQuality=FilterQuality::low, Strictness strictness=Strictness::relaxed, double numericToleranceLinear=1e-3) | |
| Creates a matcher for a specific true peak level. | |
| void | prepare (double sampleRateHz, size_t, size_t numOutputChannels, size_t) override |
| Prepare for processing It is guaranteed that all subsequent process() calls will be in line with the arguments received in this callback. This callback is guaranteed to be called after canOperatePerBlock() If any of the values supplied by this callback are not supported by the matcher, it is expected to act as if the match has failed when match() gets called. | |
| void | reset () override |
| Resets the matcher to its initial state. | |
| bool | match (AnalysisContext< SampleType > context) override |
| Tells the host if the piece of audio satisfies Matcher's condition or not. | |
| bool | canOperatePerBlock () const override |
| Tells the host if it can operate on a block-by-block basis. | |
| MatcherFailureDetails | getFailureDetails () const override |
| Returns a description of why the match has failed. | |
| void | represent (std::ostream &stream) const override |
| Makes a text representation of this Matcher for test failure outputs. | |
Public Member Functions inherited from Matcher< SampleType, TruePeaksBelow< SampleType > > | |
| virtual std::unique_ptr< MatcherBase< SampleType > > | copy () const override |
| Returns a smart pointer with a copy of this object. | |
| virtual std::unique_ptr< MatcherBase< SampleType > > | move () override |
| Returns a smart pointer with a moved instance of this object. | |
| TruePeaksBelow< SampleType > & | atChannels (std::initializer_list< size_t > channelsToMatch) & |
| Makes this matcher check only specific channels, and ignore the rest. | |
| TruePeaksBelow< SampleType > && | atChannels (std::initializer_list< size_t > channelsToMatch) && |
| Makes this matcher check only specific channels, and ignore the rest. | |
| TruePeaksBelow< SampleType > & | atChannel (size_t channelToMatch) & |
| Makes this matcher check only one specific channel, and ignore the rest. | |
| TruePeaksBelow< SampleType > && | atChannel (size_t channelToMatch) && |
| Makes this matcher check only one specific channel, and ignore the rest. | |
| TruePeaksBelow< SampleType > & | atAllChannels () & |
| Makes this matcher check all channels. | |
| TruePeaksBelow< SampleType > && | atAllChannels () && |
| Makes this matcher check all channels. | |
| TruePeaksBelow< SampleType > & | atAllChannelsExcept (std::initializer_list< size_t > channelsToSkip) & |
| Makes this matcher check only specific channels, and ignore the rest. | |
| TruePeaksBelow< SampleType > && | atAllChannelsExcept (std::initializer_list< size_t > channelsToSkip) && |
| Makes this matcher check only specific channels, and ignore the rest. | |
Public Member Functions inherited from MatcherBase< SampleType > | |
| virtual | ~MatcherBase ()=default |
| HART_DEPRECATED ("This method is deprecated. Switch to the one that uses AnalysisContext instead.") virtual bool match(const AudioBuffer< SampleType > &inputAudio | |
| Tells the host if the piece of audio satisfies Matcher's condition or not. | |
| return | match (analysisContext) |
| virtual bool | supportsChannelLayout (size_t, size_t) const |
| Tells the host whether this Matcher is capable of operating on audio with a specific number of channels. | |
| virtual bool | supportsSampleRate (double) const |
| Tells whether this Matcher supports given sample rate. | |
| void | prepareWithActiveChannels (double sampleRateHz, size_t numInputChannels, size_t numOutputChannels, size_t maxBlockSizeFrames) |
| Prepare for processing, meant to be called by a host. | |
| void | representWithActiveChannels (std::ostream &stream) const |
| Makes a text representation of this Matcher with optional "atChannels" appendix. | |
Friends | |
| std::ostream & | operator<< (std::ostream &os, Strictness strictness) |
| std::ostream & | operator<< (std::ostream &os, FilterQuality filterQuality) |
Additional Inherited Members | |
Public Attributes inherited from MatcherBase< SampleType > | |
| const AudioBuffer< SampleType > & | observedOutputAudio |
Protected Member Functions inherited from MatcherBase< SampleType > | |
| bool | appliesToChannel (size_t channel) |
| Indicates whether this matcher should check a specific channel. | |
| ChannelFlags | getChannelFlags () const |
| Returns flags for the channels that the matcher should apply to. | |
Protected Attributes inherited from MatcherBase< SampleType > | |
| ChannelFlags | m_channelsToMatch {true} |
Related Symbols inherited from Matcher< SampleType, TruePeaksBelow< SampleType > > | |
| std::ostream & | operator<< (std::ostream &stream, const MatcherBase< SampleType > &matcher) |
| Prints readable text representation of the Matcher object into the I/O stream. | |
Checks whether the audio true-peaks below specific level.
It checks inter-sample peaks by observing oversampled signal, following ITU-R BS.1770-5 guidelines. Some of the implementation choices are exposed by ctor, such as oversampling factor and number of taps in the internal poly-phase IIR filter, as the standard does not specify the exact values. Also, you may pick whether to leave enough headroom due to potential measuring under-shoot via setting Strictness option.
For more versatile expressions, you may also check truePeak() metric.
Definition at line 30 of file hart_true_peaks_below.hpp.
| enum FilterQuality |
Number of taps of the internal poly-phase IIR filter.
| Enumerator | |
|---|---|
| low | 12 taps |
| medium | 24 taps |
| high | 96 taps |
Definition at line 35 of file hart_true_peaks_below.hpp.
|
strong |
Strictness to when it comes to decision on whether the signal is below a specific dB TP target.
| Enumerator | |
|---|---|
| relaxed | Numeric tolerance only. |
| strict | Numeric tolerance + estimated under-read. |
Definition at line 43 of file hart_true_peaks_below.hpp.
|
inline |
Creates a matcher for a specific true peak level.
| thresholdDbTP | Expected true peak threshold in decibels true peak ("dB TP") |
| oversampling | Oversampling ratio, see Oversampling |
| filterQuality | Resolution of the internal IIR filters. "low" is in line with ITU-R BS.1770 measuring recommendations, "high" a bit closer to what mass-produced DACs implement (although still a rough approximate), "medium" is somewhere in between. |
| strictness | Whether to take estimated true peaks at face value, or also take potential under-read in consideration. Under-read estimation is calculated according to ITU-R BS.1770-5, Annex 2, Attachement 1 (See page 21 here). For "strict" setting, worst case will be assumed, and additional headroom equal to maximum under-shoot at $$f_norm = 0.45$$ will be required for the audio to pass this matcher's requirement. |
| numericToleranceLinear | Absolute tolerance for comparing frames, in linear domain (not decibels) |
Definition at line 62 of file hart_true_peaks_below.hpp.
|
inlineoverridevirtual |
Prepare for processing It is guaranteed that all subsequent process() calls will be in line with the arguments received in this callback. This callback is guaranteed to be called after canOperatePerBlock() If any of the values supplied by this callback are not supported by the matcher, it is expected to act as if the match has failed when match() gets called.
| sampleRateHz | sample rate at which the audio should be interpreted |
| numInputChannels | Number of channels in the input (reference) audio |
| numOutputChannels | Number of channels in the output (observed) audio |
| maxBlockSizeFrames | Maximum block size in frames (samples) |
Implements MatcherBase< SampleType >.
Definition at line 80 of file hart_true_peaks_below.hpp.
|
inlineoverridevirtual |
Resets the matcher to its initial state.
Reimplemented from MatcherBase< SampleType >.
Definition at line 90 of file hart_true_peaks_below.hpp.
|
inlineoverridevirtual |
Tells the host if the piece of audio satisfies Matcher's condition or not.
It is guaranteed to be called only after prepare(), or not be called at all. It is guaranteed to be handed a pair of AudioBuffers in line with values set by the last prepare() call. If canOperatePerBlock() has returned false, this callback is guaranteed to be handed a full piece of audio to check. Otherwise, it may still get a full piece of audio, or get data on a block-by-block basis.
| analysisContext | Carries everything matcher should know about the input and output audio. |
true if the audio satisfies the Matcher's condition, false otherwise Reimplemented from MatcherBase< SampleType >.
Definition at line 96 of file hart_true_peaks_below.hpp.
|
inlineoverridevirtual |
Tells the host if it can operate on a block-by-block basis.
Some types of conditions absolutely require having a full piece of audio to produce an appropriate response. For example, hart::PeaksAt matcher. Those types of matchers will return false on this callback. Matcher is guaranteed to receive a full piece of audio if this callback has returned false. Otherwise, it may receive audio either block-by-block basis, or still get a full piece of audio, if the host decides to do so.
Implements MatcherBase< SampleType >.
Definition at line 121 of file hart_true_peaks_below.hpp.
|
inlineoverridevirtual |
Returns a description of why the match has failed.
It is guaranteed to be called strictly after calling match(), or not called at all
| MatcherFailureDetails::frame | Index of frame at which the match has failed |
| MatcherFailureDetails::channel | Index of channel at which the failure was detected |
| MatcherFailureDetails::description | Readable description of why the match has failed. Do not include the value of observed frame value or its timing in the description, as well as any of values printed by represent(), as all of this will be added to the output anyway. Also, query hart::CLIConfig for number of displayed decimal places, whenever applicable. |
Implements MatcherBase< SampleType >.
Definition at line 128 of file hart_true_peaks_below.hpp.
|
inlineoverridevirtual |
Makes a text representation of this Matcher for test failure outputs.
It is strongly encouraged to follow python's repr() conventions for returned text - basically, put something like "MyClass(value1, value2)" (with no quotes) into the stream whenever possible, or "<Readable info in angled brackets>" otherwise. Also, use built-in stream manipulators like hart::dbPrecision wherever applicable. Use HART_DEFINE_GENERIC_REPRESENT() to get a basic implementation for this method.
| [out] | stream | Output stream to write to |
Implements MatcherBase< SampleType >.
Definition at line 156 of file hart_true_peaks_below.hpp.
|
friend |
Definition at line 166 of file hart_true_peaks_below.hpp.
|
friend |
Definition at line 171 of file hart_true_peaks_below.hpp.