Automatic Gain Control in Python?
Richard Damon
Richard at Damon-Family.org
Sun May 29 08:02:33 EDT 2022
From your description, your fundamental problem is you are trying to
automatically "control" things that weren't designed to be automatically
controlled in the way you are attempting.
The smart speaker assumes the "user" will adjust the volume either with
the controls or with verbal commands, So things will be a bit "clunky"
in your results as you command the smart speaker volume level.
Yes, you have an automated system that does most of what you want, but
it is based on pieces not designed to be automated in this way, and you
are running into the limitations caused by that.
Yes, you could split the aux-out to bring it into another computer to
listen to the sound level, and then using a sound input package get
samples of what is playing, and analyze that data to get an average
volume, and then issues the command to adjust the volume level.
What you seem to be missing is that you could get the podcasts from a
browser, and all a browser is is a program. It isn't that much work to
write a rudimentary browser in python, especially if you don't actually
need to display the results to a user, but are only trying to automate a
particular task.
You seem to feel strongly invested in your current code base, which is
understandable, but it seems you have reached a point where you don't
want to live with the limitations CAUSED by that system. Yes, there is
likely a way to tack on another layer of "stuff" to adjust for this
issue, but it likely is going to require some real programming.
It may well be the design I am suggesting, of writing a program to fetch
the podcast and save it requires a bit more work to get to the level you
currently are at, but the results are a system that is actually designed
to be controlled by automation. Maybe it is beyond you ability, but then
so might the programming to get the volume.
I will also add, that the way your describe going to your "community"
gives me questions if this is a violation of copyright. Maybe it is
something you can "Get away with", but I am not sure what you are doing
is actually legitimate.
On 5/29/22 1:09 AM, Steve GS wrote:
> You really need to understand what I am trying to do.
> It is not a simple lesson in use of podcasts.
> This is an automated system. I call it my NPR Jukebox.
>
> 15 years ago, I started with hourly URL calls to a browser to record specific NPR programs. It took a lot of coordination. I had to use IE because I needed to start and stop browsers on the hour and IE was the only one that could do that. Then web sites started "upgrading" to Edge. Through some trickery I was able to get Edge to do what IE did but it was unstable.
>
> I then discovered the Echo Smart Speaker. I set my program to announce the broadcast station or podcast by speaker to the smart speaker and it cured a lot of headaches. I then was able to call podcasts because the Echo handles them through TuneIn. Unfortunately, not all broadcasts ae available as podcasts.
>
> I am not here diddling around just playing podcasts. Let me repeat what I have already said. It is an automated system. Every hour for 48 hours on every weekend, my system using a well-developed Excel/VBA program that vocally talks to the SS hourly. The SS finds the audio and sends it to my Audacity recorder on another computer through aux-out to mic-in cable. The selections of audio are also transmitted to the community at the time of recording
>
> That part of the system is almost flawless, well compared to that I had before. Although the quality, tone, and timing of the announcement, the SS still gets confused once in a while and goes silent for the hour. I need to detect this too.
>
> Ok, now back to the original question.
>
> Podcasts and broadcasts apparently do not use the Dolby tone to balance the audio levels. And I receive highly fluctuating levels of audio. Sometimes it is between sides of a conversation, sometimes it is the podcast vs station identifications, then it is great differences between one web site and another. Then there's the differences with male and female voices. Imagine that you are watching TV late night then the commercials COME IN AT FULL BLAST.
>
> The technology of the industry grew up with male voices and apparently sees no reason to adjust for female. I have worked with audio systems and making recordings for more years that I want to admit.
>
> All I want is software to detect level changes over time and attempt to equalize them.
> It has to be work between the SS and the recorder and is to be checking all the time.
>
> The code is to: Listen to the audio level for about 10 seconds or so and raise or lower the level in small increments.
> It has nothing to do with understanding how to grab podcasts. The system is working very well for that.
>
>
> Footnote:
> “What rhymes with orange?”
> “No, it doesn’t..”
>
>
>
> -----Original Message-----
> From: Richard Damon <richard.damon at gmail.com> On Behalf Of Richard Damon
> Sent: Saturday, May 28, 2022 11:37 PM
> To: Steve GS <Gronicus at SGA.Ninja>
> Subject: Re: Automatic Gain Control in Python?
>
> On 5/28/22 8:17 PM, Steve GS wrote:
>> "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."
>>
>> The smart-speaker is bringing in the podcast by hourly automated
>> commands and sending by audio cable to a computer which is recording
>> it with Audacity. This is an automated system that runs for 48 hours every weekend.
>> Its output is played live throughout the facility and is also recorded
>> for replay through the week.
>>
>> No download to use.
>>
>> AGC is to happen when the Smart Speaker is playing it, real time.
>> Any post-record editing would be a horrendous task to say the least.
>>
> My guess is you don't understand how "Podcasts" work. All they are is a web resource that your Browser/Smart Device makes a request off, and the contents are streamed over the internet to that device, which then plays it. Smart Speakers just have a program that knows how to access these.
>
> Since they can be listened to on a web browser, a program can download the data. They might be doing things to make this harder, but that is a sign that you shouldn't be doing this in the first place.
>
> Often, the data format that is streamed is exactly like the file format for storing an audio file (since that is what the code in the browser is built to handle).
>
> It may be a bit of work to figure out the access methods to get the data, but this is the sort of job that computers were designed to do.
> Trying to make things that weren't designed to be remote controlled to be remote controlled may well be a lot more work.
>
> --
> Richard Damon
>
--
Richard Damon
More information about the Python-list
mailing list