Deutsch   English   Français   Italiano  
<mailman.48.1729873488.4695.python-list@python.org>

View for Bookmarking (what is this?)
Look up another Usenet article

Path: ...!fu-berlin.de!uni-berlin.de!not-for-mail
From: marc nicole <mk1853387@gmail.com>
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: <mailman.48.1729873488.4695.python-list@python.org>
References: <CAGJtH9TqEpGjQi+KYNrSV3+UtVO-jjFLK02N9MEA0uuQvr11qQ@mail.gmail.com>
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: <mk1853387@gmail.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=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; '<pre': 0.26; 'follows:': 0.26; 'sfxlen:2': 0.31;
 'subject:How': 0.31; 'message-id:@mail.gmail.com': 0.31;
 'question': 0.32; 'empty': 0.32; 'but': 0.32; 'there': 0.33;
 'received:google.com': 0.34; 'from:addr:gmail.com': 0.34; 'main':
 0.37; 'using': 0.37; 'hard': 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; 'audio': 0.70; 'skip:f 30': 0.71;
 '<span': 0.76; 'significant': 0.78; 'signals': 0.84;
 'subject:voice': 0.84; 'channels': 0.91; 'somebody': 0.91
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=gmail.com; s=20230601; t=1729873485; x=1730478285; darn=python.org;
 h=to:subject:message-id:date:from:mime-version:from:to:cc:subject
 :date:message-id:reply-to;
 bh=/TtregYyrXi/erlgMqYdExerNAqBFlLhHFr3aTLvORA=;
 b=jigiznyMAKwKBLiwzQC9u1Ju3t/g762kQYF+f/cMYXmX2urOTt75P5xiHiUvC4zG6N
 Xwg1mUpcTrmOKmaznQJe86wnNZLtCGCEQvaWq1Vji4lXXj77hW6i0k44iTkDPWgSPoOk
 ewHQoaEsFueV5eipJHre06Apcw7CPfay3UENJZjf9X9cF+YtvYMlsd3LzKLSi1DbyFdr
 ZqecO1O0DsLZq6zjIhTqkHMm04iR27jVVyiRSPCcrRTkEu5c8Hv5B8Yr27FgqGmEhfIJ
 JpyVS2mkeY2QNUVue2A+RHwRNDx9Gxjwcus1LFJLH2uIFKDjVsPY/CLa/SoSU6j2ecok
 Or3w==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20230601; t=1729873485; x=1730478285;
 h=to:subject:message-id:date:from:mime-version:x-gm-message-state
 :from:to:cc:subject:date:message-id:reply-to;
 bh=/TtregYyrXi/erlgMqYdExerNAqBFlLhHFr3aTLvORA=;
 b=fMa54ko6cOCnJ+JP4Di1sjnb99PPRqOC7mJDnD5tdiDphw/WM1PHORVNVHHsT2ErXm
 dwjYhIeGx/uE7NDar6u1GfRkMvJ5TybBg6WQ6RK9OpHDN3FHelJLXsGa5YwjLx8ayQw8
 qCgYeLYxZ0zNWS9YdY0vDd4CnWTWp/4j9qyZl6PwoTEviDX8WK+caqNBRwKylVq6Fdgd
 ZSHUZiQn76mDDbI32Sele9Vxl18SmUrciPkie0bcU6tADXBSnGqZyjN7kZ0AMCcXbo28
 H2JE90zkIX0DE1vRDq2mTXx7PjEjv4Hsdes4DGMjZ8VNZJ7r/iPfxRERvZXGcYRG0Oao
 aStw==
X-Forwarded-Encrypted: i=1;
 AJvYcCWwp9QUzzkejEzGQOJr18DC27oiceC46jHsZ15tq+ArSinQ34BvPvUvnELvd1HttPiCr/h5M1sncZMVJw==@python.org
X-Gm-Message-State: AOJu0YwI08I6GIQtx02qjFXR7iDdRAffpZlZdJDcT8FuAq2GXDxR1k8w
 nBFTxmccJj158BVRk0KAtL+eiW+bA3+LgDjCVYUbQAoYBXHfiZe+wBwRSmzvVMo9YgOdIlcgZ94
 YXNwkQxQnlP6wsQp+m2ymPFsHu1qDsi0p
X-Google-Smtp-Source: AGHT+IFor2K8THA3tCSxcFu4McLKjRUEpSarc8TDjELWTqn9xymFucZMAV1STCQdEeL2WNgrG7/BqBbyLfk12WRtjX4=
X-Received: by 2002:a05:690c:102:b0:6e2:12e5:35b4 with SMTP id
 00721157ae682-6e9d87bce9cmr1427507b3.0.1729873485148; Fri, 25 Oct 2024
 09:24:45 -0700 (PDT)
X-Content-Filtered-By: Mailman/MimeDel 2.1.39
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: <CAGJtH9TqEpGjQi+KYNrSV3+UtVO-jjFLK02N9MEA0uuQvr11qQ@mail.gmail.com>
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.