Re: Automatic Gain Control in Python?

2022-06-06 Thread Phil Boutros
Steve GS  wrote:
> Yes, it is real-time play back of a pre-recorded presentation. 
> A juke box does the same thing. It plays records.
> You didn't put your quarter in to expect the band to play your piece live,
> did you?
>
> Same here, I am pulling in the programs and playing them for an audience.
> All I want to do is have some semblance of AGC audio since the sources don't
> seem to be able to do it.

And if your metaphorical jukebox plays digital files, I would
expect it to do any modifications to the *file* before playing, not try
to modify the output as it analyzed what it was playing via its own
output (for some reason), which is vastly more difficult.

You're saying it here yourself:  "I am pulling in the programs".
Good, then modify them *before* playing them?  Nope, you insist on
getting them playing, then attempting to monitor them and modify them
on the fly based on...some parameters that are unclear. But, once
again, your way is clearly better, then go ahead and fill your boots
on doing it your way.  What do we know?  

Good luck to you.  It once again appears that we are at an
impasse. Let us know how it works out.


Phil
-- 
AH#61  Wolf#14  BS#89  bus#1  CCB#1  SENS  KOTC#4
ph...@philb.ca  http://philb.ca
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Automatic Gain Control in Python?

2022-06-06 Thread Phil Boutros
Stefan Ram  wrote:
>
>   When a mike is used anyway: Some mobile devices have a mike
>   with AGC in the driver, so they usually record with AGC.

In the name of all that is Holy, please don't suggest another
intermediary step that may actually be taken seriously here!  Do you
really want a phone listening to this speaker while recording, and
then...er...what?  Feed that to the speaker again?  

This is a level of masochism that the Marquis de Sade would blush
at.


Phil
-- 
AH#61  Wolf#14  BS#89  bus#1  CCB#1  SENS  KOTC#4
ph...@philb.ca  http://philb.ca
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Automatic Gain Control in Python?

2022-06-06 Thread Phil Boutros
Steve GS  wrote:
>
> Maybe you do not understand smart speakers. That is exactly what they do.
> You tell them what podcast/broadcast to play, they get it and play it for
> you. It is that simple.
>
> All I want to do is change the audio levels automatically to make it easier
> on the ear.

Once again, what you are telling the speaker to play is a
pre-recorded file.  Grab it.  Normalize it however you want (compared
to others, compared to set specs, compared to whatever tickles your
fancy).  Tell the speaker to play *that* file instead.  Done.


Phil
-- 
AH#61  Wolf#14  BS#89  bus#1  CCB#1  SENS  KOTC#4
ph...@philb.ca  http://philb.ca
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Automatic Gain Control in Python?

2022-06-06 Thread Phil Boutros
Chris Angelico  wrote:
>
> General principle: If you're asking someone else for help, don't tell
> them that your way is easier, because the obvious response is "go
> ahead then, do it your own way".

*Ding Ding Ding*...We have a winner!  At least, that's where I
dropped off.  My experienced advice is all wrong for you?  Sorry I
couldn't help more.  Good luck to you.

> You're technically right in a sense: something that you already have
> is, indeed, easier than something else. But downloading files is
> *easy* in Python, and audio analysis on files is FAR easier than
> real-time audio analysis with hysteresis avoidance.

Also this.


> Unless you have a really good
> reason for sticking to the black-box system, I would strongly
> recommend going for the much much easier method of simply downloading
> the files as they are.

As pretty much everyone else has said. Insisting on real-time
processing of something that is itself pre-recorded is non-sensical.


Phil
-- 
AH#61  Wolf#14  BS#89  bus#1  CCB#1  SENS  KOTC#4
ph...@philb.ca  http://philb.ca
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Automatic Gain Control in Python?

2022-05-31 Thread Phil Boutros
Richard Damon  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.

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

Even easier, the few NPR podcasts I just checked now have RSS
feeds of their episodes (as expected).  It seems it would be much
easier to just download the latest episode based on the XML file,
normalize, send it to play, done.

Why is it so crucial that it be done "in real time", which it
really isn't, unless you are listening to the live NPR feed.  In the
case of podcasts, *why* would you possible play them via streaming
instead of downloading the publicly accessible file to manipulate
however you chose?

> SteveGS wrote:
>> The code is to: Listen to the audio level for about 10 seconds or
>> so and raise or lower the level in small increments.

Based on what?  Do you want a 10 second buffer to continually be
analyzed in real time?  From the output of a speaker, no less? 

And which level?  Peak?  Average over...10 seconds?  Are you
keeping track of the previous values to make it match?  Where is that
stored?

>> It has nothing to do with understanding how to grab podcasts.  The
>> system is working very well for that.

OK...then perhaps I/we am/are confused on the limitations of the
program.  What does it "grab", *exactly*?


Phil
-- 
AH#61  Wolf#14  BS#89  bus#1  CCB#1  SENS  KOTC#4
ph...@philb.ca  http://philb.ca
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: learning python building 2nd app, need advices

2021-01-13 Thread Phil Boutros
Loris Bennett  wrote:

> As an Emacs user, personally I would use the command 
>
>   M-x untabify
>
> within Emacs.  I assume that Vim has something similar.

It does.  ':retab' is what you want.  If you have tabstop set to a
specific value, it'll use that.  If not, you can do ':retab ',
where  is an integer defining how many spaces to replace a tab
with.

Don't add the quote symbols ('), I added it for readability!

As others have mentionned, 'expand' from the shell also works. 

Phil
-- 
AH#61  Wolf#14  BS#89  bus#1  CCB#1  SENS  KOTC#4
ph...@philb.ca  http://philb.ca
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Python "Bad syntax"

2018-02-05 Thread Phil Boutros
Phil Boutros <ph...@philb.ca> wrote:
>
> Which version of python are you using?  That syntax for "print"
> started in python 3 (since print became a function).  
>
> Try adding:
>
> from __future__ import print_function
>
> before your code if you're still using python 2.x

Altough, testing it in Python2, it still works, but it prints the
tuples, of course.

As Christian said, I suspect this is an indent error of sorts.

Manually typing your code with correct indents, I can verify that
it works in both Python 2 and 3 (with various results depending on
which version of print is used, of course.)


Phil
-- 
AH#61  Wolf#14  BS#89  bus#1  CCB#1  SENS  KOTC#4
ph...@philb.ca  http://philb.ca
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Python "Bad syntax"

2018-02-05 Thread Phil Boutros
  wrote:
>  
> Hi, I have a problem in continuing the function.
>  
> I'm a beginner, I'm learning from a textbook. I'm going to put the
> following examples from a textbook that displays "wrong syntax"
>  
 for letter in "ABCDEFGHIJKLMNOPQRSTUVWXYZ":
>             if letter in "AEIOU":
>                 print(letter, "is a vowel")
>            else:
>                  print(letter, "is a consonant")
>  
> In this text, I will write a "wrong syntax" after confirming the
> "else" function. How is it possible? Using the Bad Version of
> Python? Please, please, thank you very much!

Which version of python are you using?  That syntax for "print"
started in python 3 (since print became a function).  

Try adding:

from __future__ import print_function

before your code if you're still using python 2.x

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


Re: I need a lot of help...

2016-12-24 Thread Phil Boutros
raulmaqueda6...@gmail.com  wrote:
> I do not know how to do this exercise, does anyone help me?

If you have a specific, precise question, that's one thing.
Otherwise:

http://lmgtfy.com/?q=Academic+Dishonesty

Phil
-- 
AH#61  Wolf#14  BS#89  bus#1  CCB#1  SENS  KOTC#4
h...@philb.ca  http://philb.ca
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Specify the database for a Django ModelForm instance

2016-08-10 Thread Phil Boutros
Ben Finney  wrote:
>
> The person who wrote that question must think very like myself.
>
> That doesn't address the question about ‘ModelForm.clean’ or
> ‘ModelForm.is_valid’, though; how to tell the instance which database to
> use for those?

I must admit to not using multi-DB myself, but I think this set of
answers may point you in the right direction:

http://stackoverflow.com/questions/35214706/django-model-form-is-valid-in-specific-database


Phil
-- 
AH#61  Wolf#14  BS#89  bus#1  CCB#1  SENS  KOTC#4   ph...@philb.ca
http://philb.ca EKIII rides with me:  http://eddiekieger.com
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Specify the database for a Django ModelForm instance

2016-08-09 Thread Phil Boutros
Ben Finney  wrote:
> Howdy all,
>
> How can I specify which database (by its alias name) a Django ModelForm
> should use

> What is the equivalent for using='foo' when instantiating a ModelForm
> for the model, or calling its methods (ModelForm.clean, ModelForm.save,
> etc.)?

You would specify it on the save method (using the same
"using='foo'") paremeter.  Do your work between calling save with
commit=false and doing the real save.

For example:

http://stackoverflow.com/questions/37740848/use-a-specific-database-with-a-modelform

  
Phil
-- 
AH#61  Wolf#14  BS#89  bus#1  CCB#1  SENS  KOTC#4   ph...@philb.ca
http://philb.ca EKIII rides with me:  http://eddiekieger.com
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: ASCII or Unicode? (was best text editor for programming Python on a Mac)

2016-06-19 Thread Phil Boutros
Steven D'Aprano  wrote:
>
> Quote:
>
> "Why do we have to write x!=y then argue about the status of x<>y when we
> can simply write x≠y?"
>
> "Simply"?
>
> This is how I write x≠y from scratch:


To wrap this back full circle, here's how it's done on vim:  

Ctrl-K, =, ! (last two steps interchangeable).  Done.  Result:  ≠

It's still probably a horrible idea to have it in a programming
language, though, unless the original behaviour still also works.


Phil
-- 
AH#61  Wolf#14  BS#89  bus#1  CCB#1  SENS  KOTC#4   ph...@philb.ca
http://philb.ca EKIII rides with me:  http://eddiekieger.com
-- 
https://mail.python.org/mailman/listinfo/python-list