BeatLib


AudioEffect QML Type

Analyzes and/or modifies MP3Decoder output. More...

Import Statement: import
Inherited By:

BeatDetector, DirectForm2Filter, MultiEffect, PeakFinder, and SpectrumDetector

Properties

Methods

Detailed Description

An AudioEffect can be used with MP3Decoder::effect to analyze and/or modify its decoded audio signal.

AudioEffect itself is an abstract type. You can use one of the existing concrete types, or subclass AudioEffect yourself and override the processSample() method.

Existing types include:

Property Documentation

enabled : bool

Determines if the effect is enabled.

If this property is set to false, MP3Decoder and MultiEffect will ignore this effect.


startTime : int

A time interval in milliseconds since 1970/01/01 when the filtering started.

Implementations can use this to calculate the actual time when a specific sample in the audio signal will be played back.

You can bind this variable in QML to MP3Decoder::startTime.


Method Documentation

bool processSample(var channels, int sampleIndex, real maxValue, real minValue)

Process one sample of the MP3Decoder's audio signal. The parameter channels contains one real sample value for each channel of the audio signal. This means it is an array with 1 entry for mono signals and 2 entries for stereo signals.

This method should be overridden in custom AudioEffect implementations. The values in channels can be modified. However the data is only written back to the original signal if this method returns true. Even if you did not modifiy the data, return false to indicate this, for improved performance.

The parameter sampleIndex indicates this sample's index, from the start of the audio signal. The parameters minValue and maxValue indicate the sample's range. These are often but not necessarily -1.0 and 1.0, respectively.

Note: This method is not callable from QML, it is only called internal from MP3Decoder.


void resetState()

Reset the audio effect algorithm's state and memory. Call this to treat the rest of the MP3Decoder's audio signal like a completely new audio signal.

Implementations of this class may override this method to clear any temporary algorithm state.