Re: help, please, with 3.10.4 install

2022-05-29 Thread dn
On 29/05/2022 14.11, Jack Gilbert wrote:
> I downloaded 3.10.4 on a 64 bit , 8.1
> I can see IDLE shell 3.10.1, I see Python 3.10.4 (tags/v3.10.4:9d38120, Mar
> 23 2022, 23:13:41) [MSC v.1929 64 bit (AMD64)] on win32
> 
> also, the same line: Python 3.10.4 (tags/v3.10.4:9d38120, Mar 23 2022,
> 23:13:41) [MSC v.1929 64 bit (AMD64)] on win32 in CMD prompt
> 
> for the life of me I can't figure out how to launch python??
> 
> I did click add to path in the install
> 
> thanks


Please advise if https://docs.python.org/3/using/windows.html does not
answer the question...
-- 
Regards,
=dn
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: matplotlib basemap colorbar exception : Given element not contained in the stack

2022-05-29 Thread MRAB

On 2022-05-29 13:57, iMath wrote:

please see the formated code at 
https://stackoverflow.com/questions/72423464/matplotlib-basemap-colorbar-exception-given-element-not-contained-in-the-stack


The problem might be that you're passing "ax=self.ax" when you create 
the basemap, and you have:


self.ax = self.map_canvas.figure.subplots()

According to the docs, ".subplots" doesn't return the axes, it returns a 
_tuple_ of the figure and the axes.

--
https://mail.python.org/mailman/listinfo/python-list


Re: Automatic Gain Control in Python?

2022-05-29 Thread Benjamin Schollnick
> I doubt you even need to write any code to do that. Sox can normalize
> audio levels in files with a single command.

Correct.  

My phrasing was slightly misleading.

There are plenty of applications that should do that.  I was thinking of one 
that Marco Arment makes, but I can’t locate it for reference.

- Benjamin



> On May 29, 2022, at 3:18 PM, Grant Edwards  wrote:
> 
> On 2022-05-29, Benjamin Schollnick  wrote:
> 
>> Why not just right a 3rd party package to normalize the audio levels
>> in the digital file?  It’ll be faster, and probably easier than
>> trying to do it in real time…
> 
> I doubt you even need to write any code to do that. Sox can normalize
> audio levels in files with a single command.
> 
> http://sox.sourceforge.net/
> 
> --
> Grant
> -- 
> https://mail.python.org/mailman/listinfo/python-list

-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Automatic Gain Control in Python?

2022-05-29 Thread Grant Edwards
On 2022-05-29, Benjamin Schollnick  wrote:

> Why not just right a 3rd party package to normalize the audio levels
> in the digital file?  It’ll be faster, and probably easier than
> trying to do it in real time…

I doubt you even need to write any code to do that. Sox can normalize
audio levels in files with a single command.

http://sox.sourceforge.net/

--
Grant
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Automatic Gain Control in Python?

2022-05-29 Thread Benjamin Schollnick
Well, maybe a different approach might be better?

https://www.amazon.com/LEMONKTV-Control-Device-Karaoke-Machine/dp/B07H49JB8S 


I’m unclear on how bringing the audio track into a computer to examine detect 
the audio level, and then adjusting the volume out of the Smart Speaker is 
really doing more than adding complexity.

An all analog solution might be the better route, although finding something 
that is inexpensive might be an issue as well.

- Benjamin



> On May 29, 2022, at 11:32 AM, Steve GS  wrote:
> 
> No, not a digital file. I am playing the podcast/broadcast live to the 
> community using a separate network of smart speakers (Amazon Echo). Commands 
> are being sent hourly through a speaker to the SS from an excel program. I 
> want to monitor the audio level between the line-out of the SS and the input 
> to another computer which then records the audio using Audacity for a single 
> replay during the week.
> 
> I think my first post should have started “Fasten your seat belts, it is 
> going to be a bumpy night…)
>  
>  
> Genie: You have three wishes.
> Me: I wish I had more wishes.
> Genie: You cannot wish for more wishes.
> Me: I wish I could.
>  
> From: Benjamin Schollnick  > 
> Sent: Sunday, May 29, 2022 11:18 AM
> To: Steve GS mailto:Gronicus@SGA.Ninja>>
> Cc: Richard Damon  >; Python  >
> Subject: Re: Automatic Gain Control in Python?
>  
> Okay, you are capturing the audio stream as a digital file somewhere, correct?
>  
> Why not just right a 3rd party package to normalize the audio levels in the 
> digital file?  It’ll be faster, and probably easier than trying to do it in 
> real time…
>  
> eg. 
> https://campus.datacamp.com/courses/spoken-language-processing-in-python/manipulating-audio-files-with-pydub?ex=8
>  
> 
>  
>> Normalizing an audio file with PyDub
>> 
>> Sometimes you'll have audio files where the speech is loud in some portions 
>> and quiet in others. Having this variance in volume can hinder transcription.
>> Luckily, PyDub's effects module has a function called normalize() which 
>> finds the maximum volume of an AudioSegment, then adjusts the rest of the 
>> AudioSegment to be in proportion. This means the quiet parts will get a 
>> volume boost.
>> You can listen to an example of an audio file which starts as loud then goes 
>> quiet, loud_then_quiet.wav, here 
>> .
>> In this exercise, you'll use normalize() to normalize the volume of our 
>> file, making it sound more like this 
>> .
> or
>  
> https://stackoverflow.com/questions/57925304/how-to-normalize-a-raw-audio-file-with-python
>  
> 
> 
> 
>  
> - Benjamin
> 
> 
>> On May 29, 2022, at 11:04 AM, Steve GS > > wrote:
>>  
 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.
>> 
>> How so? I am sending commands to a smart speaker and it plays podcasts and 
>> broadcasts.
>> How is this a violation of SS design?
>> 
>> ===
>> 
 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.
>> 
>> So, you want me to sit here for every hour of the weekend and monitor the 
>> audio levels for a result that will get, at best, one replay when I believe 
>> it can be automated.
>> 
>> ===
>> 
 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.
>> 
>> Again, what limitations of the SS am I violating? It is designed to receive 
>> commands and play the audio.
>> Also, what makes you think that you know how my program is based?
>> 
>> ===
>> 
 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.
>> 
>> Hmmm, is that not my original question? Are you suggesting to 

Re: Automatic Gain Control in Python?

2022-05-29 Thread Michael F. Stemper

On 29/05/2022 10.04, Steve GS wrote:


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.


Writing my own browser in Python might work. Do you have a sample one that I 
could twerk to fit my needs?
I would have to be able to invoke it and an hour later devoke it least I end up 
with multiple audio channels playing.


Somebody has already shown the rudiments of urllib. Another option to consider
is the use of something like curl or wget to download the podcasts, which can
be automated separately from your replay program.

--
Michael F. Stemper
This email is to be read by its intended recipient only. Any other party
reading is required by the EULA to send me $500.00.
--
https://mail.python.org/mailman/listinfo/python-list


RE: Automatic Gain Control in Python?

2022-05-29 Thread Steve GS
No, not a digital file. I am playing the podcast/broadcast live to the 
community using a separate network of smart speakers (Amazon Echo). Commands 
are being sent hourly through a speaker to the SS from an excel program. I want 
to monitor the audio level between the line-out of the SS and the input to 
another computer which then records the audio using Audacity for a single 
replay during the week.

I think my first post should have started “Fasten your seat belts, it is going 
to be a bumpy night…)

 

 

Genie: You have three wishes.

Me: I wish I had more wishes.
Genie: You cannot wish for more wishes.
Me: I wish I could.

 

From: Benjamin Schollnick  
Sent: Sunday, May 29, 2022 11:18 AM
To: Steve GS 
Cc: Richard Damon ; Python 
Subject: Re: Automatic Gain Control in Python?

 

Okay, you are capturing the audio stream as a digital file somewhere, correct?

 

Why not just right a 3rd party package to normalize the audio levels in the 
digital file?  It’ll be faster, and probably easier than trying to do it in 
real time…

 

eg. 
https://campus.datacamp.com/courses/spoken-language-processing-in-python/manipulating-audio-files-with-pydub?ex=8

 


Normalizing an audio file with PyDub


Sometimes you'll have audio files where the speech is loud in some portions and 
quiet in others. Having this variance in volume can hinder transcription.

Luckily, PyDub's effects module has a function called normalize() which finds 
the maximum volume of an AudioSegment, then adjusts the rest of the 
AudioSegment to be in proportion. This means the quiet parts will get a volume 
boost.

You can listen to an example of an audio file which starts as loud then goes 
quiet, loud_then_quiet.wav,  

 here.

In this exercise, you'll use normalize() to normalize the volume of our file, 
making it sound  

 more like this.

or

 

https://stackoverflow.com/questions/57925304/how-to-normalize-a-raw-audio-file-with-python





 

- Benjamin





On May 29, 2022, at 11:04 AM, Steve GS mailto:Gronicus@SGA.Ninja> > wrote:

 

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.


How so? I am sending commands to a smart speaker and it plays podcasts and 
broadcasts.
How is this a violation of SS design?

===



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.


So, you want me to sit here for every hour of the weekend and monitor the audio 
levels for a result that will get, at best, one replay when I believe it can be 
automated.

===



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.


Again, what limitations of the SS am I violating? It is designed to receive 
commands and play the audio.
Also, what makes you think that you know how my program is based?

===



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.


Hmmm, is that not my original question? Are you suggesting to monitor the 
audio, sense it for volume changes and apply those changes to the original 
audio? One thing that may have to happen is a timed-delay to all for the AGC to 
work.   This may require a correlation circuit.

==



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.


Writing my own browser in Python might work. Do you have a sample one that I 
could twerk to fit my needs?
I would have to be able to invoke it and an hour later devoke it least I end up 
with multiple audio channels playing.

Either way, I would still need an AGC program which was my original question.  

===



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. 


The changes in volume are not CAUSED by my program. The want to fix them is a 
new development to 

Re: matplotlib basemap colorbar exception : Given element not contained in the stack

2022-05-29 Thread iMath
please see the formated code at 
https://stackoverflow.com/questions/72423464/matplotlib-basemap-colorbar-exception-given-element-not-contained-in-the-stack
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Automatic Gain Control in Python?

2022-05-29 Thread Christian Gollwitzer

Am 29.05.22 um 00:45 schrieb Stefan Ram:

"Steve GS"  writes:

Subject: Automatic Gain Control in Python?


   Automatic Gain Control in Python is trivial. You have a list
   of samples and normalize them, i.e., divide by max. Slightly
   simplified

[ s/max( samples )for s in samples ]

   (where sample values are normalized to the range -1,+1.)


No, that's not it. Loudness is perceived in a different way, the crudest 
approximation is the standard deviation averaged over small frames, 
better measures take into account that the ear has a strongly frequency 
dependent response. For similar sound files, like podcasts which are 
voice-heavy, the stddev works reasoably well.


If the normalization only reduces the volume, then dividing by the max 
is sufficient. However if you also want to raise the volume, then you 
need dynamic range compression. If you have ever tried to record some 
music with a simple microphone and a computer, you would have noticed 
that the recording is very soft, when normalized to the max. Commercial 
music is incredibly loud, and you might have wondered, how they do that.


Google for "Loudness war" and "dynamic range compression" if you want to 
understand it in detail.


Christian


--
https://mail.python.org/mailman/listinfo/python-list


Re: Automatic Gain Control in Python?

2022-05-29 Thread Martin Schöön
Den 2022-05-29 skrev Christian Gollwitzer :
> Am 29.05.22 um 00:45 schrieb Stefan Ram:
>> "Steve GS"  writes:
>>> Subject: Automatic Gain Control in Python?
>> 
>>Automatic Gain Control in Python is trivial. You have a list
>>of samples and normalize them, i.e., divide by max. Slightly
>>simplified
>> 
>> [ s/max( samples )for s in samples ]
>> 
>>(where sample values are normalized to the range -1,+1.)
>
> No, that's not it. Loudness is perceived in a different way, the crudest 



> music is incredibly loud, and you might have wondered, how they do that.
>
> Google for "Loudness war" and "dynamic range compression" if you want to 
> understand it in detail.
>
I have no suggestions for solving the problem but it struck me that
you might be interested in looking up a standard called EBU R128.
Start with youtube and you find lectures/demos.

Python connection; There is a Python package called ffmpeg-normalize
which contains an implementation of EBU R128. AFAIK it works on files,
not streaming audio.

/Martin
-- 
https://mail.python.org/mailman/listinfo/python-list


help, please, with 3.10.4 install

2022-05-29 Thread Jack Gilbert
I downloaded 3.10.4 on a 64 bit , 8.1
I can see IDLE shell 3.10.1, I see Python 3.10.4 (tags/v3.10.4:9d38120, Mar
23 2022, 23:13:41) [MSC v.1929 64 bit (AMD64)] on win32

also, the same line: Python 3.10.4 (tags/v3.10.4:9d38120, Mar 23 2022,
23:13:41) [MSC v.1929 64 bit (AMD64)] on win32 in CMD prompt

for the life of me I can't figure out how to launch python??

I did click add to path in the install

thanks
-- 
https://mail.python.org/mailman/listinfo/python-list


[Python-announce] Sphinx-5.0.0 is out

2022-05-29 Thread Komiya Takeshi
Hi all,

I'm delighted to announce the release of Sphinx 5.0.0 final, now available on
the Python package index at .

It includes many changes including incompatible ones.
Please confirm it working fine on your documents.

In detail, please see CHANGES:
https://github.com/sphinx-doc/sphinx/blob/5.0.x/CHANGES

Thanks to all collaborators and contributors!

What is it?
===

Sphinx is a tool that makes it easy to create intelligent and beautiful
documentation for Python projects (or other documents consisting of
multiple reStructuredText source files).

Website: http://sphinx-doc.org/

Enjoy!
___
Python-announce-list mailing list -- python-announce-list@python.org
To unsubscribe send an email to python-announce-list-le...@python.org
https://mail.python.org/mailman3/lists/python-announce-list.python.org/
Member address: arch...@mail-archive.com


Re: Automatic Gain Control in Python?

2022-05-29 Thread MRAB

On 2022-05-29 16:17, Benjamin Schollnick wrote:

Okay, you are capturing the audio stream as a digital file somewhere, correct?

Why not just right a 3rd party package to normalize the audio levels in the 
digital file?  It’ll be faster, and probably easier than trying to do it in 
real time…

eg. 
https://campus.datacamp.com/courses/spoken-language-processing-in-python/manipulating-audio-files-with-pydub?ex=8
 


Normalizing an audio file with PyDub

Sometimes you'll have audio files where the speech is loud in some portions and 
quiet in others. Having this variance in volume can hinder transcription.

Luckily, PyDub's effects module has a function called normalize() which finds 
the maximum volume of an AudioSegment, then adjusts the rest of the 
AudioSegment to be in proportion. This means the quiet parts will get a volume 
boost.

You can listen to an example of an audio file which starts as loud then goes quiet, 
loud_then_quiet.wav, here 
.

In this exercise, you'll use normalize() to normalize the volume of our file, making 
it sound more like this 
.

or

https://stackoverflow.com/questions/57925304/how-to-normalize-a-raw-audio-file-with-python
 




[snip]

Here's a sample script that uses pyaudio instead of Audacity.

You can check whether the podcast is playing by checking the volume soon 
after it should've started.


Pyaudio can also read and write files.


import pyaudio
import time
import numpy as np

WIDTH = 2
CHANNELS = 2
RATE = 44100
MAX_VOL = 1024

GAIN_STEP = 0.2
LOUDER = 1 + GAIN_STEP
QUIETER = 1 - GAIN_STEP

gain = 1

p = pyaudio.PyAudio()

def callback(data, frame_count, time_info, status):
global gain

# Decode the bytestream
chunk = np.frombuffer(data, dtype=np.int16)

# Adjust the volume.
chunk = (chunk.astype(np.double) * gain).astype(np.int16)

# Adjust the gain according to the current maximum volume.
max_vol = max(chunk)

if max_vol < MAX_VOL:
gain *= LOUDER
elif max_vol > MAX_VOL:
gain *= QUIETER

return (chunk.tobytes(), pyaudio.paContinue)

stream = p.open(format=p.get_format_from_width(WIDTH), channels=CHANNELS,
  rate=RATE, input=True, output=True, stream_callback=callback)

stream.start_stream()

while stream.is_active():
time.sleep(0.1)

stream.stop_stream()
stream.close()

p.terminate()
--
https://mail.python.org/mailman/listinfo/python-list


Re: Automatic Gain Control in Python?

2022-05-29 Thread Benjamin Schollnick
Okay, you are capturing the audio stream as a digital file somewhere, correct?

Why not just right a 3rd party package to normalize the audio levels in the 
digital file?  It’ll be faster, and probably easier than trying to do it in 
real time…

eg. 
https://campus.datacamp.com/courses/spoken-language-processing-in-python/manipulating-audio-files-with-pydub?ex=8
 


Normalizing an audio file with PyDub

Sometimes you'll have audio files where the speech is loud in some portions and 
quiet in others. Having this variance in volume can hinder transcription.

Luckily, PyDub's effects module has a function called normalize() which finds 
the maximum volume of an AudioSegment, then adjusts the rest of the 
AudioSegment to be in proportion. This means the quiet parts will get a volume 
boost.

You can listen to an example of an audio file which starts as loud then goes 
quiet, loud_then_quiet.wav, here 
.

In this exercise, you'll use normalize() to normalize the volume of our file, 
making it sound more like this 
.

or

https://stackoverflow.com/questions/57925304/how-to-normalize-a-raw-audio-file-with-python
 



- Benjamin

> On May 29, 2022, at 11:04 AM, Steve GS  wrote:
> 
>>> 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.
> 
> How so? I am sending commands to a smart speaker and it plays podcasts and 
> broadcasts.
> How is this a violation of SS design?
> 
> ===
>>> 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.
> 
> So, you want me to sit here for every hour of the weekend and monitor the 
> audio levels for a result that will get, at best, one replay when I believe 
> it can be automated.
> 
> ===
>>> 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.
> 
> Again, what limitations of the SS am I violating? It is designed to receive 
> commands and play the audio.
> Also, what makes you think that you know how my program is based?
> 
> ===
>>> 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.
> 
> Hmmm, is that not my original question? Are you suggesting to monitor the 
> audio, sense it for volume changes and apply those changes to the original 
> audio? One thing that may have to happen is a timed-delay to all for the AGC 
> to work.   This may require a correlation circuit.
> 
> ==
>>> 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.
> 
> Writing my own browser in Python might work. Do you have a sample one that I 
> could twerk to fit my needs?
> I would have to be able to invoke it and an hour later devoke it least I end 
> up with multiple audio channels playing.
> 
> Either way, I would still need an AGC program which was my original question. 
>  
> 
> ===
>>> 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. 
> 
> The changes in volume are not CAUSED by my program. The want to fix them is a 
> new development to improve the product. The volume fluctuations are causes, 
> or neglections, by the engineers at the sources of podcasts and broadcasts. 
> 
>>> 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 

RE: Automatic Gain Control in Python?

2022-05-29 Thread Steve GS
>> 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.

How so? I am sending commands to a smart speaker and it plays podcasts and 
broadcasts.
How is this a violation of SS design?

===
>> 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.

So, you want me to sit here for every hour of the weekend and monitor the audio 
levels for a result that will get, at best, one replay when I believe it can be 
automated.

===
>> 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.

Again, what limitations of the SS am I violating? It is designed to receive 
commands and play the audio.
Also, what makes you think that you know how my program is based?

===
>> 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.

Hmmm, is that not my original question? Are you suggesting to monitor the 
audio, sense it for volume changes and apply those changes to the original 
audio? One thing that may have to happen is a timed-delay to all for the AGC to 
work.   This may require a correlation circuit.

==
>> 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.

Writing my own browser in Python might work. Do you have a sample one that I 
could twerk to fit my needs?
I would have to be able to invoke it and an hour later devoke it least I end up 
with multiple audio channels playing.

Either way, I would still need an AGC program which was my original question.  

===
>> 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. 

The changes in volume are not CAUSED by my program. The want to fix them is a 
new development to improve the product. The volume fluctuations are causes, or 
neglections, by the engineers at the sources of podcasts and broadcasts. 

>> 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.

"Real programming"?, REAL PROGRAMMING? Well at this I have to say "Well duh". I 
have more than 40 years of programming in languages including assembly, Pascal, 
C, C++, BASIC, Visual BASIC, COBOL, VBA and Python for starters.  I even dipped 
into AT's SNOBAL. Starting in the mid-80s, I taught Visual BASIC and VBA for 
15 years in high school and at the University level.

I have 2000 lines of code of Python that helped me to bring my A1c reading from 
9.0 to 6.1 thank you. I have a program of similar size that tracks the 450 
specific plants in my garden. It even monitors degree-days to help me know when 
certain insects attack and when to tend to individual needs. This Excel/Jukebox 
program is also about 2000 lines of code. (Seems to be a pattern here). All of 
these programs are decorated with numerous pops and whistles that make 
programming and use quite pleasurable,

So, do you I think I am now ready for some "real programming".

===
>> 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.

Yes, I have been through that. It is totally legal to record NPR broadcasts for 
replay as long as they are not retained for than a month or for multiple 
replays. Your suggestion to download and play a podcast or broadcast is legal 
only for live replay. My want to record them for one replay for my own use.  
Personal play is a different story.




-Original Message-
From: Richard Damon  On Behalf Of Richard Damon
Sent: Sunday, 

Re: Automatic Gain Control in Python?

2022-05-29 Thread Richard Damon
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  On Behalf Of Richard Damon
Sent: Saturday, May 28, 2022 11:37 PM
To: Steve GS 
Subject: Re: