Automatic Gain Control in Python?
Richard Damon
Richard at Damon-Family.org
Sat May 28 18:53:13 EDT 2022
On 5/28/22 5:29 PM, Steve GS wrote:
> I have an extensive Excel/VBA program that hourly calls and plays podcasts
> through a "smart" speaker. The output of the speaker feeds into another
> computer that records the m\audio using Audacity.
>
> It has become obvious that NPR does not regulate volumes for podcasts and
> broadcasts nor are programs in themselves regulated by volume. Audacity
> does not have an AGC.
>
> It has also been noted that Excel/VBA code cannot see the audio being played
> on the same computer.
>
> I would like to find code that will regulate the volume and give some
> semblance of control/moderation. Also, sometimes the Smart Speaker fails to
> play the program and I get an hour of silence before the next command to
> play happens. The code should detect that nothing is playing and send the
> command to the smart speaker again.
>
> Is there any Python code that I might be able to call from VBA that will
> monitor and regulate the volume of the audio? A few samples of code that can
> read/modify the audio will help me develop the final product.
>
> Suggestions appreciated.
My first thought is you are solving the wrong problem. What seems a better option would be to get your code to actually connect up to the podcast and just download the audio directly, rather than trying to get the smart speaker to play the audio and record it with a microphone. That might require finding the API for the site that hosts the podcasts, to get it to send the files to you to "play".
Once you have the files, it becomes simple signal processing to go over the files and AGCing them as needed.
On a side note, make sure you are within your rights within Copyright law for what you are doing. Recording for PERSONAL use is probably within the bounds of "Fair Use", but the material is surely under Copyright, so be careful what you do with it.
--
Richard Damon
More information about the Python-list
mailing list