audioman.effect package

Submodules

audioman.effect.adjustable_fade module

class audioman.effect.adjustable_fade.AdjustableFade(length: int | None = None, duration: float | None = None, sample_rate: int | None = None, options: dict = {}, **kwargs)[source]

Bases: Effect

OPTIONS: dict[str, dict[Literal['default', 'type'], Any]] = {'curve_ratio': {'default': 0, 'type': <class 'float'>}, 'gain0': {'default': 1, 'type': <class 'float'>}, 'gain1': {'default': 0, 'type': <class 'float'>}}
__init__(length: int | None = None, duration: float | None = None, sample_rate: int | None = None, options: dict = {}, **kwargs) None[source]

Audio effect. This effect will last the specified length in samples. If the duration is specified (in seconds), then it will use that length. This will assume the sample rate is 4400, unless specified.

Parameters:
  • length (int, optional) – Length of effect in samples. Defaults to None.

  • duration (float, optional) – Duration of effect in seconds. Defaults to None.

  • sample_rate (int, optional) – Audio Sample rate. Defaults to 4400. This may be used by some effects.

  • **options

    Effect options.

Options: gain0 (float): Start gain. Value between 0 and 1. Defaults to 1. gain1 (float): End gain. Value between 0 and 1. Defaults to 0. curve_ratio (float): Curve adjust ratio. Value between -1 and 1. Defaults to 0.

cos_curve(gain0: float, gain1: float, power: float, length: int) ndarray[float][source]
cosine_curve(gain0: float, gain1: float, length: int) ndarray[float][source]

Creates half a cosine wave of the specified length

Parameters:
  • gain0 (float) – gain0

  • gain1 (float) – gain1

  • length (int) – length

Returns:

numpy array

Return type:

numpy.ndarray

curve_adjust(gain0: float, gain1: float, power: float, env: ndarray[float]) ndarray[float][source]
get() ndarray[source]

Get the effect scaler array.

Returns:

1-d numpy array with values between 0 and 1.

Return type:

numpy.ndarray

linear(gain0: float, gain1: float, length: int) ndarray[float][source]
linear_fade(gain0: float, gain1: float, curve_ratio: float, length: int) ndarray[float][source]

Generate fade scaler for the specified length.

Parameters:
  • gain0 (float) – Start gain

  • gain1 (float) – End gain

  • curve_ratio (float) – Mid-fade adjust (%) between 0 and 1

  • length (int) – Sample length of the fade (not sample rate).

Returns:

numpy array

Return type:

numpy.ndarray[float]

scale_curve(gain0: float, gain1: float, env: ndarray[float]) ndarray[float][source]
simple_curve(gain0: float, gain1: float, power: float, length: int) ndarray[float][source]

audioman.effect.effect module

class audioman.effect.effect.Effect(length: int | None = None, duration: float | None = None, sample_rate: int | None = None, options: dict = {}, **kwargs)[source]

Bases: object

OPTIONS: dict[str, dict[Literal['default', 'type'], Any]] = {}
__init__(length: int | None = None, duration: float | None = None, sample_rate: int | None = None, options: dict = {}, **kwargs) None[source]

Audio effect. This effect will last the specified length in samples. If the duration is specified (in seconds), then it will use that length. This will assume the sample rate is 4400, unless specified.

Parameters:
  • length (int, optional) – Length of effect in samples. Defaults to None.

  • duration (float, optional) – Duration of effect in seconds. Defaults to None.

  • sample_rate (int, optional) – Audio Sample rate. Defaults to 4400. This may be used by some effects.

  • **options

    Effect options. Not all effects have the same options. Available options can be found in the OPTIONS property.

get() ndarray[source]

Get the effect scaler array.

Returns:

1-d numpy array with values between 0 and 1.

Return type:

numpy.ndarray

Module contents