Hi,
I have a question (Sorry I'm not very professional in python).
I'm using PyAudio to capture microphone sound with python (for its Peak Value).
The code is something like this:
Now my question is:
How can I calculate the average of for example every 10 peak values (in order) and print the average line by line instead of printing peak values for every frame!?
I know that I should save every 10 peak value result in an (maybe) array and then do the calculation but I don't know how to do it in python :-/ !
Please help me...
Thank you so much for your attention
.
Kind Regards.
I have a question (Sorry I'm not very professional in python).
I'm using PyAudio to capture microphone sound with python (for its Peak Value).
The code is something like this:
p=pyaudio.PyAudio() stream=p.open(format=pyaudio.paInt16, channels=1,rate=RATE, input=True, frames_per_buffer=CHUNK) while True: data = np.fromstring(stream.read(1024),dtype=np.int16) dataMic = data... ... print("peak values")When I run the app, it starts to print peak values line by line very fast (values change when microphone get sound)
Now my question is:
How can I calculate the average of for example every 10 peak values (in order) and print the average line by line instead of printing peak values for every frame!?
I know that I should save every 10 peak value result in an (maybe) array and then do the calculation but I don't know how to do it in python :-/ !
Please help me...
Thank you so much for your attention

Kind Regards.