Process

Audio Equalisation Module using FFT, Hann windowing and Overlap-Add

This library is part of audiergon, built by Hamd Waseem (https://github.com/hamdivazim/Audiergon)

Available Methods:
  • generate_hann_window

  • apply_equaliser

  • process_audio

Dependencies:
  • wave, cmath, tempfile

  • audiergon.fast_fourier_transform

audiergon.process.apply_equaliser(transformed, frame_size, framerate, bass_gain, low_mid_gain, mid_gain, high_mid_gain, treble_gain)[source]

Applies equaliser gains on a Frequency Domain sound array.

Parameters:
  • transformed (list or numpy.ndarray) – The frequency-domain representation of the audio frame.

  • frame_size (int) – The total size/length of the frame (number of bins).

  • framerate (int or float) – The sampling rate of the audio in Hz.

  • bass_gain (float or int) – Gain multiplier for the bass band (0 - 249 Hz).

  • low_mid_gain (float or int) – Gain multiplier for the low-mid band (250 - 999 Hz).

  • mid_gain (float or int) – Gain multiplier for the mid band (1000 - 3999 Hz).

  • high_mid_gain (float or int) – Gain multiplier for the high-mid band (4000 - 7999 Hz).

  • treble_gain (float or int) – Gain multiplier for the treble band (8000 Hz and above).

Returns:

The modified frequency-domain array with gains applied.

Return type:

list or numpy.ndarray

audiergon.process.generate_hann_window(frame_size)[source]

Generates a Hann Window to smooth frame boundaries for a given frame size.

Parameters:

frame_size (int) – The size of each frame

Returns:

A list containing the Hann window

Return type:

list

audiergon.process.process_audio(audio_filepath, bass_gain, low_mid_gain, mid_gain, high_mid_gain, treble_gain, output=None)[source]

Processes a mono 16-bit PCM WAV audio file through an equaliser.

Parameters:
  • audio_filepath (str) – Path to the input WAV audio file.

  • bass_gain (float or int) – Gain multiplier for frequencies under 250 Hz.

  • low_mid_gain (float or int) – Gain multiplier for frequencies from 250 to 999 Hz.

  • mid_gain (float or int) – Gain multiplier for frequencies from 1000 to 3999 Hz.

  • high_mid_gain (float or int) – Gain multiplier for frequencies from 4000 to 7999 Hz.

  • treble_gain (float or int) – Gain multiplier for frequencies 8000 Hz and above.

  • output (str, optional) – Optional explicit output file path. If None, a temporary file is created.

Returns:

The file path where the processed WAV audio was saved.

Return type:

str

Raises:

ValueError – If the input file is not 16-bit mono PCM WAV format.