Path: ...!fu-berlin.de!uni-berlin.de!not-for-mail From: marc nicole Newsgroups: comp.lang.python Subject: How to check whether audio bytes contain empty noise or actual voice/signal? Date: Fri, 25 Oct 2024 18:25:19 +0200 Lines: 31 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" X-Trace: news.uni-berlin.de eWMiKShX2bv9RTG0NqvgVAhVSOFpx0boQKs8cFQ8DsWg== Cancel-Lock: sha1:iXF27Zs0yf/VU2e/avDvlfHcCxs= sha256:V030QieErH2qDyOAU7xoDyvn+YQl+tCzFMWB4Y0x/+U= Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org Authentication-Results: mail.python.org; dkim=pass reason="2048-bit key; unprotected key" header.d=gmail.com header.i=@gmail.com header.b=jigiznyM; dkim-adsp=pass; dkim-atps=neutral X-Spam-Status: OK 0.102 X-Spam-Level: * X-Spam-Evidence: '*H*': 0.80; '*S*': 0.01; 'stream': 0.04; 'containing': 0.05; 'variable': 0.05; 'filled': 0.09; '1024': 0.16; 'mic': 0.16; 'noise': 0.16; 'python': 0.16; 'to:addr:python- list': 0.20; 'to:no real name:2**1': 0.22; 'list,': 0.24; 'actual': 0.25; ' List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Mailman-Original-Message-ID: Bytes: 5537 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.