EqualizerBand


public final class EqualizerBand
extends Object implements Parcelable

java.lang.Object
   ↳ android.media.quality.EqualizerBand


Represents a single band in an equalizer.

An equalizer is composed of multiple bands, each targeting a specific frequency range in the audio spectrum. This parcelable defines the properties of one such band.

Summary

Inherited constants

Fields

public static final Creator<EqualizerBand> CREATOR

Public constructors

EqualizerBand(int frequencyHz, int gainDb, float qFactor)

Constructs an EqualizerBand.

Public methods

int describeContents()

Describe the kinds of special objects contained in this Parcelable instance's marshaled representation.

int getFrequencyHz()

Gets the center frequency of the band in Hertz.

int getGainDb()

Gets the gain for the band in decibels (dB).

float getQFactor()

Gets the Quality Factor (Q).

void writeToParcel(Parcel dest, int flags)

Flatten this object in to a Parcel.

Inherited methods

Fields

CREATOR

Added in API level 37
public static final Creator<EqualizerBand> CREATOR

Public constructors

EqualizerBand

Added in API level 37
public EqualizerBand (int frequencyHz, 
                int gainDb, 
                float qFactor)

Constructs an EqualizerBand.

Parameters
frequencyHz int: The center frequency of this band in Hertz (Hz).
Value is 1 or greater

gainDb int: The gain (level) for this band in decibels (dB).

qFactor float: The Quality Factor (Q).
Value is 0.0f or greater

Throws
IllegalArgumentException if any parameter is out of its supported range.

Public methods

describeContents

Added in API level 37
public int describeContents ()

Describe the kinds of special objects contained in this Parcelable instance's marshaled representation. For example, if the object will include a file descriptor in the output of writeToParcel(Parcel,int), the return value of this method must include the CONTENTS_FILE_DESCRIPTOR bit.

Returns
int a bitmask indicating the set of special object types marshaled by this Parcelable object instance.
Value is either 0 or

getFrequencyHz

Added in API level 37
public int getFrequencyHz ()

Gets the center frequency of the band in Hertz.

Returns
int Value is 1 or greater

getGainDb

Added in API level 37
public int getGainDb ()

Gets the gain for the band in decibels (dB). The range is determined by hardware capabilities. (e.g., -50 to 50 or -100 to 100)

Negative means the signal in this frequency band is reduced, so the output is quieter than the input. (This is used to remove unwanted frequencies like "mud" or "hiss")

Positive means the signal in this frequency band is amplified, so the output is louder than the input.

0 means the signal is unchanged and this is the default state of an equalizer.

Returns
int

getQFactor

Added in API level 37
public float getQFactor ()

Gets the Quality Factor (Q).

The Q factor controls the bandwidth (width) of the frequency range affected by this filter It is inversely proportional to bandwidth:

  • High Q (e.g., > 2.0): Creates a narrow, sharp curve. Used for precise adjustments (e.g., removing a specific resonant frequency).
  • Low Q (e.g., < 0.7): Creates a wide, broad curve. Used for general tonal shaping (e.g., "boosting the bass").

Returns
float Value is 0.0f or greater

writeToParcel

Added in API level 37
public void writeToParcel (Parcel dest, 
                int flags)

Flatten this object in to a Parcel.

Parameters
dest Parcel: This value cannot be null.

flags int: Additional flags about how the object should be written. May be 0 or Parcelable.PARCELABLE_WRITE_RETURN_VALUE.
Value is either 0 or a combination of the following: