Deutsch English Français Italiano |
<mailman.50.1729956956.4695.python-list@python.org> View for Bookmarking (what is this?) Look up another Usenet article |
Path: ...!news.roellig-ltd.de!open-news-network.org!weretis.net!feeder8.news.weretis.net!fu-berlin.de!uni-berlin.de!not-for-mail From: MRAB <python@mrabarnett.plus.com> Newsgroups: comp.lang.python Subject: Re: How to check whether audio bytes contain empty noise or actual voice/signal? Date: Sat, 26 Oct 2024 16:35:47 +0100 Lines: 35 Message-ID: <mailman.50.1729956956.4695.python-list@python.org> References: <CAGJtH9TqEpGjQi+KYNrSV3+UtVO-jjFLK02N9MEA0uuQvr11qQ@mail.gmail.com> <13ca3f2d-3a86-4771-9318-73ab806179a9@mrabarnett.plus.com> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Trace: news.uni-berlin.de C3Jt4tCiyTZ3b9fsUD1wWwrRQ33vxztwxOgl1m0z57JQ== Cancel-Lock: sha1:n6YqRMnFgqCEMZMadZOL7x2qqn8= sha256:Y9hNYbWqaUdfaiw2I16kYy1frF17qlcqQTBK3s4v/z4= Return-Path: <python@mrabarnett.plus.com> 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=plus.com header.i=@plus.com header.b=iAB9nqP0; dkim-adsp=none (unprotected policy); dkim-atps=neutral X-Spam-Status: OK 0.035 X-Spam-Evidence: '*H*': 0.93; '*S*': 0.00; 'stream': 0.04; 'containing': 0.05; 'variable': 0.05; 'filled': 0.09; 'from:addr:python': 0.09; 'received:192.168.1.64': 0.09; '1024': 0.16; 'frequencies,': 0.16; 'from:addr:mrabarnett.plus.com': 0.16; 'from:name:mrab': 0.16; 'message-id:@mrabarnett.plus.com': 0.16; 'mic': 0.16; 'noise': 0.16; 'received:plus.net': 0.16; 'wrote:': 0.16; 'python': 0.16; 'to:addr:python-list': 0.20; 'list,': 0.24; 'actual': 0.25; 'follows:': 0.26; 'header:User-Agent:1': 0.30; 'subject:How': 0.31; 'question': 0.32; 'empty': 0.32; 'python- list': 0.32; 'but': 0.32; 'received:192.168.1': 0.32; 'there': 0.33; 'header:In-Reply-To:1': 0.34; 'main': 0.37; 'using': 0.37; 'hard': 0.37; 'received:192.168': 0.37; 'way': 0.38; 'finding': 0.39; 'want': 0.40; 'skip:i 20': 0.62; 'format': 0.62; 'rate': 0.67; 'collect': 0.69; 'voice': 0.69; 'analysis': 0.69; 'audio': 0.70; 'skip:f 30': 0.71; 'significant': 0.78; 'signals': 0.84; 'sound.': 0.84; 'subject: \n ': 0.84; 'subject:voice': 0.84; 'channels': 0.91; 'somebody': 0.91 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=plus.com; s=042019; t=1729956947; bh=zIFZLmb7YpW0/lkrEQk3AJLl7bTgMOuUhsH7xjgyfWo=; h=Date:Subject:To:References:From:In-Reply-To; b=iAB9nqP0lvO6LN82DCO986PrVq0UPeyMA6hXTiL2ptHwg0U9YKy4bZphYVNOOHU5B NDfMDQkzH7adngScI/+/tI8q5PU+K+/UoH/S6j2nXBOcwPy6OkCxBzFZCNvv2gCQi9 dP29Nxf0N3BOTi2yJ3NyadTIl0csS4qxzn0TWV7mZEZHxp6UScWMVlokbb0Eg0cFoN xsjkBCdobtC4MZbziFrOT1IQafHj4pqgH9UON99j34lXPOH0/Zx/okWQozducWkzlC RQQKvLqxlu049+wdDtDJUcunmRUV5LZ3cf/SiupwmEEP+7oKMFUPeudszCzpyVpoe7 lcEyaIQPw2rIg== X-Clacks-Overhead: "GNU Terry Pratchett" X-CM-Score: 0.00 X-CNFS-Analysis: v=2.4 cv=XaAqz555 c=1 sm=1 tr=0 ts=671d0c53 a=0nF1XD0wxitMEM03M9B4ZQ==:117 a=0nF1XD0wxitMEM03M9B4ZQ==:17 a=IkcTkHD0fZMA:10 a=VRVx_GPlBYUH00gGoc0A:9 a=QEXdDO2ut3YA:10 X-AUTH: mrabarnett@:2500 User-Agent: Mozilla Thunderbird Content-Language: en-GB In-Reply-To: <CAGJtH9TqEpGjQi+KYNrSV3+UtVO-jjFLK02N9MEA0uuQvr11qQ@mail.gmail.com> X-CMAE-Envelope: MS4xfNRIDqsJrMYU0xETOpgbOsI4jHzQJ993AI0Xwy8yBmSQpiYDOFXRXmohqL2e7xxz71FVBdwhQBUWFgA7sTTjedzZwNpccyJAmE2g5gD5HC7g0LMdBosf 1DO5kfZFOM4VXsldi00qiTHqIAVxr466E2f7GfqCL7DdEv6rpW0C5aU8jozFeQ3KJ35VcwqM0UMkVT7wgmggR2TmnNGp4lyKAso= X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.39 Precedence: list List-Id: General discussion list for the Python programming language <python-list.python.org> List-Unsubscribe: <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe> List-Archive: <https://mail.python.org/pipermail/python-list/> List-Post: <mailto:python-list@python.org> List-Help: <mailto:python-list-request@python.org?subject=help> List-Subscribe: <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe> X-Mailman-Original-Message-ID: <13ca3f2d-3a86-4771-9318-73ab806179a9@mrabarnett.plus.com> X-Mailman-Original-References: <CAGJtH9TqEpGjQi+KYNrSV3+UtVO-jjFLK02N9MEA0uuQvr11qQ@mail.gmail.com> Bytes: 5598 On 2024-10-25 17:25, marc nicole via Python-list 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? > > Thanks. If you do a spectral analysis and find peaks at certain frequencies, then there might be a "significant" sound.