Pyagc
Python implementation for audio time-frequency automatic gain control
Install / Use
/learn @jorgehatccrma/PyagcREADME
Automatic Gain Control
Automatic Gain Control (AGC) for audio signals in python, based on Dan Ellis' Matlab code.
The code is based in the original Matlab implementation in the above link. It is almost exactly the same, with the exception of the STFT and ISTFT functions, which I implemented from scratch. A sample WAV file (obtained from the original Matlab source code) is provided for testing.
Dependencies
The code depends on NumPy / SciPy.
Example of usage
import scipy.io.wavfile
import numpy as np
from agc import tf_agc
# read audiofile
sr, d = scipy.io.wavfile.read('speech.wav')
# convert from int16 to float (-1,1) range
convert_16_bit = float(2 ** 15)
d = d / (convert_16_bit + 1.0)
# apply AGC
(y, D, E) = tf_agc(d, sr)
# convert back to int16 to save
y = np.int16(y / np.max(np.abs(y)) * convert_16_bit)
scipy.io.wavfile.write('speech_agc.wav', sr, y)
References
D. Ellis (2010), "Time-frequency automatic gain control", web resource, available: http://labrosa.ee.columbia.edu/matlab/tf_agc/
Related Skills
node-connect
343.3kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
frontend-design
92.1kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
openai-whisper-api
343.3kTranscribe audio via OpenAI Audio Transcriptions API (Whisper).
qqbot-media
343.3kQQBot 富媒体收发能力。使用 <qqmedia> 标签,系统根据文件扩展名自动识别类型(图片/语音/视频/文件)。
