From mk1853387 at gmail.com  Sat Oct  5 13:55:36 2024
From: mk1853387 at gmail.com (marc nicole)
Date: Sat, 5 Oct 2024 19:55:36 +0200
Subject: [Tutor] How to check whether lip movement is significant using face
 landmarks in dlib?
Message-ID: <CAGJtH9Sz8MsB=O1Woc_PiKdaX+6A6G3-avDDXs=BeFb3eagf4w@mail.gmail.com>

I am trying to assess whether the lips of a person are moving too much
while the mouth is closed (to conclude they are chewing).

I try to assess the lip movement through landmarks (dlib) :

Inspired by the mouth example (
https://github.com/mauckc/mouth-open/blob/master/detect_open_mouth.py#L17),
and using it before the following function (as a primary condition for
telling the person is chewing), I wrote the following function:

def lips_aspect_ratio(shape):
    # grab the indexes of the facial landmarks for the lip
    (mStart, mEnd) = (61, 68)
    lip = shape[mStart:mEnd]
    print(len(lip))
    # compute the euclidean distances between the two sets of
    # vertical lip landmarks (x, y)-coordinates
    # to reach landmark 68 I need to get lib[7] not lip[6] (while I
get lip[7] I get IndexOutOfBoundError)
    A = dist.euclidean(lip[1], lip[6])  # 62, 68
    B = dist.euclidean(lip[3], lip[5])  # 64, 66

    # compute the euclidean distance between the horizontal
    # lip landmark (x, y)-coordinates
    C = dist.euclidean(lip[0], lip[4])  # 61, 65

    # compute the lip aspect ratio
    mar = (A + B) / (2.0 * C)

    # return the lip aspect ratio
    return mar


How to define an aspect ratio for the lips to conclude they are moving
significantly? Is the mentioned function able to tell whether the lips
are significantly moving while the mouth is closed?

From avi.e.gross at gmail.com  Sun Oct  6 16:43:10 2024
From: avi.e.gross at gmail.com (avi.e.gross at gmail.com)
Date: Sun, 6 Oct 2024 16:43:10 -0400
Subject: [Tutor] Clarification on .format() Method and Negative Indices
 in Python
In-Reply-To: <02fc01db1830$42ceaf60$c86c0e20$@gmail.com>
References: <CAMP8o2xsnHqE-zaVD-XyccDw9WDdbeNsV6B9DmVFCVzhoSH0_A@mail.gmail.com>
 <02fc01db1830$42ceaf60$c86c0e20$@gmail.com>
Message-ID: <02ff01db1830$5b224130$1166c390$@gmail.com>

Hi,

I'm not responding to what was designed for this one of many ways to print but suggesting a way to get what you want another way.

Consider using an fstring as in this example:

>>> example="ABCDE"
>>> example[-1]
'E'
>>> print(f"last char in example is: {example[-1]}")
last char in example is: E

Anything in an f-string between curly braces is evaluated and replaced and negative numbers are supported.

Of course, if someday they change your other way, feel free to use that.

And, of course, you can preprocess what you want before using your print method into a small variable, as another workaround.


-----Original Message-----
From: Tutor <tutor-bounces+avi.e.gross=gmail.com at python.org> On Behalf Of Xingyuan Shi via Tutor
Sent: Tuesday, September 24, 2024 10:23 PM
To: tutor at python.org
Subject: [Tutor] Clarification on .format() Method and Negative Indices in Python

Dear Python Tutor Team,

I hope you are having a great day.

I have been learning more about Python?s string formatting, and I came
across an interesting issue regarding the .format() method. Specifically, I
was curious as to why negative indices like {-1} are not supported in this
method, while negative indexing works perfectly with lists and other
sequences in Python.

For instance, I attempted to use the following code:

print("{-1},{-1},{-1}".format(20, "example", 3.14))

I expected the placeholders {-1} to behave similarly to negative indices in
lists, but it resulted in an error. I understand that .format() relies on
positional arguments, but I wonder if there was a specific design rationale
behind not allowing negative indices here. Could you shed some light on
this design choice?

Thank you very much for your time and for developing such an incredible
language that I thoroughly enjoy learning.

Best regards,
Stone
_______________________________________________
Tutor maillist  -  Tutor at python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor



From PythonList at DancesWithMice.info  Mon Oct  7 04:32:45 2024
From: PythonList at DancesWithMice.info (dn)
Date: Mon, 7 Oct 2024 21:32:45 +1300
Subject: [Tutor] How to check whether lip movement is significant using
 face landmarks in dlib?
In-Reply-To: <CAGJtH9Sz8MsB=O1Woc_PiKdaX+6A6G3-avDDXs=BeFb3eagf4w@mail.gmail.com>
References: <CAGJtH9Sz8MsB=O1Woc_PiKdaX+6A6G3-avDDXs=BeFb3eagf4w@mail.gmail.com>
Message-ID: <99d45736-1a35-4a3b-a2ce-41ae3a8b2a1b@DancesWithMice.info>

On 6/10/24 06:55, marc nicole via Tutor wrote:
> I am trying to assess whether the lips of a person are moving too much
> while the mouth is closed (to conclude they are chewing).
> 
> I try to assess the lip movement through landmarks (dlib) :

The Austin Python Meetup Monthly Meetup
This is a virtual event.

Talk one: Cameron James will be showing her project MoviEmotion for 
Detecting facial emotions with AI image recognition models. With the 
objective to identify exactly which movie moments resonate most with the 
audience.

Cameron James
SWE (Principal Eng) --> Portfolio Manager --> Program Director, all in 
F200, BigCoRetail IT, and BigTech.
- Tech has always been a thrill for me. Machine learning and AI took it 
to a new level.
----

Wednesday (in TX)

https://www.meetup.com/austinpython/events/301678835/

-- 
Regards,
=dn

From avi.e.gross at gmail.com  Tue Oct  8 19:43:35 2024
From: avi.e.gross at gmail.com (avi.e.gross at gmail.com)
Date: Tue, 8 Oct 2024 19:43:35 -0400
Subject: [Tutor] Signing off
In-Reply-To: <007701d89150$1dea86b0$59bf9410$@gmail.com>
References: <008a01d890e0$756336a0$6029a3e0$@gmail.com>
 <7143f0d4-0fdf-88eb-22d9-391065b28044@yahoo.co.uk>
 <007701d89150$1dea86b0$59bf9410$@gmail.com>
Message-ID: <012d01db19db$e42d7c40$ac8874c0$@gmail.com>

Just a final brief note.

I am leaving the python community so don't worry that anything happened to me. I have a disagreement with the direction some people are taking with the python community that is my issue and it that probably will not bother most people.

I have lots of other interests including many other programming languages and it is time I stopped using python when I have so much else to choose from.

My best wishes to everyone here.

Avi


From leamhall at gmail.com  Wed Oct  9 05:20:54 2024
From: leamhall at gmail.com (Leam Hall)
Date: Wed, 9 Oct 2024 04:20:54 -0500
Subject: [Tutor] Signing off
In-Reply-To: <012d01db19db$e42d7c40$ac8874c0$@gmail.com>
References: <008a01d890e0$756336a0$6029a3e0$@gmail.com>
 <7143f0d4-0fdf-88eb-22d9-391065b28044@yahoo.co.uk>
 <007701d89150$1dea86b0$59bf9410$@gmail.com>
 <012d01db19db$e42d7c40$ac8874c0$@gmail.com>
Message-ID: <6dbdef86-04fe-3b65-3588-eef3fb5b50da@gmail.com>

On 10/8/24 18:43, avi.e.gross--- via Tutor wrote:
> Just a final brief note.
> 
> I am leaving the python community so don't worry that anything happened to me. I have a disagreement with the direction some people are taking with the python community that is my issue and it that probably will not bother most people.
> 
> I have lots of other interests including many other programming languages and it is time I stopped using python when I have so much else to choose from.
> 
> My best wishes to everyone here.
> 
> Avi


Avi, wishing you well in you future endeavors.

Leam

-- 
Automation Engineer     (reuel.net/resume)
Scribe: The Domici War  (domiciwar.net)
General Ne'er-do-well   (github.com/LeamHall)

From jblanca at upv.es  Thu Oct 10 04:13:18 2024
From: jblanca at upv.es (=?iso-8859-1?Q?Jos=E9_Miguel_Blanca_Postigo_Jose_Miguel?=)
Date: Thu, 10 Oct 2024 08:13:18 +0000
Subject: [Tutor] introduction to programming course
Message-ID: <PAXP190MB181587F906E0C1C98071827DD8782@PAXP190MB1815.EURP190.PROD.OUTLOOK.COM>

Hi,

I have been teaching a programming introductory course for a number of years using Python. This time I have prepared an interactive site for the students.

https://bioinf.comav.upv.es/courses/intro_programming/

It is focused on examples and exercises, so not a lot of theory. I would welcome suggestions and fixes.


This course might be useful for somebody in this list, but I am not sure if this is the correct place to inform the community about this resource, but since this is a list related to Python teaching I have thought that it might be the place. Sorry if this is not the intended use of the list.

Best regards,

Jos? Blanca





From reemmutairy7 at gmail.com  Sun Oct 13 01:25:21 2024
From: reemmutairy7 at gmail.com (Reem Mutairy)
Date: Sun, 13 Oct 2024 05:25:21 +0000
Subject: [Tutor] Python Security Survey - Your Expertise Needed!
Message-ID: <AM0PR09MB326686FAF1FA0B15ED6406D4A97B2@AM0PR09MB3266.eurprd09.prod.outlook.com>


Hello Python Developers and Security Engineers,
I?m Reem Almutairi, a Ph.D. student in Software Engineering at King Saud University. I?m conducting research to better understand the prevalence and impact of security vulnerabilities in Python, as well as the strategies developers use to mitigate these risks.
If you have experience in Python and are familiar with security vulnerabilities, I?d greatly appreciate your input in this 10-minute survey.
? [ https://n9.cl/2ow2c
[https://lh6.googleusercontent.com/2RkP1spcsyjz1WD_HnUioMUEHvWWna6Cn0HrU7U9V_HKwXbnWsXr7futHg1JDb2m_k01A8ttA8A=w1200-h630-p]<https://n9.cl/2ow2c>
Identifying Key Software Security Vulnerabilities (Security Smells) in Python Applications<https://n9.cl/2ow2c>
n9.cl
 ]
Also, if you know others who might be interested, please feel free to share the survey link with them!
Your insights will help shape future security practices in Python development.
Thank you in advance for your time and expertise.
Warm regards,
Reem Almutairi
Ph.D. Student, Software Engineering
King Saud University


From mk1853387 at gmail.com  Fri Oct 25 12:25:19 2024
From: mk1853387 at gmail.com (marc nicole)
Date: Fri, 25 Oct 2024 18:25:19 +0200
Subject: [Tutor] How to check whether audio bytes contain empty noise or
 actual voice/signal?
Message-ID: <CAGJtH9TqEpGjQi+KYNrSV3+UtVO-jjFLK02N9MEA0uuQvr11qQ@mail.gmail.com>

Hello Python fellows,

I hope this question is not very far from the main topic of this list, but
I have a hard time finding a way to check whether audio data samples are
containing empty noise or actual significant voice/noise.

I am using PyAudio to collect the sound through my PC mic as follows:

FRAMES_PER_BUFFER = 1024
FORMAT = pyaudio.paInt16
CHANNELS = 1
RATE = 48000
RECORD_SECONDS = 2import pyaudio
audio = pyaudio.PyAudio()
stream = audio.open(format=FORMAT,
                channels=CHANNELS,
                rate=RATE,
                input=True,
                frames_per_buffer=FRAMES_PER_BUFFER,
                input_device_index=2)
data = stream.read(FRAMES_PER_BUFFER)


I want to know whether or not data contains voice signals or empty sound,
To note that the variable always contains bytes (empty or sound) if I print
it.

Is there an straightforward "easy way" to check whether data is filled with
empty noise or that somebody has made noise/spoke?

Thanks.

From PythonList at DancesWithMice.info  Fri Oct 25 19:42:34 2024
From: PythonList at DancesWithMice.info (dn)
Date: Sat, 26 Oct 2024 12:42:34 +1300
Subject: [Tutor] How to check whether audio bytes contain empty noise or
 actual voice/signal?
In-Reply-To: <CAGJtH9TqEpGjQi+KYNrSV3+UtVO-jjFLK02N9MEA0uuQvr11qQ@mail.gmail.com>
References: <CAGJtH9TqEpGjQi+KYNrSV3+UtVO-jjFLK02N9MEA0uuQvr11qQ@mail.gmail.com>
Message-ID: <d16509a2-3151-434a-bf2a-dfad9f8b356a@DancesWithMice.info>

On 26/10/24 05:25, marc nicole via Tutor wrote:
> Hello Python fellows,
> 
> I hope this question is not very far from the main topic of this list, but
> I have a hard time finding a way to check whether audio data samples are
> containing empty noise or actual significant voice/noise.
> 
> I am using PyAudio to collect the sound through my PC mic as follows:
> 
> FRAMES_PER_BUFFER = 1024
> FORMAT = pyaudio.paInt16
> CHANNELS = 1
> RATE = 48000
> RECORD_SECONDS = 2import pyaudio
> audio = pyaudio.PyAudio()
> stream = audio.open(format=FORMAT,
>                  channels=CHANNELS,
>                  rate=RATE,
>                  input=True,
>                  frames_per_buffer=FRAMES_PER_BUFFER,
>                  input_device_index=2)
> data = stream.read(FRAMES_PER_BUFFER)
> 
> 
> I want to know whether or not data contains voice signals or empty sound,
> To note that the variable always contains bytes (empty or sound) if I print
> it.
> 
> Is there an straightforward "easy way" to check whether data is filled with
> empty noise or that somebody has made noise/spoke?

If it were "easy" then there would be articles and tutorials aplenty...

Signal processing is a very involved topic.

A Fourier Transform can be thought of as converting a graph from signal 
against time, to frequency components. Speech can then be identified.

Filtering allows the inclusion/removal of unwanted frequencies (probably 
not useful, per spec).

Spectral Analysis is similar to above but with respect to changes over time.

Time-Domain analysis stays at the level of the current code. Try 
graphing that. A lead-in period (of "silence") should enable 
identification of background/technical noise. Perhaps thereafter, the 
presence of sound over-and-above the "background" will be sufficient for 
your purposes (use-case not stated).

-- 
Regards,
=dn

From mk1853387 at gmail.com  Sat Oct 26 08:31:42 2024
From: mk1853387 at gmail.com (marc nicole)
Date: Sat, 26 Oct 2024 14:31:42 +0200
Subject: [Tutor] How to check whether audio bytes contain empty noise or
 actual voice/signal?
In-Reply-To: <d16509a2-3151-434a-bf2a-dfad9f8b356a@DancesWithMice.info>
References: <CAGJtH9TqEpGjQi+KYNrSV3+UtVO-jjFLK02N9MEA0uuQvr11qQ@mail.gmail.com>
 <d16509a2-3151-434a-bf2a-dfad9f8b356a@DancesWithMice.info>
Message-ID: <CAGJtH9TAJHQZ-yp=e9NSguChBzSZZ94vaiaPjvoXMh-oHwU8hQ@mail.gmail.com>

Thanks for the information.

But what is a good way to look for presence of sound over the "background"
from the audio data in Python 2.7?

Thanks.

Le sam. 26 oct. 2024 ? 01:52, dn via Tutor <tutor at python.org> a ?crit :

> On 26/10/24 05:25, marc nicole via Tutor wrote:
> > Hello Python fellows,
> >
> > I hope this question is not very far from the main topic of this list,
> but
> > I have a hard time finding a way to check whether audio data samples are
> > containing empty noise or actual significant voice/noise.
> >
> > I am using PyAudio to collect the sound through my PC mic as follows:
> >
> > FRAMES_PER_BUFFER = 1024
> > FORMAT = pyaudio.paInt16
> > CHANNELS = 1
> > RATE = 48000
> > RECORD_SECONDS = 2import pyaudio
> > audio = pyaudio.PyAudio()
> > stream = audio.open(format=FORMAT,
> >                  channels=CHANNELS,
> >                  rate=RATE,
> >                  input=True,
> >                  frames_per_buffer=FRAMES_PER_BUFFER,
> >                  input_device_index=2)
> > data = stream.read(FRAMES_PER_BUFFER)
> >
> >
> > I want to know whether or not data contains voice signals or empty sound,
> > To note that the variable always contains bytes (empty or sound) if I
> print
> > it.
> >
> > Is there an straightforward "easy way" to check whether data is filled
> with
> > empty noise or that somebody has made noise/spoke?
>
> If it were "easy" then there would be articles and tutorials aplenty...
>
> Signal processing is a very involved topic.
>
> A Fourier Transform can be thought of as converting a graph from signal
> against time, to frequency components. Speech can then be identified.
>
> Filtering allows the inclusion/removal of unwanted frequencies (probably
> not useful, per spec).
>
> Spectral Analysis is similar to above but with respect to changes over
> time.
>
> Time-Domain analysis stays at the level of the current code. Try
> graphing that. A lead-in period (of "silence") should enable
> identification of background/technical noise. Perhaps thereafter, the
> presence of sound over-and-above the "background" will be sufficient for
> your purposes (use-case not stated).
>
> --
> Regards,
> =dn
> _______________________________________________
> Tutor maillist  -  Tutor at python.org
> To unsubscribe or change subscription options:
> https://mail.python.org/mailman/listinfo/tutor
>

From mk1853387 at gmail.com  Sat Oct 26 08:50:16 2024
From: mk1853387 at gmail.com (marc nicole)
Date: Sat, 26 Oct 2024 14:50:16 +0200
Subject: [Tutor] How to check whether audio bytes contain empty noise or
 actual voice/signal?
In-Reply-To: <CAGJtH9TAJHQZ-yp=e9NSguChBzSZZ94vaiaPjvoXMh-oHwU8hQ@mail.gmail.com>
References: <CAGJtH9TqEpGjQi+KYNrSV3+UtVO-jjFLK02N9MEA0uuQvr11qQ@mail.gmail.com>
 <d16509a2-3151-434a-bf2a-dfad9f8b356a@DancesWithMice.info>
 <CAGJtH9TAJHQZ-yp=e9NSguChBzSZZ94vaiaPjvoXMh-oHwU8hQ@mail.gmail.com>
Message-ID: <CAGJtH9TuKuEwa2KWjVBjnBcw2_v4LNZ9kgA4VAd+za=tSV=E-A@mail.gmail.com>

would this be helpful?
https://python-sounddevice.readthedocs.io/en/0.5.1/examples.html#plot-microphone-signal-s-in-real-time

Le sam. 26 oct. 2024 ? 14:31, marc nicole <mk1853387 at gmail.com> a ?crit :

> Thanks for the information.
>
> But what is a good way to look for presence of sound over the "background"
> from the audio data in Python 2.7?
>
> Thanks.
>
> Le sam. 26 oct. 2024 ? 01:52, dn via Tutor <tutor at python.org> a ?crit :
>
>> On 26/10/24 05:25, marc nicole via Tutor wrote:
>> > Hello Python fellows,
>> >
>> > I hope this question is not very far from the main topic of this list,
>> but
>> > I have a hard time finding a way to check whether audio data samples are
>> > containing empty noise or actual significant voice/noise.
>> >
>> > I am using PyAudio to collect the sound through my PC mic as follows:
>> >
>> > FRAMES_PER_BUFFER = 1024
>> > FORMAT = pyaudio.paInt16
>> > CHANNELS = 1
>> > RATE = 48000
>> > RECORD_SECONDS = 2import pyaudio
>> > audio = pyaudio.PyAudio()
>> > stream = audio.open(format=FORMAT,
>> >                  channels=CHANNELS,
>> >                  rate=RATE,
>> >                  input=True,
>> >                  frames_per_buffer=FRAMES_PER_BUFFER,
>> >                  input_device_index=2)
>> > data = stream.read(FRAMES_PER_BUFFER)
>> >
>> >
>> > I want to know whether or not data contains voice signals or empty
>> sound,
>> > To note that the variable always contains bytes (empty or sound) if I
>> print
>> > it.
>> >
>> > Is there an straightforward "easy way" to check whether data is filled
>> with
>> > empty noise or that somebody has made noise/spoke?
>>
>> If it were "easy" then there would be articles and tutorials aplenty...
>>
>> Signal processing is a very involved topic.
>>
>> A Fourier Transform can be thought of as converting a graph from signal
>> against time, to frequency components. Speech can then be identified.
>>
>> Filtering allows the inclusion/removal of unwanted frequencies (probably
>> not useful, per spec).
>>
>> Spectral Analysis is similar to above but with respect to changes over
>> time.
>>
>> Time-Domain analysis stays at the level of the current code. Try
>> graphing that. A lead-in period (of "silence") should enable
>> identification of background/technical noise. Perhaps thereafter, the
>> presence of sound over-and-above the "background" will be sufficient for
>> your purposes (use-case not stated).
>>
>> --
>> Regards,
>> =dn
>> _______________________________________________
>> Tutor maillist  -  Tutor at python.org
>> To unsubscribe or change subscription options:
>> https://mail.python.org/mailman/listinfo/tutor
>>
>